Announcement

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

  • Labels of Maps in STATA

    Dear Everyone,

    Can anyone please tell me how to label maps in STATA? like I just need my map to show the names of the district or any variable that holds some information about that district.

    This is the code i'm using:

    spmap adm2 using sl_coordinates.dta, id(id)

    where adm2 is the variable which includes names of the 14 districts coded from 1-14

    Thanks!

  • #2
    You may try this:

    Code:
    . spmap adm2 using "sl_coordinates.dta", id(id) label(xcoord(x_c) ycoord(y_c) label(adm2))
    Hopefully that helps!

    Best,

    Marcos
    Best regards,

    Marcos

    Comment


    • #3
      Originally posted by Marcos Almeida View Post
      You may try this:

      Code:
      . spmap adm2 using "sl_coordinates.dta", id(id) label(xcoord(x_c) ycoord(y_c) label(adm2))
      Hopefully that helps!

      Best,

      Marcos

      It doesn't. It gives an error saying:

      . spmap adm2 using "sl_coordinates.dta", id(id) label(xcoord(x_c) ycoord(y_c) label(adm2))
      Problem with option label(): variable x_c specified in suboption xcoord() not found
      r(111);

      Comment


      • #4
        See here for an example and page 10 of the manual.
        Best, Sergiy Radyakin

        Comment


        • #5
          Hello Danis,

          Naturally, you are supposed to use the option "genc()" (please check the help files) whenever transforming the shapefile in dta file, otherwise it would be impossible for you to have what you didn't asked for.

          Stata is just reminding you that you didn't yet prepare the dta file in the correct way, with centroids, so as to be fully capable to insert the labels under - spmap -program,. The option xcoord(x_c) and ycoord(y_c) are exactly to find these variables, which were, supposedly, created beforehand.
          Last edited by Marcos Almeida; 21 Jun 2016, 16:19.
          Best regards,

          Marcos

          Comment

          Working...
          X