mtuq.graphics.attrs._pygmt_backend

mtuq.graphics.attrs._pygmt_backend(filename, values, active_stations, origin, colormap='polar', zero_centered=True, display_topo=True, label='', width=5, moment_tensor=None, process=None, stations_list=None, station_labels=True, min_val=None, max_val=None, **kwargs)[source]

PyGMT backend for plotting station attributes over a hillshaded map.

Note

This function requires the PyGMT library to be installed. If called while pygmt is not installed, the default matplotlib backend will be used.

The function accepts a number of optional keyword arguments to customize the appearance of the plot. If passed to another backend, these arguments will be ignored.

Required input arguments

filename (str): The name of the file to which the figure will be saved. This should be passed by the frontend function. Expected filenames are in the format component.png, where component is the component of the data being plotted. This might be revised in the future to allow for more flexible naming conventions.

values (list of float): List of values to be plotted for each station. The length of the list should match the number of stations.

active_stations (list of mtuq.Station objects): List of stations to be plotted, with a value entry for each station in the values list.

origin (mtuq.Origin object): Origin object used to plot the origin location.

Keyword arguments

colormap (str): GMT colormap name - see GMT documentation <https://docs.generic-mapping-tools.org/6.5/reference/cpts.html>

zero_centered (bool): Whether or not the colormap is centered on zero

display_topo (bool): Whether or not to display topography in the background – will download the ETOPO1 topography file if not found

label (str): Optional colorbar text label – supports LaTeX expressions

width (float): Width of the figure in inches – default is 5 inches

moment_tensor (mtuq.event.MomentTensor or np.ndarray): Moment tensor to plot as a beachball – will plot a star at the origin if not provided Can be either a mtuq.event.MomentTensor object or a 1D numpy array with the six independent components [m_rr, m_tt, m_pp, m_rt, m_rp, m_tp]

process (mtuq.ProcessData): ProcessData object used to determine the type of waves used for the window

stations_list (list of mtuq.Station objects): List of all stations available before data processing – will plot only active stations if not provided

station_labels (bool): Whether or not to plot station labels – default is True

min_val (float): Minimum value for the colorbar – will be determined automatically if not provided

max_val (float): Maximum value for the colorbar – will be determined automatically if not provided

Backend specific utility class

The PyGMTUtilities class is a utility class designed to enhance and simplify the usage of PyGMT for plotting. It includes methods for calculating plotting regions with buffers, configuring colormaps, preparing LaTeX annotations for PyGMT, and generating standardized headers for plots. Documentation for the PyGMTUtilities class can be found in the PyGMTUtilities module.