xdem.DEM.plot

Contents

xdem.DEM.plot#

DEM.plot(bands=None, cmap=None, vmin=None, vmax=None, alpha=None, title=None, cbar_title=None, add_cbar=True, ax=None, return_axes=False, savefig_fname=None, **kwargs)#
Overloads:
  • self, bands (int | tuple[int, …] | None), cmap (matplotlib.colors.Colormap | str | None), vmin (float | int | None), vmax (float | int | None), alpha (float | int | None), title (str | None), cbar_title (str | None), add_cbar (bool), ax (matplotlib.axes.Axes | Literal[‘new’] | None), return_axes (Literal[False]), savefig_fname (str | None), kwargs (Any) → None

  • self, bands (int | tuple[int, …] | None), cmap (matplotlib.colors.Colormap | str | None), vmin (float | int | None), vmax (float | int | None), alpha (float | int | None), title (str | None), cbar_title (str | None), add_cbar (bool), ax (matplotlib.axes.Axes | Literal[‘new’] | None), return_axes (Literal[True]), savefig_fname (str | None), kwargs (Any) → tuple[matplotlib.axes.Axes, matplotlib.colors.Colormap]

Plot the raster, with axes in projection of image.

This method is a wrapper to matplotlib.imshow with modifications to work on raster (flip Y-axis, lower origin, equal scale). Any **kwargs which you give this method will be passed to matplotlib.imshow. If the raster is passed with 3(4) bands, it is plotted as RGB(Alpha).

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

  • cmap (Colormap | str | None) – Colormap to use. Default is plt.rcParams[‘image.cmap’].

  • vmin (float | int | None) – Minimum value for colorbar. Default is data min.

  • vmax (float | int | None) – Maximum value for colorbar. Default is data max.

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

  • title (str | None) – Title of the plot. Default is None.

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

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

  • ax (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.

  • savefig_fname (str | None) – Path to quick save the output figure (previously created if an ax is give, new if not) with a default DPI, no transparency and no metadata. Use plt.savefig() to specify other save parameters or after other customizations. Warning: plt.close() or plt.show() still needs to be called to close the figure.

Returns:

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