pygrt.plot
- file:
plot.py
- author:
Zhu Dengda (zhudengda@mail.iggcas.ac.cn)
- date:
2024-07-24
计算结果与断层几何的辅助绘图及配色
- pygrt.plot.plot_statsdata(statsdata: ndarray, dist: float, srctype: str, ptype: str, RorI: bool | int = True, fig: Figure | None = None, axs: Axes | None = None)[源代码]
Based on the data read by the
read_statsfilefunction, plot the kernel function \(F(k,\omega)\), the integrand \(F(k,\omega)J_m(kr)k\), and calculate the cumulative integral \(\sum F(k,\omega)J_m(kr)k\) .备注
Not every source type corresponds to every order and every integration type, see 格林函数分类 for details.
- 参数:
statsdata – return value of
read_statsfilefunctiondist – epicentral distance (km)
srctype – abbreviation of source type, including EX, VF, HF, DD, DS, SS
ptype – integration type (0,1,2,3)
RorI – whether to plot real or imaginary part, default is real part, pass 2 to plot both
fig – user-defined matplotlib.Figure object, default is None
axs – user-defined matplotlib.Axes object array (three elements), default is None
- 返回:
fig - matplotlib.Figure object
(ax1,ax2,ax3) - matplotlib.Axes object array
- pygrt.plot.plot_statsdata_ptam(statsdata1: ndarray, statsdata2: ndarray, statsdata_ptam: ndarray, dist: float, srctype: str, ptype: str, RorI: bool | int = True, fig: Figure | None = None, axs: Axes | None = None)[源代码]
Based on data read by the
read_statsfile_ptamfunction, simply calculate and plot the cumulative integral as well as the peak/trough positions used by PTAM.备注
Not every source type corresponds to every order and every integration type, see 格林函数分类 for details.
- 参数:
statsdata1 – integral process data during DWM or FIM
statsdata2 – integral process data during PTAM
statsdata_ptam – peak/trough positions and amplitudes from PTAM
dist – epicentral distance (km)
srctype – abbreviation of source type, including EX, VF, HF, DD, DS, SS
ptype – integration type (0, 1, 2, 3)
RorI – whether to plot real or imaginary part, default is real part, pass 2 to plot both
fig – user-defined matplotlib.Figure object, default is None
axs – user-defined matplotlib.Axes object array (three elements), default is None
- 返回:
fig - matplotlib.Figure object
(ax1, ax2, ax3) - matplotlib.Axes object array
- pygrt.plot.plot_dispersion(data: dict, *, varname: str | None = None, title: str | None = None, ax: Axes | None = None, outpath: str | PathLike | None = None)[源代码]
Plot phase- or group-velocity dispersion curves.
- 参数:
data – Dictionary from
read_dispersion, or a mapping from panel title to such dictionaries (drawn side by side).varname – Variable to plot,
cfor phase velocity orufor group velocity. Default isuwhen present, otherwisec.title – Panel title when
datais a single dictionary.ax – Existing matplotlib Axes. Only valid for a single dataset.
outpath – If given, save the figure to this path.
- 返回:
fig - matplotlib.Figure object
axs - tuple of matplotlib.Axes
- pygrt.plot.plot_eigenfunction(data: dict, *, scale: float = 2.0, ifreq: int = 0, title: str | None = None, ax: Axes | None = None, outpath: str | PathLike | None = None)[源代码]
Plot eigenfunctions of different modes at one frequency.
Rayleigh-wave panels show the vertical component as a solid line and the radial component as a dashed line. Love-wave panels show the transverse component. Each mode is offset horizontally by its mode number.
- 参数:
data – Dictionary from
read_eigenfunction, or a mapping from panel title to such dictionaries (drawn side by side).scale – Amplitude scale of the plotted eigenfunctions.
ifreq – Index among frequencies that have at least one mode. Default is the first frequency.
title – Panel title when
datais a single dictionary.ax – Existing matplotlib Axes. Only valid for a single dataset.
outpath – If given, save the figure to this path.
- 返回:
fig - matplotlib.Figure object
axs - tuple of matplotlib.Axes
- pygrt.plot.plot_sensitivity(data: dict, *, modes: int | Sequence[int] | None = 0, title: str | None = None, outpath: str | PathLike | None = None)[源代码]
Plot dimensionless phase- or group-velocity sensitivity kernels.
Three panels correspond to \(\alpha\), \(\beta\) and \(\rho\). By default only the fundamental mode (
modes=0) is drawn; passNoneto draw all modes.- 参数:
data – Dictionary from
read_sensitivity.modes – Mode number, a sequence of mode numbers, or
Nonefor all modes. Default is the fundamental mode.title – Figure suptitle.
outpath – If given, save the figure to this path.
- 返回:
fig - matplotlib.Figure object
axs - tuple of matplotlib.Axes
- pygrt.plot.plot_secfunc(data: dict, *, title: str | None = None, ax: Axes | None = None, outpath: str | PathLike | None = None)[源代码]
Plot the real and imaginary parts of secular functions.
- 参数:
data – One dictionary from the list returned by
read_secfunc(index the list before passing), or a mapping from panel title to such dictionaries (drawn side by side).title – Panel title when
datais a single dictionary.ax – Existing matplotlib Axes. Only valid for a single dataset.
outpath – If given, save the figure to this path.
- 返回:
fig - matplotlib.Figure object
axs - tuple of matplotlib.Axes
- pygrt.plot.plot_sCoulomb_faults_geometry(input_path: str | PathLike, *, outpath: str | PathLike | None = None)[源代码]
Plot horizontal projection and 3D geometry of sCoulomb-format faults.
Coordinates follow sCoulomb conventions: X east, Y north and depth downward, in km. Fault records are read using
read_sCoulomb_faults(); row-end text is ignored when plotting.- 参数:
input_path – sCoulomb-format fault file with two header lines
outpath – If given, save the figure to this path
- 返回:
Figure and a tuple of horizontal and 3D Axes
- pygrt.plot.get_anatolia_cmap()[源代码]
Return the Coulomb Anatolia colormap, from blue through white to red.
Colors follow the Coulomb_anatolia.cpt palette used in the gallery. The midpoint is white, suitable for symmetric ranges around zero.
- 返回:
A Matplotlib LinearSegmentedColormap
- pygrt.plot.plot_static_displacement(data: dict, *, src_fault: str | PathLike | None = None, title: str | None = None, clim_ratio: float = 0.5, outpath: str | PathLike | None = None)[源代码]
Quickly inspect static ZNE displacement on a horizontal grid or at arbitrary points.
Color shows vertical displacement and arrows show horizontal displacement. This is a quick auxiliary plot using the Anatolia colormap. Color limits are ±clim_ratio times the maximum absolute vertical displacement. Values outside this symmetric range saturate at the endpoint colors. For nonzero horizontal displacement, a reference arrow above the axes uses Matplotlib’s automatic quiver scale, with a length of 1 cm or a multiple of 10 cm.
- 参数:
data – Variable dictionary from
read_nc_variables(), with ZNE componentssrc_fault – Optional sCoulomb fault file whose top edges are drawn in black
title – Optional plot title
clim_ratio – Color-range fraction of the maximum absolute vertical displacement, in (0, 1]
outpath – If given, save the figure to this path
- 返回:
Figure and Axes
- pygrt.plot.plot_static_coulomb(data: dict, *, src_fault: str | PathLike | None = None, clim_ratio: float = 0.5, outpath: str | PathLike | None = None)[源代码]
Quickly inspect shear, normal and Coulomb stress changes on a horizontal grid, in MPa.
This is a quick auxiliary plot using a shared Anatolia color scale. Color limits are ±clim_ratio times the maximum absolute stress across all three components. Values outside this symmetric range saturate at the endpoint colors.
- 参数:
data – Variable dictionary from
read_nc_variables()after static Coulomb calculationsrc_fault – Optional sCoulomb fault file whose top edges are drawn in black
clim_ratio – Shared color-range fraction of the maximum absolute stress, in (0, 1]
outpath – If given, save the figure to this path
- 返回:
Figure and a tuple of three Axes