Announcement

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

  • Looping an spmap command with regions' names on the maps

    Hello Stata users;

    I hope I could get some help with this. I'am working on this data:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(Shape_Leng Shape_Area) str12 Governorate_Name byte id0 float(consecutivedrydays1990 consecutivedrydays2000 consecutivedrydays2010 consecutivedrydays2020)
     1.665691 .04211232 "Ariana"       2  55.416  55.303  57.847  61.141
    4.3867736  .3681952 "Beja"         8  52.289  52.076  53.308  55.618
    1.7179574 .06661047 "Ben Arous"    3   53.46  53.599  56.039  58.461
     5.343521  .3661806 "Bizerte"      7  58.769  58.522  60.158    63.1
    4.5108953  .7290807 "Gabes"       19  93.529  93.583  95.072  98.462
     4.548769  .7402925 "Gafsa"       22  68.808  69.555  71.168  74.621
     3.647018  .3133408 "Jendouba"     9  50.708  50.376  51.369  53.909
     4.946872  .6479417 "Kairouan"    16   46.65  47.658  49.138  50.673
     4.989357  .8122157 "Kasserine"   17   46.81  48.063  48.924  50.276
     7.504424 2.1741836 "Kebili"      24 103.039 103.911  106.19 109.212
    4.1811414 .51084507 "Le Kef"      10  44.333  44.501  44.524  45.407
     4.073021 .28655812 "Mahdia"      14  62.175  62.873  63.675  65.765
    2.2618155  .1153453 "Manouba"      4  51.491  51.687  53.117   55.12
     9.757171  .8966198 "Medenine"    20 118.817 119.937 120.046 119.505
    2.2377114 .10218735 "Monastir"    13  65.619  66.063  67.581  69.789
      3.30774  .2840685 "Nabeul"       5  61.922  61.725  63.524  65.868
     7.548694  .6909879 "Sfax"        15  69.883  70.526  71.592  73.779
     5.466782  .7327916 "Sidi Bouzid" 18  56.814  58.176  60.042  62.447
     5.552421  .4684452 "Siliana"     11  45.615  45.986  46.558  47.553
     3.156125  .2278667 "Sousse"      12  53.631  54.136  55.859  58.171
    11.073194 3.6204395 "Tataouine"   21 132.807 135.468 137.765 138.191
     3.798989  .5907553 "Tozeur"      23  87.197  87.746  89.903  92.967
    1.6094854 .02651095 "Tunis"        1  54.158  54.579  57.917  60.592
    3.2403774 .28479052 "Zaghouan"     6  49.008  49.187   50.23  51.743
    end
    As you can see, it is some mapping data for Tunisia, it is about the number of consecutive dry days for each decade, from 1990 to 2085.
    I have used this command: spmap consecutivedrydays1990 using tngouvcoord, id(id0) clbreaks(44.333 51.0995 56.115 69.3455 132.807) fcolor(OrRd)

    The problem is that I have to change the variable "consecutivedrydays" for each decade in order to generate the corresponding map, also, I do have the names of the regions "Governorate_Name" in the data, yet I want to have those on the map (preferably, on the center of each corresponding region or governorate). Is there any way, any Stata code that could help me loop the spmap command by decades to create the maps by decade (and also, I need to fix the "clbreaks" option) with the names of the regions on those maps.

    I do want to have those maps in order to study how some regions are getting hotter and hotter with time, that's why I want to fix the clbreaks option throught all of the maps.

    Any help please? I would be so greatful!
Working...
X