Plot

安定性: 安定

継承元: gwpy.plot.Plot

主な用途

Plot は GWexpy における可視化の入口です。単一 series だけでなく、 SeriesMatrixSpectrogramMatrix のような多チャンネル入力も扱えます。 GWpy 互換の Figure 操作を保ちながら、行列入力の自動展開、サブプロット配置、 高密度オーバーレイの間引き、spectrogram 系の colorbar 配置を補助します。

代表的なシグネチャ

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)

最小例

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 固有の挙動

  • SeriesMatrixSpectrogramMatrix を自動的にサブプロットへ展開します。

  • list / dict 入力のラベルを legend と軸へ引き継ぎます。

  • spectrogram 系入力では colorbar の配置を自動化できます。

  • decimate_threshold を超える高密度オーバーレイは自動で間引きされます。

関連理論

関連チュートリアル

API リファレンス

継承メソッドを含む完全な API は以下の生成済みリファレンスを参照してください。

class gwexpy.plot.Plot(*args, **kwargs)[source]

Bases: Plot

GWexpy-aware plotting facade for series, matrices, and spectrogram grids.

Plot keeps the familiar gwpy.plot.Plot constructor 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_mmm

Convenience helper for median/min/max overlays.

gwexpy.types.SeriesMatrix

Matrix 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.plot for the median line. Additional keys supported:

    • alpha_fill: opacity for the filled envelope

    • label_fill: label for the filled envelope

Returns:

The list of Line2D objects returned by ax.plot.

Return type:

list

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=True prevents 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. Use block=False if 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: color facecolor: color figheight: 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