在Mathematica中,一个choropleth贴图的最小示例是什么样的? [英] What would a minimal example for a choropleth map in Mathematica look like?

查看:96
本文介绍了在Mathematica中,一个choropleth贴图的最小示例是什么样的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mathematica中 Choppleth 地图的最小示例是什么?看起来像什么?

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

我可以使用Import读取ESRI Shapefile,但是不知道如何处理导入的结果.

I can read in a ESRI Shapefile using Import, but do not know how to work with the imported result.

推荐答案

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

为什么要更换?如果没有给定国家/地区所需类型的数据,CountryData将返回Missing ["NotAvailable"],从而导致ColorData及其基础Blend函数不返回特定的RGB值.我将此未评估的Blend替换为黄色.

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.

这篇关于在Mathematica中,一个choropleth贴图的最小示例是什么样的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