Announcement

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

  • spmap problem: data do not match with colors in map

    Hi everyone,

    I have a problem. I've done a -spmap- of Spain, by provincias, with a .shp file that I found on the web.
    But the problem, it's like the colors and numbers do not match with the real data.

    Could anyone give me a hand please?

    Here is the code:

    Code:
    **** Maping observations by zip_codes
            
        *Map - municipality
        preserve
        use export_contratos_with_geozip, clear
        duplicates drop id_numerical, force
        sort id_numerical
        
        // Map 
        spmap obs_by_zipcode using zip_code_spain_coord,  id(id_numerical) fcolor(Purples) ocolor(white ..) osize(0.05 ..)  legenda(on) legend(size(small)) legtitle("{bf: Number of observations per {em:provincia}}") legstyle(2) legjunction(" - ") clnumber(9)  name(map_income_muni, replace)
            graph export "./Figures/map_net_income_municipality.png", replace 
    
        restore
    And here is the -dataex- :

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float id_numerical byte sp_zipcode_twodigits str22(provincia texto) float obs_by_zipcode
    1222607 1 "Araba" "Álava" 6765
    1027318 1 "Araba" "Álava" 6765
     800557 1 "Araba" "Álava" 6765
    1118075 1 "Araba" "Álava" 6765
     405466 1 "Araba" "Álava" 6765
     954568 1 "Araba" "Álava" 6765
    1008361 1 "Araba" "Álava" 6765
    1005898 1 "Araba" "Álava" 6765
     600878 1 "Araba" "Álava" 6765
     775931 1 "Araba" "Álava" 6765
     956077 1 "Araba" "Álava" 6765
     709250 1 "Araba" "Álava" 6765
     363519 1 "Araba" "Álava" 6765
     614889 1 "Araba" "Álava" 6765
     195613 1 "Araba" "Álava" 6765
     657421 1 "Araba" "Álava" 6765
     796959 1 "Araba" "Álava" 6765
     812348 1 "Araba" "Álava" 6765
    1225028 1 "Araba" "Álava" 6765
    1160665 1 "Araba" "Álava" 6765
     381883 1 "Araba" "Álava" 6765
    ...
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float id_numerical byte sp_zipcode_twodigits str22(provincia texto) float obs_by_zipcode
    1217752 3 "Alacant" "Alicante" 35630
     753654 3 "Alacant" "Alicante" 35630
     731194 3 "Alacant" "Alicante" 35630
     556645 3 "Alacant" "Alicante" 35630
    1160901 3 "Alacant" "Alicante" 35630
     916587 3 "Alacant" "Alicante" 35630
     197579 3 "Alacant" "Alicante" 35630
     193112 3 "Alacant" "Alicante" 35630
     813199 3 "Alacant" "Alicante" 35630
     716620 3 "Alacant" "Alicante" 35630
     137747 3 "Alacant" "Alicante" 35630
     431223 3 "Alacant" "Alicante" 35630
    1153494 3 "Alacant" "Alicante" 35630
    1153835 3 "Alacant" "Alicante" 35630
     204355 3 "Alacant" "Alicante" 35630
      56607 3 "Alacant" "Alicante" 35630
     870966 3 "Alacant" "Alicante" 35630
    1000721 3 "Alacant" "Alicante" 35630
     603975 3 "Alacant" "Alicante" 35630
     602825 3 "Alacant" "Alicante" 35630
      84424 3 "Alacant" "Alicante" 35630
    end

    Could anyone help me please? Thank you very much

    Michael
    Click image for larger version

Name:	map_obs_by_zipcodes.png
Views:	1
Size:	109.3 KB
ID:	1727003
Working...
X