⚠️ Our 0.1 release refactored several early-development functions for long-term stability, to update your code see here. ⚠️
Future changes will come with deprecation warnings! 🙂




Raster.plot(bands=None, cmap=None, vmin=None, vmax=None, alpha=None, cbar_title=None, add_cbar=True, ax=None, return_axes=False, **kwargs)[source]#

Plot the raster, with axes in projection of image.

This method is a wrapper to rasterio.plot.show. Any **kwargs which you give this method will be passed to it.

  • bands (int | tuple[int, ...] | None) – Bands to plot, from 1 to self.count (default is all).

  • cmap (Colormap | str | None) – The figure’s colormap. Default is plt.rcParams[‘image.cmap’].

  • vmin (float | int | None) – Colorbar minimum value. Default is data min.

  • vmax (float | int | None) – Colorbar maximum value. Default is data max.

  • alpha (float | int | None) – Transparency of raster and colorbar.

  • cbar_title (str | None) – Colorbar label. Default is None.

  • add_cbar (bool) – Set to True to display a colorbar. Default is True.

  • ax (Union[Axes, Literal['new'], None]) – A figure ax to be used for plotting. If None, will plot on current axes. If “new”, will create a new axis.

  • return_axes (bool) – Whether to return axes.

Return type:

None | tuple[Axes, Colormap]


None, or (ax, caxes) if return_axes is True.

You can also pass in **kwargs to be used by the underlying imshow or contour methods of matplotlib. The example below shows provision of a kwarg for rasterio.plot.show, and a kwarg for matplotlib as well:

import matplotlib.pyplot as plt
ax1 = plt.subplot(111)
mpl_kws = {'cmap':'seismic'}
myimage.plot(ax=ax1, mpl_kws)