Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Question about -spmap-, defining polygons, and/or Stata colors

From   Stata Chris <>
Subject   Re: st: Question about -spmap-, defining polygons, and/or Stata colors
Date   Tue, 17 Jan 2012 14:24:14 +0100

Hm, I had hoped that I could solve the problem more easily if only I
was able to pick the same color for -ndfcolor()- as Stata picks once
I've told it the color set in -fcolor()-.

If that's not possible then I guess I need to find a way to define the
missing areas myself, I'm just not sure how to find their coordinates.
Each defined area has a 5, 10 or more points, I guess all corners of
the polygon, i.e. any border point that is not on the straight line
between any pair of other border points? Then I guess each corner must
feature in the polygon of at least two counties, so all polygons that
I need are already in the dataset, I just need to identify them.

I guess then a first step could be that I take all border points that
appear only once and are not on the external country border. But this
leaves 2 problems:
(1) How would I know which of these belong to one of the missing counties?
(2) I will also need a few points that are already in the dataset
twice, because there are some points where three counties meet.

Would anyone happen to have an idea of how to do this?

Thanks so much,

On 17 January 2012 10:30, Maurizio Pisati <> wrote:
> Dear Chris,
> in -spmap- there is no direct way to represent spatial objects that are not defined in some proper dataset. Specifically, if 4 countries are not defined in your base map dataset "coord", then you cannot ask -spmap- to color them in blue, because for -spmap- there is nothing to color -- as indicated in the -spmap- help file, option ndfcolor() specifies the fill color of empty base map polygons, "empty" meaning that such polygons do exist but have no data attached. I guess that the only easy way to go is to have a base map that includes all the counties you would like to represent.
> Best wishes,
> Maurizio
> Il giorno 16/gen/2012, alle ore 16.38, Stata Chris ha scritto:
>> Dear list members,
>> I have a question about Pisani's -spmap- and Stata colors:
>> I'd like to draw a map with counties and states, and would like to
>> color treated counties darker than non-treated ones. I mostly get
>> there with the following command:
>> spmap Treated using "C:\coord", id(id) fcolor(Blues) ndfcolor(blue)
>> clmethod(unique) polygon(data("C:\states") osize(0.75))
>> legend(position(11)) title("Treated")
>> The only problem is that apparently for 4 counties the polygons are
>> not defined in my coordinates dataset. However, I know that these
>> areas (situated entirely within the treated region) should also be
>> colored as treated, so I'd like the non-defined to get the same color
>> as the treated areas. But I don't manage to. Any ideas?
>> I've tried entering -blue-, -navy- etc for -ndfcolor()- but never
>> manage to capture the same color as is automatically picked for the
>> surrounding areas using the "Blues" pattern. (same problem when I try
>> analogously with Reds).
>> I also considered whether I couldn't just define the missing polygons,
>> but I'm not sure how I would do that?
>> Thanks a lot for any suggestions,
>> Chris
>> *
>> *   For searches and help try:
>> *
>> *
>> *
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index