Plotting utilities and functions¶
The package uses a few utility classes and functions to make consistent plotting easy thoughout the package. This reference page documents the lowerlevel utilities used to make this happen.
Note
The builtin routines to plot Section
and Plan
objects are not documented here, look for documentation on those highlevel methods in their respective module documentation.
The functions are defined in deltametrics.plot
.
Default styling¶
By default, each variable receives a set of styling definitions. The default parameters of each styling variable are defined below:
Plotting utility objects¶

Variable styling and information. 

A default set of properties for variables. 
Plotting utility functions¶

deltametrics.plot.
append_colorbar
(ci, ax)¶ Append a colorbar, consistently placed.
Adjusts some parameters of the parent axes as well.
 Parameters
ci (matplotlib.pyplot.pcolormesh, matplotlib.pyplot.ImageAxes) – The colored object generated via matplotlib that the colormap should be stolen from.
ax (matplotlib.Axes) – The instance of axes to place the colorbar next to.
adjust (
bool
) – Whether to adjust some minor attributes of the parent axis, for presentation.
 Returns
cb – The colorbar instance created.
 Return type
matplotlib.colorbar instance.

deltametrics.plot.
get_display_arrays
(VarInst, data=None)¶ Get arrays for display of Variables.
Function takes as argument a VariableInstance from a Section or Planform and an optional
data
argument, which specifies the data type to return, and gives back arrays of 1) data, 2) display xcoordinates and 3) display ycoordinates. Parameters
VarInst (
BaseSectionVariable
subclass) – The Variable instance to visualize. May be any subclass ofBaseSectionVariable
orBasePlanformVariable
.data (
str
, optional) – The type of data to visualize. Supported options are ‘spacetime’, ‘preserved’, and ‘stratigraphy’. Default is to display full spacetime plot for variable generated from a DataCube, and stratigraphy for a StratigraphyCube variable. Note that variables sourced from a StratigraphyCube do not support the spacetime or preserved options, and a variable from DataCube will only support stratigraphy if the Cube has computed “quick” stratigraphy.
 Returns
data, X, Y – Three matchingsize ndarray representing the 1) data, 2) display xcoordinates and 3) display ycoordinates.
 Return type
ndarray

deltametrics.plot.
get_display_lines
(VarInst, data=None)¶ Get lines for display of Variables.
Function takes as argument a VariableInstance from a Section or Planform and an optional
data
argument, which specifies the data type to return, and gives back data and line segments for display. Parameters
VarInst (
BaseSectionVariable
subclass) – The Variable instance to visualize. May be any subclass ofBaseSectionVariable
orBasePlanformVariable
.data (
str
, optional) – The type of data to visualize. Supported options are ‘spacetime’, ‘preserved’, and ‘stratigraphy’. Default is to display full spacetime plot for variable generated from a DataCube. and stratigraphy for a StratigraphyCube variable. Variables from DataCube will only support stratigraphy if the Cube has computed “quick” stratigraphy.note:: (.) – Not currently implemented for variables from the StratigraphyCube.
 Returns
vals, segments – An offbyone sized array of data values (vals) to color the line segments (segments). The segments are organized along the 0th dimension of the array.
 Return type
ndarray

deltametrics.plot.
get_display_limits
(VarInst, data=None)¶ Get limits to resize the display of Variables.
Function takes as argument a VariableInstance from a Section or Planform and an optional
data
argument, which specifies how to determine the limits to return. Parameters
VarInst (
BaseSectionVariable
subclass) – The Variable instance to visualize. May be any subclass ofBaseSectionVariable
orBasePlanformVariable
.data (
str
, optional) – The type of data to compute limits for. Typically this will be the same value used with eitherget_display_arrays
orget_display_lines
. Supported options are ‘spacetime’, ‘preserved’, and ‘stratigraphy’.
 Returns
xmin, xmax, ymin, ymax – Values to use as limits on a plot. Use with, for example,
ax.set_xlim((xmin, xmax))
. Return type
float

deltametrics.plot.
_fill_steps
(where, x=1, y=1, y0=0, **kwargs)¶ Fill rectangles where the boolean indicates
True
.Creates an
x
byy
matplotlib.patches.Rectangle
at each index where the index i in booleanwhere
indicates, with the lower left of the patch at (i,y0
).This utility function is utilized internally. Most often, it is used to highlight where time has been preserved (or eliminated) in a timeseries of data. For example, see
show_one_dimensional_trajectory_to_strata
. Parameters
where (
ndarray
) – Boolean numpy ndarray indicating which locations to create a patch at.x (
float
) – The xdirection width of the Rectangles.y (
float
) – The ydirection height of the Rectangles.y0 (
float
) – The ydirection origin (i.e., lowerleft yvalue) of the Rectangles.**kwargs – Additional matplotlib keyword arguments passed to the Rectangle instantiation. This is where you can set most matplotlib **kwargs (e.g., color, edgecolor).
 Returns
pc – Collection of Rectangle Patch objects.
 Return type
matplotlib.patches.PatchCollection
DeltaMetrics plot routines¶
1d elevation to stratigraphy. 
DeltaMetrics colormaps¶

deltametrics.plot.
cartographic_colormap
()¶ Colormap for an elevation map style.
Warning
Not implemented.
Note
This should implement something that looks like this, and should be configured to always setting the break to whatever sealevel is (or zero?).

deltametrics.plot.
aerial_colormap
()¶ Colormap for a pesudorealistic looking aerial shot.
Warning
Not implemented.