Announcement

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

  • Adding region labels to map (spmap SSC package)

    I am using spmap (M. Pisati - from SSC) to plot data on the map of England.

    To add the labels to the map I create a separate .dta file containing just the x,y coordinates of the label markers and the accompanying text (region name). I am following the help file, however, the following code does not seem to produce what I need. The names of the regions appear to be clustered at the bottom of the figure.

    Here is my code:

    Code:
    spmap avgrate_reg using ukcoord, label(data("colab.dta") x(X_) y(Y_) label(name) color(red)) id(reg_code) fcolor(Blues)
    Where label data is the name of the .dta file, x and y are the x,y coordinates and "name" is the name of the variable containing the region names. This is the figure produced and an example of the .dta file used.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double(X_ Y_) long name
    -1.72888 55.29701 4
    -2.77239 54.44944 5
    -1.28714 53.93264 9
     -.84969 52.79572 1
    -2.20358 52.55697 8
     .504207 52.24073 2
     -.30866 51.49227 3
     -.99311 51.45097 6
    -3.63346 50.81119 7
    end
    label values name name
    label def name 1 "East Midlands", modify
    label def name 2 "East of England", modify
    label def name 3 "London", modify
    label def name 4 "North East", modify
    label def name 5 "North West", modify
    label def name 6 "South East", modify
    label def name 7 "South West", modify
    label def name 8 "West Midlands", modify
    label def name 9 "Yorkshire and The Humber", modify
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	66.2 KB
ID:	1696159






Working...
X