SegmentAxes#

class gwpy.plot.SegmentAxes(
*args,
xscale: str = 'auto-gps',
insetlabels: bool = False,
**kwargs,
)[source]#

Bases: Axes

Custom Axes to display segments.

This SegmentAxes provides custom methods for displaying any of

Parameters:
insetlabelsbool, default: False

display segment labels inside the axes. Prevents very long segment names from getting squeezed off the end of a standard figure

See also

gwpy.plot.Axes

for documentation of other args and kwargs

Attributes Summary

insetlabels

Return the inset labels state.

name

Methods Summary

draw(renderer)

Draw the Artist (and its children) using the given renderer.

get_collections([ignore])

Return the collections matching the given _ignore value.

get_insetlabels()

Return the inset labels state.

get_next_y()

Find the next y-axis value at which a segment list can be placed.

plot(*args, **kwargs)

Plot data onto these axes.

plot_dict(flags[, label, known])

Plot a DataQualityDict onto these axes.

plot_flag(flag[, y])

Plot a DataQualityFlag onto these axes.

plot_segmentlist(segmentlist[, y, height, ...])

Plot a SegmentList onto these axes.

plot_segmentlistdict(segmentlistdict[, y, dy])

Plot a SegmentListDict onto these axes.

set(*[, adjustable, agg_filter, alpha, ...])

Set multiple properties at once.

set_insetlabels([inset])

Set the labels to be inset or not.

Attributes Documentation

insetlabels[source]#

Return the inset labels state.

name = 'segments'#

Methods Documentation

draw(renderer)#

Draw the Artist (and its children) using the given renderer.

This has no effect if the artist is not visible (Artist.get_visible returns False).

Parameters:
rendererRendererBase subclass.

Notes

This method is overridden in the Artist subclasses.

get_collections(ignore: bool | None = None) list[Collection][source]#

Return the collections matching the given _ignore value.

Parameters:
ignorebool, or None

Value of _ignore to match.

Returns:
collectionslist of Collection

If ignore=None, simply returns all collections, otherwise returns those collections matching the ignore parameter.

get_insetlabels() bool[source]#

Return the inset labels state.

get_next_y() int[source]#

Find the next y-axis value at which a segment list can be placed.

This method simply counts the number of independent segmentlists or flags that have been plotted onto these axes.

plot(
*args: DataQualityFlag | DataQualityDict | segmentlist | segmentlistdict,
**kwargs,
) list[Artist][source]#

Plot data onto these axes.

Parameters:
args

A single instance of

or equivalent types upstream from igwn_segments.

kwargs

All keyword arguments are passed to plot when drawing each object.

Returns:
artistslist of Artist

The list of things that were rendered.

See also

matplotlib.axes.Axes.plot

