Utility functions for plottingΒΆ
-
sciutils.plot.
alpha_cmap
(color, name='')ΒΆ Create a monochrome colormap that maps scalars to varying transparencies.
- Parameters
color (str, int, or tuple) β Base color to use for the colormap.
name (str) β Name of the colormap.
**kwargs (dict) β Keyword arguments passed to
mpl.colors.LinearSegmentedColormap.from_list()
.
- Returns
cmap β Colormap encoding scalars as transparencies.
- Return type
mpl.colors.Colormap
-
sciutils.plot.
evaluate_pcolormesh_edges
(x, scale='linear')ΒΆ Evaluate the n + 1 edges of cells for a pcolormesh visualisation for n cell centroids.
- Parameters
x (np.ndarray) β Centroids of the pcolormesh cells.
scale (str) β Find the arithmetic midpoints if linear and the geometric midpoints if log.
- Returns
edges β Edges of pcolormesh cells.
- Return type
np.ndarray
-
sciutils.plot.
plot_geometry
(geometries, aspect='equal', autoscale=True, scale=1, ax=None, **kwargs)ΒΆ Plot a shapely geometry using a polygon collection.
Note
This function does not plot holes in polygons.
- Parameters
geometries β Geometry to plot or sequence thereof.
aspect (str or float, optional) β Aspect ratio of the plot.
autoscale (bool, optional) β Whether to autoscale the plot.
ax (optional) β Axes to use for plotting.
**kwargs (dict) β Keyword arguments passed to matplotlib.collections.PolyCollection.
- Returns
collection β Collection of polygons.
- Return type
matplotlib.collections.PolyCollection