plot.plot

plot(grid, fig=None, basemap=False, show=True, dtype=None, nan_transparent=False, cmap="magma", region=None, contours=False, projection="M15c", title="", savefile=None,)

Uses pygmt to plot grid objects.

Arguments:

  • grid (xarray.DataArray or str): grid object to plot in 2D

  • figure (pygmt.Figure, optional): figure object to add features to

  • basemap (bool, optional): adds basemap to figure

  • show (bool, optional): runs Figure.show() if True

  • dtype (str, optional): adds labels to figrure

  • nan_transparent (bool, optional): determines whether nan values in grid are plotted

  • cmap (str, optional): specify the Matplotlib colormap to use

  • region (list, optional): specifies the region to use for plotting

  • contours (bool, optional): adds contour lines to the plot

  • projection (str, optional): map projection to use

  • title (str, optional): title for the figure

  • savefile (str, optional): file to save figure to

Returns:

None

Example

import plot
# load in the synthetic test model as a slab_model instance
model = plot.slab_model("../output/exp_slab2_04-18","surface") # synthetic test slab made with the 04-18 database
# making a plot of the model depth
plot.plot(
    model.dep_grid, # specifies which grid object to plot
    contours=True, # add contour lines to the plot
    basemap=True, # add basemap to the plot
    nan_transparent=True, # removing nan values to make basemap visible
    title="exp slab model with 04-18 database", # adding a title to the plot
    dtype="depth", # specifying the datatype for labeling the colorbar
    savefile="output/exp_slab2_04-18_depth.jpg", # saving the figure to a jpeg file
    region=model.region, # specifying the region boundaries to use
    show=True # display the figure
)
../_images/exp_slab2_04-18_depth.jpg

Output of example shown above