plot

function of dascore.viz.annotations source

plot(
    annotations: AnnotationSet ,
    ax: matplotlib.axes._axes.Axes | None[Axes, None] = None,
    x: str | None[str, None] = None,
    y: str | None[str, None] = None,
    color: str | collections.abc.Sequence[str, collections.abc.Sequence[float], None] = None,
    label: str | None[str, None] = None,
    palette: collections.abc.Mapping | None[Mapping, None] = None,
    **style ,
)-> ‘plt.Axes’

Draw every feature of the set on an axis, e.g. over a waterfall.

Parameters

Parameter Description
annotations The set to draw.
ax The axis to draw on; one is made if None.
x, y Dimensions for the axes; default dims[-1] and dims[0], as
waterfall puts them. A one-dimensional set draws along x, or
along y when only y is named.
A set of more dimensions names both.
color A matplotlib color, or a column of either table whose values are
colored from palette first, then the property cycle, with a
legend. A row blank on both tables is black; a feature blank on both
reads its first member. By default everything is black.
label A column whose values label the artists in a legend; a blank value
is left out of it. Without it or a color column, a legend names the
kinds drawn (picks, regions, paths, polygons) when there are two or
more.
palette Colors for values of the color column, e.g. {"P": "tab:red"};
values not in it take cycle colors it does not already use.
**style Passed to every artist, e.g. alpha or linewidth, overriding
the defaults; marker keys and path_effects reach only lines and
markers.
Note

A row is a marker where it states a value on both axes, a line or span where it states one axis, a segment where it states a value and a range, and a box for two ranges; a row stating neither axis is not drawn. A group draws its members, a path a line per part, and a polygon a filled patch per part with its holes left empty. A path or polygon not drawn in both axes is skipped. Lines and markers have a white halo, and filled artists a solid edge, to stand out over a waterfall.

Examples

import pandas as pd
import dascore as dc
patch = dc.get_example_patch()
time = patch.get_coord("time").min()
picks = pd.DataFrame({"time": [time, time], "phase": ["P", "S"]})
picks["distance"] = [100.0, 200.0]
ann = dc.AnnotationSet.from_patch(patch, picks)
ax = patch.viz.waterfall()
ax = ann.viz.plot(ax=ax, color="phase")
ax = ann.viz.plot(color="phase", palette={"P": "tab:red", "S": "tab:cyan"})