pytopomap.plot ============== .. py:module:: pytopomap.plot .. autoapi-nested-parse:: Created on Wed Jun 2 16:16:39 2021 @author: peruzzetto Functions --------- .. autoapisummary:: pytopomap.plot.plot_topo pytopomap.plot.plot_imshow pytopomap.plot.plot_data_on_topo pytopomap.plot.plot_maps Module Contents --------------- .. py:function:: plot_topo(z: numpy.ndarray, x: numpy.ndarray, y: numpy.ndarray, contour_step: float = None, nlevels: int = None, level_min: float = None, step_contour_bold: float | str = 'auto', contour_labels_properties: dict = None, label_contour: bool = True, contour_label_effect: list = None, axe: matplotlib.axes._axes.Axes = None, vert_exag: float = 1.0, ndv: int | float = -9999, uniform_grey: str = 'auto', contours_prop: dict = None, contours_bold_prop: dict = None, figsize: tuple[float] = None, interpolation: str = None, sea_level: int | float = 0, sea_color: str = None, alpha: float = 1.0, azdeg: int | float = 315, altdeg: int | float = 45) -> matplotlib.axes._axes.Axes Plot topography with hillshading. :param z: 2D array of elevation values. :type z: np.ndarray :param x: 1D array of X coordinates. :type x: np.ndarray :param y: 1D array of Y coordinates. :type y: np.ndarray :param contour_step: Interval between thin contour lines. Automatically determined if None. The default is None. :type contour_step: float, optional :param nlevels: Number of contour levels to draw if "contour_step" is not set. The default is None. :type nlevels: TYPE, optional :param level_min: Minimum contour level. Automatically calculated if None. The default is None. :type level_min: float, optional :param step_contour_bold: Interval between bold contour lines. If "auto", computed from elevation range. The default is "auto". :type step_contour_bold: float or str, optional :param contour_labels_properties: Properties passed to "ax.clabel()" for contour labels. The default is None. :type contour_labels_properties: dict, optional :param label_contour: If True, add labels to bold contour lines. The default is True. :type label_contour: bool, optional :param contour_label_effect: List of matplotlib.patheffects to apply to contour labels. The default is None. :type contour_label_effect: list, optional :param axe: Existing axes object to draw the plot on. The default is None. :type axe: matplotlib.axes._axes.Axes, optional :param vert_exag: Vertical exaggeration factor for hillshading. The default is 1. :type vert_exag: float, optional :param ndv: No-data value in the elevation array. The default is -9999. :type ndv: int or float, optional :param uniform_grey: If "auto", use auto_uniform_grey to compute the hillshading. The default is "auto". :type uniform_grey: str, optional :param contours_prop: Properties for thin contour lines. The default is "auto". :type contours_prop: dict, optional :param contours_bold_prop: Properties for bold contour lines. The default is "auto". :type contours_bold_prop: dict, optional :param figsize: Figure size (width, height) if a new figure is created. The default is None. :type figsize: tuple[float], optional :param interpolation: Interpolation method for "imshow". The default is None. :type interpolation: str, optional :param sea_level: Sea level threshold for optional sea overlay. The default is 0. :type sea_level: int or float, optional :param sea_color: Color used to fill areas below sea level. If None, no sea mask is applied. The default is None. :type sea_color: str, optional :param alpha: Transparency for the hillshading layer. The default is 1. :type alpha: float, optional :param azdeg: Azimuth angle for light source (degrees from North). The default is 315. :type azdeg: int or float, optional :param altdeg: Altitude angle for light source (degrees above horizon). The default is 45. :type altdeg: int or float, optional :returns: **axe** -- Axes object containing the plotted topography. :rtype: matplotlib.axes._axes.Axes .. py:function:: plot_imshow(x: numpy.ndarray, y: numpy.ndarray, data: numpy.ndarray, axe: matplotlib.axes._axes.Axes = None, figsize: tuple[float] = None, cmap: str = None, minval: int | float = None, maxval: int | float = None, vmin: float = None, vmax: float = None, alpha: float = 1.0, minval_abs: float = None, cmap_intervals: tuple[int] | tuple[float] = None, unique_values: bool = False, extend_cc: str = 'max', plot_colorbar: bool = True, axecc: matplotlib.axes._axes.Axes = None, colorbar_kwargs: dict = None, aspect: str | float = None) -> matplotlib.axes._axes.Axes plt.imshow data with some pre-processing. :param x: 1D array of X coordinates. :type x: np.ndarray :param y: 1D array of Y coordinates. :type y: np.ndarray :param data: 2D array of data values. :type data: np.ndarray :param axe: Existing axes object to draw the plot on. The default is None. :type axe: matplotlib.axes._axes.Axes, optional :param figsize: Figure size (width, height) if a new figure is created. The default is None. :type figsize: tuple[float], optional :param cmap: Name of the colormap to use. If None, use "hot_r" or "seismic". The default is None. :type cmap: str, optional :param minval: Minimum value to display. The default is None. :type minval: int or float, optional :param maxval: Maximum value to display. The default is None. :type maxval: int or float, optional :param vmin: Alias for minval. The default is None. :type vmin: float, optional :param vmax: Alias for maxval. The default is None. :type vmax: float, optional :param alpha: Transparency for the data layer. The default is 1. :type alpha: float, optional :param minval_abs: If set, masks values with absolute magnitude below this threshold. The default is None. :type minval_abs: float, optional :param cmap_intervals: Explicit color intervals for categorical or segmented color mapping. The default is None. :type cmap_intervals: tuple of int or float, optional :param unique_values: If True, use discrete colormap with ticks corresponding to unique values. The default is False. :type unique_values: bool, optional :param extend_cc: Behavior of colorbar outside bounds, can be "neither", "min", "max", "both". The default is "max". :type extend_cc: str, optional :param plot_colorbar: Whether to add a colorbar. The default is True. :type plot_colorbar: bool, optional :param axecc: Axes object for the colorbar. If None, colorbar is placed automatically. The default is None. :type axecc: matplotlib.axes._axes.Axes, optional :param colorbar_kwargs: Additional keyword arguments passed to "figure.colorbar". :type colorbar_kwargs: dict, optional :param aspect: Aspect ratio of the image. Can be "equal", "auto", or a numeric value. :type aspect: str or float, optional :returns: **axe** -- Axes object with the image and optional colorbar. :rtype: matplotlib.axes._axes.Axes .. py:function:: plot_data_on_topo(x: numpy.ndarray, y: numpy.ndarray, z: numpy.ndarray, data: numpy.ndarray, axe: matplotlib.axes._axes.Axes = None, figsize: tuple[float] = None, cmap: str = None, minval: int | float = None, maxval: int | float = None, vmin: float = None, vmax: float = None, minval_abs: float = None, cmap_intervals: tuple[int] | tuple[float] = None, unique_values: bool = False, extend_cc: str = 'max', topo_kwargs: dict = None, alpha: float = 1.0, plot_colorbar: bool = True, axecc: matplotlib.axes._axes.Axes = None, colorbar_kwargs: dict = None, mask: numpy.ndarray = None, alpha_mask: float = None, color_mask: str = 'k', xlims: int | float = None, ylims: int | float = None) -> matplotlib.axes._axes.Axes Plot array data on topo. :param x: 1D array of X coordinates. :type x: np.ndarray :param y: 1D array of Y coordinates. :type y: np.ndarray :param z: 2D array of elevation values. :type z: np.ndarray :param data: 2D array of data values. :type data: np.ndarray :param axe: Existing axes object to draw the plot on. The default is None. :type axe: matplotlib.axes._axes.Axes, optional :param figsize: Figure size (width, height) if a new figure is created. The default is None. :type figsize: tuple[float], optional :param cmap: Name of the colormap to use. If None, use "hot_r" or "seismic". The default is None. :type cmap: str, optional :param minval: Minimum value to display. The default is None. :type minval: int or float, optional :param maxval: Maximum value to display. The default is None. :type maxval: int or float, optional :param vmin: Alias for minval. The default is None. :type vmin: float, optional :param vmax: Alias for maxval. The default is None. :type vmax: float, optional :param minval_abs: If set, masks values with absolute magnitude below this threshold. The default is None. :type minval_abs: float, optional :param cmap_intervals: Explicit color intervals for categorical or segmented color mapping. The default is None. :type cmap_intervals: tuple of int or float, optional :param unique_values: If True, use discrete colormap with ticks corresponding to unique values. The default is False. :type unique_values: bool, optional :param extend_cc: Behavior of colorbar outside bounds, can be "neither", "min", "max", "both". The default is "max". :type extend_cc: str, optional :param topo_kwargs: Additional keyword arguments passed to "plot_topo". The default is None. :type topo_kwargs: dict, optional :param alpha: Transparency for the data layer. The default is 1. :type alpha: float, optional :param plot_colorbar: Whether to add a colorbar. The default is True. :type plot_colorbar: bool, optional :param axecc: Axes object for the colorbar. If None, colorbar is placed automatically. The default is None. :type axecc: matplotlib.axes._axes.Axes, optional :param colorbar_kwargs: Additional keyword arguments passed to "figure.colorbar". :type colorbar_kwargs: dict, optional :param mask: Binary 2D array of same shape as "data". Used to overlay a mask. Masked regions are displayed with "color_mask". The default is None. :type mask: np.ndarray, optional :param alpha_mask: Transparency of the mask overlay. The default is None (fully opaque). :type alpha_mask: float, optional :param color_mask: Color used to draw the mask overlay. The default is "k". :type color_mask: str, optional :param xlims: X-axis display limits (min, max). If None, auto-scaled. The default is None. :type xlims: tuple of float, optional :param ylims: Y-axis display limits (min, max). If None, auto-scaled. The default is None. :type ylims: tuple of float, optional :returns: **axe** -- The axes object containing the final plot. :rtype: matplotlib.axes._axes.Axes .. py:function:: plot_maps(x: numpy.ndarray, y: numpy.ndarray, z: numpy.ndarray, data: numpy.ndarray, t: numpy.ndarray, file_name: str = None, folder_out: str = None, figsize: tuple[float] = None, dpi: int = None, fmt: str = 'png', sup_plt_fn=None, sup_plt_fn_args=None, **kwargs) -> None Plot and save maps of simulations outputs at successive time steps :param x: 1D array of X coordinates. :type x: np.ndarray :param y: 1D array of Y coordinates. :type y: np.ndarray :param z: 2D array of elevation values. :type z: np.ndarray :param data: 2D array of data values. :type data: np.ndarray :param t: List time steps, same length as the third dimension of "data". :type t: np.ndarray :param file_name: Base name for the output image files. The default is None. :type file_name: str, optional :param folder_out: Path to the output folder. If not provides, figures are not saved. The default is None. :type folder_out: str, optional :param figsize: Size of each figure (width, height). The default is None. :type figsize: tuple[float], optional :param dpi: Resolution for saved figures. Only used if "folder_out" is set. The default is None. :type dpi: int, optional :param fmt: File format for saving figures. Default is "png". :type fmt: str, optional :param sup_plt_fn: A custom function to apply additional plotting on the axes. The default is None. :type sup_plt_fn: callable, optional :param sup_plt_fn_args: Arguments to pass to "sup_plt_fn". The default is None. :type sup_plt_fn_args: dict, optional :param \*\*kwargs: Additional keyword arguments passed to "plot_data_on_topo". :type \*\*kwargs: dict