pysal.viz.splot.mapping.
vba_legend
(rgb_bins, alpha_bins, cmap, ax=None)[源代码]¶通过用作副歌图例的alpha heatmap创建值。
参数: |
|
---|---|
返回: |
|
实例
进口
>>> from pysal.lib import examples
>>> import geopandas as gpd
>>> import matplotlib.pyplot as plt
>>> import matplotlib
>>> import numpy as np
>>> from pysal.viz.splot.mapping import vba_legend, mapclassify_bin
加载示例数据
>>> link_to_data = examples.get_path('columbus.shp')
>>> gdf = gpd.read_file(link_to_data)
>>> x = gdf['HOVAL'].values
>>> y = gdf['CRIME'].values
对数据进行分类
>>> rgb_bins = mapclassify_bin(x, 'quantiles')
>>> alpha_bins = mapclassify_bin(y, 'quantiles')
绘制你的传奇
>>> fig, _ = vba_legend(rgb_bins, alpha_bins, cmap='RdBu')
>>> plt.show()
(Source code, png, hires.png, pdf)