.. _sec-plot_contours: plot.plot_contours ================== ``plot_contours(grid, fig=None, projection="M15c", dtype=None)`` Plots contours of a given grid object. Arguments: ---------- - **grid** (*xarray.DataArray*): grid object to plot contours of - **fig** (*pygmt.Figure, optional*): figure object to add contours to. Defaults to None. - **projection** (*str, optional*): pygmt projection. Defaults to 'M15c'. - **dtype** (*str, optional*): data type for contours. Defaults to None. Returns: -------- *None* Example ------- .. code-block:: python import plot import pygmt # 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 # initialize figure as pygmt.Figure fig = pygmt.Figure() # making a plot of the model depth plot.plot( model.dep_grid, # specifies which grid object to plot fig=fig, # add this plot to the existing figure 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 region=model.region, # specifying the region boundaries to use show=False, # do not display the figure ) # overlaying the model uncertainty using contours plot.plot_contours( model.unc_grid, # specify the uncertainty grid fig=fig, # add this plot to the existing figure dtype="Depth Uncertainty (km)" # specify the data type for labeling the colorbar ) # save the figure to jpeg file fig.savefig("output/exp_slab2_04-18_depth_with_unc.jpg") # display the figure fig.show() .. _plot_example_figure: .. figure:: figures/exp_slab2_04-18_depth.jpg Output of example shown above