Statalist


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

Re: st: Map with wrong colors


From   Maurizio Pisati <[email protected]>
To   [email protected], [email protected]
Subject   Re: st: Map with wrong colors
Date   Thu, 06 Sep 2007 16:48:50 +0200

Dear Friedrich,
when option -clmethod(unique) is specified, -spmap- generates the (internal) classification variable _class with the following command:
egen _class = group(UNIQUEVAR), label lname(_class)
This way, only the valid values of UNIQUEVAR are kept and used for creating the choropleth map. If such valid values are just four, then variable _class will take only those four values and, therefore, only the first four colors specified in option -fcolor()- will be used. As suggested by Sergiy Radyakin in a previous message, as an alternative you might want to use your original variable (0-100 plus missing values) and specify options -clmethod(quantile)- and -clnumber(5): this should produce the result you're looking for.
Best,
Maurizio




At 00.05 06/09/2007, Friedrich Huebler wrote:

When I draw a choropleth map with -spmap- from SSC, the regions have
the wrong colors. I define a variable called "key" with the values 1
to 6, recoded from a variable with the range 0 to 100 percent. 1 to 5
identify quintiles and 6 identifies regions with missing data. My
-spmap- command is shown below, with fill colors specified with RGB
values.

#delimit ;
spmap key using map.dta,
  id(id)
  clmethod(unique)
  fcolor("215 25 28" "253 174 97" "255 255 191" "171 217 233" "44 123
182" "225 225 225")
;

None of the regions have a value below 20 and none have a value
between 60 and 80, so that the first and fourth color in the list
above ("215 25 28" = dark red and "171 217 233" = light blue) should
not appear on the map. However, the map is drawn with the first three
colors from the fcolor list instead of the second, third and fifth
color. All regions with the value 2 are filled with the color "215 25
28", all regions with the value 3 are filled with the color "253 174
97", and all regions with the value 5 are filled with the color "255
255 191".

What am I doing wrong?

Friedrich
*
*   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/
*
*   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