跳转到主要内容

Legendgrams是地图图例,用于可视化给定地图中观测值的颜色分布

项目描述

这是一个提供legendgrams的小型未经过单元测试、可复制的代码。Legendgrams是地图图例,用于可视化给定地图中观测值的颜色分布

Silhouettes in Brooklyn

Legendgrams由PySAL分发,PySAL是一个开源的跨平台空间分析函数库,用Python编写。它旨在支持高级空间分析应用的开发。

要使用legendgrams,只需使用pip安装该软件包

$ pip install legendgram

然后,将函数应用于您想要legendgram的图形/坐标轴

>>> import pysal as ps, geopandas as gpd, matplotlib.pyplot as plt
>>> from legendgram import legendgram
>>> data = gpd.read_file(ps.examples.get_path('south.shp'))
>>> data.crs = {'init': 'epgs:4269'}
>>> data.to_crs(epsg=5070)
>>> f,ax = plt.subplots()
>>> data.plot('DV80', k=10, ax=ax, scheme='Quantiles')
>>> bins = ps.Quantiles(data['DV80'].values, k=10).bins
>>> from legendgram import legendgram
>>> import palettable.matplotlib as palmpl
>>> legendgram(f,ax,data['DV80'],bins,pal=palmpl.Viridis_10,
               legend_size=(.5,.2), # legend size in fractions of the axis
               loc = 'upper left' # matplotlib-style legend locations
               clip = (2,10) # clip the displayed range of the histogram
               )
Example legendgram map in the US south

还提供了一个示例笔记本,在此提供

许可证

此代码基于3-Clause BSD许可证。有关更多详细信息,请参阅许可证文件。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于 安装软件包 的信息。

源代码分发

legendgram-0.0.3.tar.gz (683.8 kB 查看哈希值)

上传时间

构建分发版

legendgram-0.0.3-py2.py3-none-any.whl (7.7 kB 查看哈希值)

上传时间 Python 2 Python 3

由以下支持