def add_patches(ax, patch_array, **kwargs):
"""
Add patches (points in the form Nx2) to axes
Add patches (points in the form Nx2) to existing axes ax
using :class:`matplotlib:matplotlib.collections.PolyCollection`.
.. versionadded:: 0.6.0
Parameters
----------
ax : :class:`matplotlib:matplotlib.axes.Axes`
patch_array : nested :class:`numpy:numpy.ndarray` Nx2 array(s)
kwargs : :class:`matplotlib:matplotlib.collections.PolyCollection`
Examples
--------
See :ref:`notebooks/visualisation/wradlib_overlay.ipynb`.
"""
try:
ax.add_collection(PolyCollection([patch_array], **kwargs))
except AssertionError:
ax.add_collection(PolyCollection([patch_array[None, ...]], **kwargs))
except ValueError:
for patch in patch_array:
add_patches(ax, patch, **kwargs)
评论列表
文章目录