Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with spmap legend option

    Hi,

    Im currently working on a map of Colombia with Stata 14 and spmap (Maurizio Pisati) based on the excellent resources that some users have posted here and so far no problema. But when I try to change the position of the legend it doesnt let me change it from the default position.

    Here is my code

    Code:
    use db_col, clear
    merge 1:1 NAME using attribute, assert(match) nogen
    
    spmap pcchange using coord_dep_cuadritos, id(_ID) /// 
        legenda(on) leg(position(8)) fcolor(Greens) ocolor(gs10 gs9 gs8 gs7) ///
        label( data(db_col_locations) xcoord(x_label) ycoord(y_label) ///
        by(lgroup) label(s)size(*0.6 ..) pos(0 6) length(27 25) ) ///
        line( data(conectores) ) legend(ring(0) bplace(s) bmargin(25 0 3 0))
    And this is what Im getting:

    Click image for larger version

Name:	Ejemplo.png
Views:	1
Size:	46.2 KB
ID:	1483935


    I have tried with different clock positions but it is the same every time. I was thinking that maybe with all the modification I did to the original shapefile I may have broke it (?)(haha).

    Thanks in advance.

  • #2
    You might try removing the option bplace(s).

    If that doesn't work, you could move the legend manually using the graph editor. Then if you want to move it programmatically afterward, use the syntax from the graph recording file after the not-documented command gr_edit like this:
    Code:
    net get spmap, replace
    use http://fmwww.bc.edu/repec/bocode/i/Italy-RegionsData.dta
    spmap relig1 using "Italy-RegionsCoordinates.dta", id(id) // legend in lower left
    gr_edit .legend.plotregion1.DragBy 98.34146011536015 75.88660127196292 // legend in upper right
    David Radwin
    Senior Researcher, California Competes
    californiacompetes.org
    Pronouns: He/Him

    Comment

    Working...
    X