Plot
Stability: Stable
Inherits from: gwpy.plot.Plot
What it is
Plot is the GWexpy plotting entry point for single series, matrices, and
spectrogram grids. It keeps GWpy-compatible figure behavior while adding
automatic expansion of SeriesMatrix-like inputs, layout helpers for grouped
subplots, adaptive decimation for dense overlays, and colorbar handling for
spectrogram-style data.
Representative Signatures
Plot(*args, separate=None, geometry=None, monitor=None, decimate_threshold=50000, decimate_points=10000, **kwargs)
plot_mmm(median, min_s, max_s, ax=None, **kwargs)
Minimal Example
from gwexpy.plot import Plot
fig = Plot(ts_matrix, separate=True, figsize=(10, 6))
_ = fig.plot_mmm(median_series, min_series, max_series, alpha_fill=0.15)
GWexpy-specific Behavior
SeriesMatrixandSpectrogramMatrixinputs are expanded into subplot grids automatically.List and dict inputs inherit labels so legend names stay aligned with channel metadata.
Spectrogram-like inputs can receive shared colorbar placement without manual
matplotlibwiring.Large overlays are decimated automatically when
decimate_thresholdis exceeded.
API Reference
See the generated API reference below for inherited plotting methods and the GWexpy constructor signature.
- class gwexpy.plot.Plot(*args, **kwargs)[source]
Bases:
PlotGWexpy-aware plotting facade for series, matrices, and spectrogram grids.
Plot keeps the familiar
gwpy.plot.Plotconstructor while adding conveniences needed by GWexpy collections:SeriesMatrix and SpectrogramMatrix inputs are expanded into per-axis subplots automatically.
Layout hints such as separate, geometry, and shared-axis labeling are inferred from the input shape.
Spectrogram plots can receive automatic colorbar management and adaptive decimation for large overlays.
- Parameters:
*args – Series-like objects, matrices, lists, or dictionaries accepted by the GWexpy plotting registry.
**kwargs – Standard gwpy.plot.Plot keyword arguments plus GWexpy-specific layout helpers such as separate, geometry, monitor, decimate_threshold, and decimate_points.
Examples
Plot a matrix as aligned subplots:
>>> from gwexpy.plot import Plot >>> fig = Plot(ts_matrix, separate=True, figsize=(10, 6)) >>> len(fig.axes) >= 1 True
Overlay summary curves with a shaded min/max envelope:
>>> fig = Plot(median_series) >>> _ = fig.plot_mmm(median_series, min_series, max_series, alpha_fill=0.15)
See also
plot_mmmConvenience helper for median/min/max overlays.
gwexpy.types.SeriesMatrixMatrix container expanded automatically by this plot class.
- plot_mmm(median, min_s, max_s, ax=None, **kwargs)[source]
Plot median line with a min/max envelope.
This is a convenience wrapper around
gwexpy.plot.plot_mmm().- Parameters:
median (gwpy.types.Series) – Median series to plot as a line.
min_s (gwpy.types.Series) – Minimum series defining the lower envelope.
max_s (gwpy.types.Series) – Maximum series defining the upper envelope.
ax (matplotlib.axes.Axes, optional) – Target axes. If omitted, uses the current axes of this Plot.
**kwargs –
Passed to
ax.plotfor the median line. Additional keys supported:alpha_fill: opacity for the filled envelopelabel_fill: label for the filled envelope
- Returns:
The list of Line2D objects returned by
ax.plot.- Return type:
- show(warn: bool = True, close: bool = True, block: bool | None = None) None[source]
Show the figure.
- Parameters:
warn (bool, optional) – Unused, kept for API compatibility. Default is True.
close (bool, optional) – If True (default), close the figure after showing to free resources and prevent double display in Jupyter. Set to False if you need to call savefig() after show().
block (bool or None, optional) – Whether to block execution until the figure window is closed. If None (default), uses matplotlib’s default behavior. Set to False to continue execution immediately after showing, which allows savefig() to work in scripted workflows.
Examples
>>> plot = Plot(data) >>> plot.show(close=False, block=False) # Non-blocking, keep figure >>> plot.savefig("output.png") # Works because figure is still open
Notes
In Jupyter notebooks, setting
close=Trueprevents the figure from being displayed twice (once by show() and once by the notebook’s automatic display).In script mode,
plt.show()blocks by default until the window is closed. Useblock=Falseif you need to save after showing.
- set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, canvas=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, constrained_layout=<UNSET>, constrained_layout_pads=<UNSET>, dpi=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, figheight=<UNSET>, figwidth=<UNSET>, frameon=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, layout_engine=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, size_inches=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, tight_layout=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)
Set multiple properties at once.
Supported properties are
- Properties:
agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: float or None animated: bool canvas: FigureCanvas clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None constrained_layout: unknown constrained_layout_pads: unknown dpi: float edgecolor:
colorfacecolor:colorfigheight: float figure: unknown figwidth: float frameon: bool gid: str in_layout: bool label: object layout_engine: {‘constrained’, ‘compressed’, ‘tight’, ‘none’, .LayoutEngine, None} linewidth: number mouseover: bool path_effects: list of .AbstractPathEffect picker: None or bool or float or callable rasterized: bool size_inches: (float, float) or float sketch_params: (scale: float, length: float, randomness: float) snap: bool or None tight_layout: unknown transform: ~matplotlib.transforms.Transform url: str visible: bool zorder: float