for a full description of acceptable *args` and ``**kwargs.

plot_dict(
flags: DataQualityDict,
label: str = 'key',
known: str | dict | None = 'x',
**kwargs,
) list[PatchCollection][source]#

Plot a DataQualityDict onto these axes.

Parameters:
flagsDataQualityDict

The data-quality dict to display.

labelstr, optional

Labelling system to use, or fixed label for all DataQualityFlags. Special values include

'key'

Use the key of the DataQualityDict.

'name'

Use the name of the DataQualityFlag.

If anything else, that fixed label will be used for all lines.

knownstr, dict, None, optional

Display known segments with the given hatching, or give a dict of keyword arguments to pass to plot_segmentlist(), or None to hide.

kwargs

All other keyword arguments are passed to SegmentRectangle.

Returns:
artistslist of PatchCollection

The list of patch collections that were drawn.

plot_flag(
flag: DataQualityFlag,
y: float | None = None,
**kwargs,
) PatchCollection | list[SegmentRectangle][source]#

Plot a DataQualityFlag onto these axes.

Parameters:
flagDataQualityFlag

Data-quality flag to display.

yfloat, optional

Y-axis value for new segments.

heightfloat, optional,

Height for each segment, default: 0.8.

knownstr, dict, None

One of the following

  • 'fancy' - to use fancy format (try it and see)

  • 'x' (or similar) - to use hatching

  • str to specify facecolor for known segmentlist

  • dict of kwargs to use

  • None to ignore known segmentlist

kwargs

All other keyword arguments are passed to SegmentRectangle.

Returns:
artistslist of PatchCollection

The list of patch collections that were drawn.

plot_segmentlist(
segmentlist: segmentlist,
y: float | None = None,
height: float = 0.8,
label: str | None = None,
*,
collection: bool = True,
rasterized: bool | None = None,
**kwargs,
) PatchCollection | list[SegmentRectangle][source]#

Plot a SegmentList onto these axes.

Parameters:
segmentlistSegmentList

List of segments to display.

yfloat, optional

Y-axis value for new segments.

heightfloat, optional

Height (in y-axis units) for segment.

collectionbool, optional

If True (default), bundle all patches as a PatchCollection, otherwise just return a list of SegmentRectangle patches.

rasterizedbool, optional

If True, rasterise the patches when drawing. Default is False.

labelstr, optional

custom descriptive name to print as y-axis tick label

kwargs

All other keyword arguments are passed to SegmentRectangle.

Returns:
patchesPatchCollection or list[SegmentRectangle]

The drawn patches, bundled in a PatchCollection if collection=True.

plot_segmentlistdict(
segmentlistdict: segmentlistdict,
y: float | None = None,
dy: float = 1,
**kwargs,
) PatchCollection | list[SegmentRectangle][source]#

Plot a SegmentListDict onto these axes.

Parameters:
segmentlistdictSegmentListDict

(name, SegmentList) dict.

yfloat, optional

Starting y-axis value for new segmentlists.

dyfloat, optional

Y-axis separation between each (anchor of each) segmentlist.

kwargs

All other keyword arguments are passed to Rectangle.

Returns:
collectionslist of PatchCollection

List of PatchCollection sets for each segmentlist.

set(
*,
adjustable=<UNSET>,
agg_filter=<UNSET>,
alpha=<UNSET>,
anchor=<UNSET>,
animated=<UNSET>,
aspect=<UNSET>,
autoscale_on=<UNSET>,
autoscalex_on=<UNSET>,
autoscaley_on=<UNSET>,
axes_locator=<UNSET>,
axisbelow=<UNSET>,
box_aspect=<UNSET>,
clip_box=<UNSET>,
clip_on=<UNSET>,
clip_path=<UNSET>,
epoch=<UNSET>,
facecolor=<UNSET>,
forward_navigation_events=<UNSET>,
frame_on=<UNSET>,
gid=<UNSET>,
in_layout=<UNSET>,
insetlabels=<UNSET>,
label=<UNSET>,
mouseover=<UNSET>,
navigate=<UNSET>,
path_effects=<UNSET>,
picker=<UNSET>,
position=<UNSET>,
prop_cycle=<UNSET>,
rasterization_zorder=<UNSET>,
rasterized=<UNSET>,
sketch_params=<UNSET>,
snap=<UNSET>,
subplotspec=<UNSET>,
title=<UNSET>,
transform=<UNSET>,
url=<UNSET>,
visible=<UNSET>,
xbound=<UNSET>,
xlabel=<UNSET>,
xlim=<UNSET>,
xmargin=<UNSET>,
xscale=<UNSET>,
xticklabels=<UNSET>,
xticks=<UNSET>,
ybound=<UNSET>,
ylabel=<UNSET>,
ylim=<UNSET>,
ymargin=<UNSET>,
yscale=<UNSET>,
yticklabels=<UNSET>,
yticks=<UNSET>,
zorder=<UNSET>,
)#

Set multiple properties at once.

Supported properties are

Properties:

adjustable: {‘box’, ‘datalim’} 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 anchor: (float, float) or {‘C’, ‘SW’, ‘S’, ‘SE’, ‘E’, ‘NE’, …} animated: bool aspect: {‘auto’, ‘equal’} or float autoscale_on: bool autoscalex_on: unknown autoscaley_on: unknown axes_locator: Callable[[Axes, Renderer], Bbox] axisbelow: bool or ‘line’ box_aspect: float or None clip_box: BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None epoch: float, str facecolor or fc: color figure: Figure or SubFigure forward_navigation_events: bool or “auto” frame_on: bool gid: str in_layout: bool insetlabels: bool, None label: object mouseover: bool navigate: bool navigate_mode: unknown path_effects: list of AbstractPathEffect picker: None or bool or float or callable position: [left, bottom, width, height] or Bbox prop_cycle: Cycler rasterization_zorder: float or None rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None subplotspec: unknown title: str transform: Transform url: str visible: bool xbound: (lower: float, upper: float) xlabel: str xlim: (left: float, right: float) xmargin: float greater than -0.5 xscale: unknown xticklabels: unknown xticks: unknown ybound: (lower: float, upper: float) ylabel: str ylim: (bottom: float, top: float) ymargin: float greater than -0.5 yscale: unknown yticklabels: unknown yticks: unknown zorder: float

set_insetlabels(inset: bool | None = None) None[source]#

Set the labels to be inset or not.

Parameters:
insetbool, None

Enable (True) or disable (False) inset labels. Default (None) toggles the current state.