zabgrab.services.plotting¶
What to plot: numeric series grouped by units, split where nothing was fetched.
This module decides the content of a plot; zabgrab.ui.plot draws it with
matplotlib. Keeping the two apart means the rules (which items can be plotted, where
lines break) are tested without matplotlib.
Functions
|
Work out what to plot. |
Classes
|
A vertical axis, shared by the series with the same units. |
|
One series on an axis. |
|
Everything to draw. |
|
A run of points drawn as one connected line. |
- class zabgrab.services.plotting.Segment(times, values, low=None, high=None)[source]¶
Bases:
objectA run of points drawn as one connected line.
- Parameters:
- class zabgrab.services.plotting.Line(label, segments=<factory>)[source]¶
Bases:
objectOne series on an axis.
- class zabgrab.services.plotting.Axis(units, lines=<factory>)[source]¶
Bases:
objectA vertical axis, shared by the series with the same units.
- class zabgrab.services.plotting.PlotSpec(axes, title='', log_y=False)[source]¶
Bases:
objectEverything to draw.
- zabgrab.services.plotting.plot_spec(series, coverage, ui, *, title='', log_y=False)[source]¶
Work out what to plot.
- Parameters:
series (sequence of Series) – The data, e.g. a merged dataset’s series.
coverage (sequence of (float, float)) – The time ranges that were fetched, sorted and not overlapping (POSIX seconds). Lines break between ranges, so gaps nobody fetched aren’t drawn as if the data were continuous, while sparse data inside a fetched range is still joined up.
ui (UI) – Warns about text items that are left out.
title (str, optional) – The figure title.
log_y (bool, optional) – Use log scales for the vertical axes. Lines with values of zero or less, which can’t be shown on them, are warned about.
- Returns:
PlotSpec – One axis per unit, each with a line per numeric series.
- Raises:
ZabgrabError – If there’s nothing numeric to plot (no series, or only text items).
- Return type: