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: spmap with two legends?


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: st: spmap with two legends?
Date   Thu, 26 Aug 2010 07:28:13 -0500

The base map and the spatial objects (in this case -point()-)
superimposed onto the base map can have there own legend title using
the option -legtitle()-.  You could also add an over all legend title
with -legend(title("title"))-   Using the graph editor you can achieve
more control over the legend elements but I do not think you have two
separate legends.  In the example below, the -gr_edit- lines are taken
from a recording of the graph editor to alter the legend titles and
the legend position.



 use "Italy-RegionsData.dta", clear
 spmap relig1 using "Italy-RegionsCoordinates.dta", id(id)           ///
       clmethod(stdev) clnumber(5)
        ///
       legenda(on) legtitle(Title for Base)
         ///
       title("Pct. Catholics without reservations", size(*0.8))         ///
       point(data("Italy-Capitals.dta") xcoord(xcoord) ycoord(ycoord) ///
       by(size) fcolor(orange red maroon) shape(s ..)       ///
       legenda(on)  legtitle(" " "Title for Point") )              ///
       subtitle("Italy, 1994-98" " ", size(*0.8)) area(pop98)           ///
       map("Italy-OutlineCoordinates.dta") mfcolor(stone)
name(gr1,replace)

gr_edit .legend.plotregion1.label[1].style.editstyle size(vsmall) editcopy
gr_edit .legend.plotregion1.label[1].xoffset = -4
gr_edit .legend.plotregion1.label[7].style.editstyle size(vsmall) editcopy
gr_edit .legend.plotregion1.label[7].xoffset = -4
gr_edit .legend.xoffset = -6


Scott

On Wed, Aug 25, 2010 at 7:07 PM, Maria Ana Vitorino
<[email protected]> wrote:
> Hi,
> I was wondering if I can have 2 legends in a map created with spmap.
> For example, if one constructs the following map:
>
> . use "Italy-RegionsData.dta", clear
>    . spmap relig1 using "Italy-RegionsCoordinates.dta", id(id)          ///
>        clmethod(stdev) clnumber(5)                                      ///
>        title("Pct. Catholics without reservations", size(*0.8))         ///
>        point(data("Italy-Capitals.dta") xcoord(xcoord) ycoord(ycoord)
> by(size) fcolor(orange red maroon) shape(s ..) legenda(on)) ///
>        subtitle("Italy, 1994-98" " ", size(*0.8)) area(pop98)           ///
>        map("Italy-OutlineCoordinates.dta") mfcolor(stone)               ///
>
> Both legends (for the number of catholics and for the capitals) show up
> together... Can't I control the legends separately and use different titles
> and placement for the legends?
>
> Any help is appreciated.
> Thanks,
> Ana

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


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