Bookmark and Share

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


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

Re: st: Some questions regarding spmap


From   Maurizio Pisati <maurizio.pisati@unimib.it>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Some questions regarding spmap
Date   Mon, 28 Jan 2013 21:41:04 +0100

Dear Francesco,


> 1) I would like to make a figure with maps of regions by the value of the
> Lilien index by years. I can make a figure for a single year, using the
> following command:
> 
> spmap freq_li using "Italy-RegionsCoordinates.dta" if year==2005, id(reg)
> fcolor(bluishgray cyan blue navy) title("Lilien index", size(*0.8))        
> ///
>              subtitle("Italy, value relative to 2005" " ", size(*0.8))
> legstyle(2) legend(region(lcolor(black))) clmethod(eqint) clnumber(5)
> 
> To get 6 small maps by year, I simply add by(year):
> 
> spmap freq_li using "Italy-RegionsCoordinates.dta" if year>2004, id(reg)
> fcolor(bluishgray cyan blue navy) title("Lilien index", size(*0.8))        
> ///
>              subtitle("Italy, value relative to 2005" " ", size(*0.8))
> legstyle(2) legend(region(lcolor(black))) clmethod(eqint) clnumber(5)
> by(year)
> 
> However, I get the following error message: 
> 
> Variable reg specified in option id() does not uniquely identify the
> observations
> 
> I would very much appreciate if you could help me with this. I suppose that
> the problem is that I need to tell stata that this is a panel. I have tried
> running the following command:
> 
> sort reg year
> tsset reg year
> 
> but the problem is not solved.

-spmap- (a user-written program available, thanks to Kit Baum, from the SSC Archive) doesn't work properly with option -by()-. Here's the relevant portion of the -spmap- help file that points to this limitation:

graph_options                        Description
--------------------------------------------------------------------------------------------------------------------
Main
  polyfirst                          draw supplementary polygons before the base map
  gsize(#)                           length of shortest side of available area (in inches)
  freestyle                          ignore built-in graph formatting presets and restrictions
  twoway_options                     any options documented in [G] twoway_options, except for aspect_option,
                                       scheme_option, by_option, and advanced_options
--------------------------------------------------------------------------------------------------------------------

To get the results you're interested in, you might adapt to your needs the last example reported in the -spmap- help file under the heading "Examples 2: Proportional symbol maps".



> 2) How can I reduce down to two decimals the range of variation of the
> Lilien index in the legend of the map?

Before using -spmap-, format the variable of interest the way you like, e.g.:

. format freq_li %5.2f


Best wishes,
Maurizio


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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