landlab.plot.network_sediment_transporter.plot_network_and_parcels

Plot outputs of the NetworkSedimentTransporter.

This code plots:

  • the network, with option to color each link according to a link attribute.

  • the parcels, with option to color and size each parcel according to parcel attributes.

Authors: Katy Barnhart, Jon Czuba, Allison Pfeiffer

plot_network_and_parcels(grid, parcels, parcel_time_index=None, map_buffer=0.1, parcel_filter=None, network_color=None, link_attribute=None, link_attribute_title=None, network_cmap='cividis', network_norm=None, network_linewidth=None, parcel_color=None, parcel_color_attribute=None, parcel_color_attribute_title=None, parcel_color_cmap='plasma', parcel_color_norm=None, parcel_size=None, parcel_size_attribute=None, parcel_size_attribute_title=None, parcel_size_norm=None, parcel_size_min=5, parcel_size_max=40, parcel_alpha=0.5, fig=None, output=None, **kwargs)[source]

Plot a river network and parcels on the river network.

Intended to display the results of the NetworkSedimentTransporter component.

The river network (an instance of NetworkModelGrid) is plotted either as straight links between grid nodes, or (if the network was created using a shapefile to set network topology) as sinuous lines representing the actual link geometry.

The parcels (an instance of DataRecord) are represented as dot markers along the links, with the marker location set by parcel attribute location_at_link. The default is to plot the parcel locations at the last timestep in :class`~.DataRecord`, though any time index may be specified.

Use of this plotting tool is described in detail in a landlab tutorial.

Parameters:
  • grid (NetworkModelGrid) – Instance of NetworkModelGrid.

  • parcels (DataRecord) – Instance of Landlab DataRecord, with the same attribute requirements as NetworkSedimentTransporter.

  • parcel_time_index (int, optional) – Parcel time index to plot. Default is last timestep in parcels DataRecord.

  • map_buffer (float, optional) – Increase the plot extent by at least this much. Note, because of axis equal, may be more.

  • parcel_filter (array_like of bool, shape (number_of_parcels, ), optional) – Filter to plot only a selection of the parcels.

  • network_color (str, optional) – Uniform color for network links.

  • link_attribute (array_like or str, optional) – Value (as either an array or the name of an at-link field) used to set link color. Categorical options not supported. Must be continuous.

  • link_attribute_title (str, optional) – String to use as the title, if link_attribute is a string, it is used as the default.

  • network_cmap (str, optional) – Name of colormap for network.

  • network_norm (matplotlib.colors.Normalize, optional) – Default is linear between minimum and maximum of link_attribute.

  • network_linewidth (float, optional) – Width of network lines.

  • parcel_color (str, optional) – Constant color used for parcel markers.

  • parcel_color_attribute (str, optional) – Parcel attribute name, categorical options not supported. Must be continuous.

  • parcel_color_attribute_title (str, optional) – String to use as the legend title. If parcel_color_attribute is a string, it is used as the default.

  • parcel_color_cmap (str, optional) – Name of colormap for variable parcel color.

  • parcel_color_norm (matplotlib.colors.Normalize, optional) – Default is linear between minimum and maximum of parcel_color_attribute.

  • parcel_size (float, optional) – Marker size in points.

  • parcel_size_attribute (str, optional) – Parcel attribute name, categorical options not supported. Must be continuous.

  • parcel_size_attribute_title (str, optional) – String to use as the title, if parcel_size_attribute is a string, it is used as the default.

  • parcel_size_norm (matplotlib.colors.Normalize, optional) – Default is linear between minimum and maximum of parcel_size_attribute.

  • parcel_size_min (float, optional) – Specify the smallest size of the dot markers plotted, in units of points (default 5). Use with parcel_size_max. They will be aligned with the limits of parcel_size_norm.

  • parcel_size_max (float, optional) – Specify the largest size of the dot markers plotted, in units of points (default 40). Use with parcel_size_min. They will be aligned with the limits of parcel_size_norm.

  • parcel_alpha (float, optional) – Specify parcel marker transparency between 0.0 and 1.0.

  • fig (matplotlib.figure.Figure, optional) – Default is to create a new figure object.

  • output (bool, str, optional) – If not provided (or False), the image is sent to the imaging buffer to await an explicit call to show or savefig from outside this function. If a string, output should be the path to a file (with file extension) to save the figure to. The function will then call savefig itself. If True, the function will call show itself once plotting is complete.

  • **kwargs – Anything else to pass to figure creation.