What would a minimal example for a choropleth map in Mathematica look like?

后端 未结 5 829
抹茶落季
抹茶落季 2021-02-06 11:19

What would a minimal example for a choropleth map in Mathematica look like?

I can read in a ESRI Shapefile using Import, but do not know how to work with th

5条回答
  •  终归单人心
    2021-02-06 11:52

    Graphics[
       {
        ColorData["ThermometerColors"][
                                Rescale[CountryData[#, "GDPPerCapita"], {100, 50000}]
                                      ] /. HoldPattern[Blend[___]] -> Yellow, 
        CountryData[#, "Polygon"]
       } & /@
       CountryData[]
    ]
    

    enter image description here

    And why the replacement? If there are no data of the required type for a given country CountryData returns Missing["NotAvailable"], causing ColorData, and its underlying Blend function not to return a specific RGB value. I replace this unevaluated Blend with the color Yellow.

提交回复
热议问题