<p>在R中有很多方法可以做到这一点(参见<a href="http://cran.r-project.org/web/views/Spatial.html" rel="nofollow noreferrer">spatial view</a>);其中很多方法都是<a href="http://cran.r-project.org/web/packages/maps/index.html" rel="nofollow noreferrer">depend on the "maps" package</a>。</p>
<ul>
<li><p>看看这个<a href="http://www.ai.rug.nl/~hedderik/R/US2004/" rel="nofollow noreferrer">cool example of the US 2004 election</a>。结果是这样的:<a href="https://i.stack.imgur.com/JfrF4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JfrF4.png" alt="alt text"/></a></p></li>
<li><p>下面是一个稍微难看的模型示例<a href="http://addictedtor.free.fr/graphiques/sources/source_146.R" rel="nofollow noreferrer">that uses the "maps" package with "lattice".</a></p></li>
<li>安德鲁·盖尔曼拍了一些很好的情节。例如,请参见<a href="http://www.stat.columbia.edu/~cook/movabletype/archives/2009/03/how_went_the_20.html" rel="nofollow noreferrer">this blog post on red states/blue states</a>和<a href="http://www.stat.columbia.edu/~cook/movabletype/archives/2009/05/discussion_and.html" rel="nofollow noreferrer">this follow up post</a>。</li>
<li><p>这里有一个非常简单的例子<a href="http://cran.r-project.org/web/packages/gmaps/index.html" rel="nofollow noreferrer">using the "gmaps" package</a>,它显示了每10万人中有10万人因谋杀被国家逮捕:</p>
<pre><code>require(gmaps)
data(USArrests)
attach(USArrests)
grid.newpage()
grid.frame(name="map")
grid.pack("map",USALevelPlot(states=rownames(USArrests),levels=Murder,col.fun=reds),height=unit(1,'null'))
grid.pack("map",gradientLegendGrob(at=quantile(Murder),col.fun=reds),side="bottom",height=unit(.2,'npc'))
detach(USArrests)
</code></pre></li>
</ul>