Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Classes in spmap


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Classes in spmap
Date   Mon, 28 Apr 2008 18:25:29 +0100

You are not getting what you want in the case of exact matches with
boundaries. 

It's not elegant, but fudging boundary cases upwards would seem to solve
your problem. 

clonevar myvar2 = myvar 
replace myvar2 = myvar2 + 0.5 if inlist(myvar2, 30, 40, 45, 50, 100) 

Note that 

1. I recommend working on a cloned version of your data _only_. 

2. This will work well in your example as your boundaries are integers
and no precision issues arise with testing for equality. It wouldn't
work so easily with fractions. 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Richard
Ohrvall
Sent: 28 April 2008 18:05
To: [email protected]
Subject: Re: st: Classes in spmap

Thank you for your reply,

I assume you mean the other way around, i.e. to set the clbreak
slightly smaller.

Yes, that was my solution as well. But it seems a bit unpractical
since I have to check the observations in order to know how much
smaller I should set the breaks. It works, but I just wanted to know
if there was an option I could use to handle this.

All the best,
Richard

On 4/28/08, Scott Merryman <[email protected]> wrote:
> You could set the clbreak slightly larger and then relabel the legend
> keys.  Something like:
>
> spmap var1 using "geo_kor.dta", id(id) fcolor(Greys2) clmethod(custom)
> clbreaks(0 30.01 40.01 45.001 50.01 100) legend(symy(*2) symx(*2)
> size(*2) position
> (10)) legorder(lohi) legend(label(2 "0 to 30") label(3 "30 to 40" )
> label(4 "40 to 45" )  label(5 "45 to 50" )  label(6 "50 to 100" ))
>
> Scott
>
>
> On Mon, Apr 28, 2008 at 9:26 AM, Richard Ohrvall
> <[email protected]> wrote:
> > Dear all,
> >
> > I am creating a map using the great user-written ado-file spmap.
> > However, I have a small problem. I am using the following code:
> >
> > spmap var1 using "geo_kor.dta", id(id) fcolor(Greys2)
clmethod(custom)
> > clbreaks(0 30 40 45 50 100) legend(symy(*2) symx(*2) size(*2)
position
> > (10)) legorder(lohi)
> >
> > The class breaks are where I would like them, but I would like the
> > first class to include all values up to, but not including, 30. The
> > default is that the value 30 will be included in the first class
> > (0-30). Is there some way to change this so that observations with
> > value 30 on var1 will be included in the second class (30-40)? I
have
> > looked in the help for spmap, but I could not find any solution.
> >

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index