旧金山行道树的四叉树

此示例显示了旧金山市按物种分类的城市维护行道树数据集的地理空间空模式(记录在一个区域与另一个区域中空的可能性是大还是小)。

在这种情况下,我们看到,有小,但显着的变化量在每一地区的树木分类的百分比,范围从88%至98%。

要获得更多可视化数据无效性的工具, check out the ``missingno` library <https://github.com/ResidentMario/missingno>`_ .

plot san francisco trees

出:

/tmp/vpy/lib/python3.8/site-packages/geopandas/geoseries.py:371: UserWarning: GeoSeries.isna() previously returned True for both missing (None) and empty geometries. Now, it only returns True for missing values. Since the calling GeoSeries contains empty geometries, the result has changed compared to previous versions of GeoPandas.
Given a GeoSeries 's', you can use 's.is_empty | s.isna()' to get back the old behaviour.

To further ignore this warning, you can do:
import warnings; warnings.filterwarnings('ignore', 'GeoSeries.isna', UserWarning)
  return self.isna()

import geopandas as gpd
import geoplot as gplt
import geoplot.crs as gcrs
import matplotlib.pyplot as plt


trees = gpd.read_file(gplt.datasets.get_path('san_francisco_street_trees_sample'))
sf = gpd.read_file(gplt.datasets.get_path('san_francisco'))


ax = gplt.quadtree(
    trees.assign(nullity=trees['Species'].notnull().astype(int)),
    projection=gcrs.AlbersEqualArea(),
    hue='nullity', nmax=1, cmap='Greens', scheme='Quantiles', legend=True,
    clip=sf, edgecolor='white', linewidth=1
)
gplt.polyplot(sf, facecolor='None', edgecolor='gray', linewidth=1, zorder=2, ax=ax)

plt.savefig("san-francisco-street-trees.png", bbox_inches='tight', pad_inches=0)

脚本的总运行时间: (0分17.042秒)

Gallery generated by Sphinx-Gallery