mtuq.graphics.attrs.PyGMTUtilities.calculate_plotting_region

static PyGMTUtilities.calculate_plotting_region(stations, origin, buffer_percentage=0.1)[source]

Calculates the region for plotting, including a buffer area around specified stations and origin.

Parameters

stations (list of mtuq.Station objects): The stations to be included in the plot.

origin (mtuq.Origin object): The origin object is used to calculate the region for the plot in case the origin is outside the range of the stations.

buffer_percentage (float, optional): The percentage of the total longitude and latitude range to be added as a buffer around the specified region. Defaults to 0.1 (10%).

Returns

region (list of float), lat_buffer (float): A tuple containing the calculated region as a list [west, east, south, north] and the latitude buffer value. The latitude buffer is returned to later be used for adjusting text spacing in the plot header.

Example

>>> region, lat_buffer = PyGMTUtilities.calculate_plotting_region(stations, origin)
>>> print(region)
[149.55, 151.45, -35.1, -32.9]
>>> print(lat_buffer)
0.22