InteractiveTimeSeriesFigure¶
-
class
aas_timeseries.
InteractiveTimeSeriesFigure
(width=600, height=400, padding=36, resize=False, title=None, time_mode=None)[source]¶ Bases:
aas_timeseries.views.BaseView
An interactive time series figure.
- Parameters
- widthint, optional
The preferred width of the figure, in pixels.
- heightint, optional
The preferred height of the figure, in pixels.
- paddingfloat, optional
The padding inside the axes, as a fraction of the size of the axes
- resizebool, optional
Whether to resize the figure to the available space.
- titlestr, optinal
If views are added to the figure, this title is used for the default view, otherwise ‘Default’ is used.
Attributes Summary
The format to use for the x-axis.
The label to use for the x-axis.
The x/time limits of the view.
The label to use for the y-axis.
The y limits of the view.
The unit to use for the y axis, or ‘auto’ to guess.
Methods Summary
add_horizontal_line
(self, value, \*\*kwargs)Add a horizontal line to the figure.
add_horizontal_range
(self, value_lower, …)Add a horizontal range to the figure.
add_line
(self, \*[, time_series, column, …])Add a line to the figure.
add_markers
(self, \*[, time_series, column, …])Add markers, optionally with errorbars, to the figure.
add_range
(self, \*[, time_series, …])Add a time dependent range to the figure.
add_text
(self, \*\*kwargs)Add a text label to the figure.
add_vertical_line
(self, time, \*\*kwargs)Add a vertical line to the figure.
add_vertical_range
(self, time_lower, …)Add a vertical range to the figure.
add_view
(self, title[, description, …])export_interactive_bundle
(self, filename[, …])Create a bundle for the interactive figure containing an HTML file and JSON file along with any required CSV files.
preview_interactive
(self)Show an interactive version of the figure (only works in Jupyter notebook or lab).
remove
(self, layer)Remove a layer from the figure.
save_static
(self, prefix[, format, …])Export the figure to one or more static files using Matplotlib.
save_vega_json
(self, filename[, embed_data, …])Export the JSON file, and optionally CSV data files.
Attributes Documentation
-
layers
¶
-
time_format
¶ The format to use for the x-axis.
-
time_mode
¶
-
xlabel
¶ The label to use for the x-axis. If not specified, this is determined automatically from the type of x-axis.
-
xlim
¶ The x/time limits of the view.
-
ylabel
¶ The label to use for the y-axis.
-
ylim
¶ The y limits of the view.
-
yunit
¶ The unit to use for the y axis, or ‘auto’ to guess. If using data without quantities, this can be set to
u.one
.
Methods Documentation
-
add_horizontal_line
(self, value, **kwargs)¶ Add a horizontal line to the figure.
- Parameters
- valuefloat or int
The y value at which the horizontal line is shown.
- widthfloat or int, optional
The width of the line, in pixels.
- colorstr or tuple, optional
The color of the line.
- opacityfloat or int, optional
The opacity of the line from 0 (transparent) to 1 (opaque).
- labelstr, optional
The label to use to designate the layer in the legend.
- Returns
- layer
HorizontalLine
- layer
-
add_horizontal_range
(self, value_lower, value_upper, **kwargs)¶ Add a horizontal range to the figure.
- Parameters
- value_lowerfloat or int
The value at which the range starts.
- value_upperfloat or int
The value at which the range ends.
- colorstr or tuple, optional
The fill color of the range.
- opacityfloat or int, optional
The opacity of the fill color from 0 (transparent) to 1 (opaque).
- edge_colorstr or tuple, optional
The edge color of the range.
- edge_opacityfloat or int, optional
The opacity of the edge color from 0 (transparent) to 1 (opaque).
- edge_widthfloat or int, optional
The thickness of the edge, in pixels.
- labelstr, optional
The label to use to designate the layer in the legend.
- Returns
- layer
HorizontalRange
- layer
-
add_line
(self, *, time_series=None, column=None, time_column='time', **kwargs)¶ Add a line to the figure.
- Parameters
- data
TimeSeries
The time series object containing the data.
- columnstr
The field in the time series containing the data.
- time_columnstr, optional
The field to use for the time on the x-axis.
- widthfloat or int, optional
The width of the line, in pixels.
- colorstr or tuple, optional
The color of the line.
- opacityfloat or int, optional
The opacity of the line from 0 (transparent) to 1 (opaque).
- labelstr, optional
The label to use to designate the layer in the legend.
- data
- Returns
- layer
Line
- layer
-
add_markers
(self, *, time_series=None, column=None, time_column='time', **kwargs)¶ Add markers, optionally with errorbars, to the figure.
- Parameters
- data
TimeSeries
The time series object containing the data.
- columnstr
The field in the time series containing the data.
- time_columnstr, optional
The field to use for the time on the x-axis.
- errorstr, optional
The field in the time series containing the data uncertainties.
- shape{‘circle’, ‘square’, ‘cross’, ‘diamond’, ‘triangle-up’, ‘triangle-down’, ‘triangle-right’, ‘triangle-left’}, optional
The symbol shape.
- sizefloat or int, optional
The area in pixels of the bounding box of the symbols. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.
- colorstr or tuple, optional
The fill color of the symbols.
- opacityfloat or int, optional
The opacity of the fill color from 0 (transparent) to 1 (opaque).
- edge_colorstr or tuple, optional
The edge color of the symbol.
- edge_opacityfloat or int, optional
The opacity of the edge color from 0 (transparent) to 1 (opaque).
- edge_widthfloat or int, optional
The thickness of the edge, in pixels.
- labelstr, optional
The label to use to designate the layer in the legend.
- data
- Returns
- layer
Markers
- layer
-
add_range
(self, *, time_series=None, column_lower=None, column_upper=None, time_column='time', **kwargs)¶ Add a time dependent range to the figure.
- Parameters
- data
TimeSeries
The time series object containing the data.
- column_lowerstr
The field in the time series containing the lower value of the data range.
- column_upperstr
The field in the time series containing the upper value of the data range.
- time_columnstr, optional
The field to use for the time on the x-axis.
- colorstr or tuple, optional
The fill color of the range.
- opacityfloat or int, optional
The opacity of the fill color from 0 (transparent) to 1 (opaque).
- edge_colorstr or tuple, optional
The edge color of the range.
- edge_opacityfloat or int, optional
The opacity of the edge color from 0 (transparent) to 1 (opaque).
- edge_widthfloat or int, optional
The thickness of the edge, in pixels.
- labelstr, optional
The label to use to designate the layer in the legend.
- data
- Returns
- layer
Range
- layer
-
add_text
(self, **kwargs)¶ Add a text label to the figure.
- Parameters
- time
Time
The date/time at which the text is shown.
- valuefloat or int
The y value at which the text is shown.
- weight{‘normal’, ‘bold’}, optional
The weight of the text.
- baseline{‘alphabetic’, ‘top’, ‘middle’, ‘bottom’}, optional
The vertical text baseline.
- align{‘left’, ‘center’, ‘right’}, optional
The horizontal text alignment.
- anglefloat or int, optional
The rotation angle of the text in degrees (default 0).
- textstr, optional
The text label to show.
- colorstr or tuple, optional
The color of the text.
- opacityfloat or int, optional
The opacity of the text from 0 (transparent) to 1 (opaque).
- labelstr, optional
The label to use to designate the layer in the legend.
- time
- Returns
- layer
Text
- layer
-
add_vertical_line
(self, time, **kwargs)¶ Add a vertical line to the figure.
- Parameters
- time
Time
The date/time at which the vertical line is shown.
- widthfloat or int, optional
The width of the line, in pixels.
- colorstr or tuple, optional
The color of the line.
- opacityfloat or int, optional
The opacity of the line from 0 (transparent) to 1 (opaque).
- labelstr, optional
The label to use to designate the layer in the legend.
- time
- Returns
- layer
VerticalLine
- layer
-
add_vertical_range
(self, time_lower, time_upper, **kwargs)¶ Add a vertical range to the figure.
- Parameters
- time_lower
Time
The date/time at which the range starts.
- time_upper
Time
The date/time at which the range ends.
- colorstr or tuple, optional
The fill color of the range.
- opacityfloat or int, optional
The opacity of the fill color from 0 (transparent) to 1 (opaque).
- edge_colorstr or tuple, optional
The edge color of the range.
- edge_opacityfloat or int, optional
The opacity of the edge color from 0 (transparent) to 1 (opaque).
- edge_widthfloat or int, optional
The thickness of the edge, in pixels.
- labelstr, optional
The label to use to designate the layer in the legend.
- time_lower
- Returns
- layer
VerticalRange
- layer
-
add_view
(self, title, description=None, include=None, exclude=None, empty=False, time_mode=None)[source]¶
-
export_interactive_bundle
(self, filename, embed_data=False, minimize_data=True, override_style=False)[source]¶ Create a bundle for the interactive figure containing an HTML file and JSON file along with any required CSV files.
- Parameters
- filenamestr
The filename for the zip file
- embed_databool, optional
Whether to embed the data in the JSON file (
True
) or include it in separate CSV files (False
). The default isFalse
.- minimize_databool, optional
Whether to include only data required for the visualization (
True
) or also other unused columns/fields in the time series (False
). The default isTrue
.- override_stylebool, optional
By default, any unspecified colors will be automatically chosen. If this parameter is set to
True
, all colors will be reassigned, even if already set.
-
preview_interactive
(self)[source]¶ Show an interactive version of the figure (only works in Jupyter notebook or lab).
-
save_static
(self, prefix, format='png', override_style=False)[source]¶ Export the figure to one or more static files using Matplotlib. If views are present then one plot is produced for each view.
- Parameters
- prefixstr
The name of the plot (without extension).
- formatstr
Any valid format supported by Matplotlib.
- override_stylebool, optional
By default, any unspecified colors will be automatically chosen. If this parameter is set to
True
, all colors will be reassigned, even if already set.
-
save_vega_json
(self, filename, embed_data=False, minimize_data=True, override_style=False)[source]¶ Export the JSON file, and optionally CSV data files.
- Parameters
- filenamestr
The name of the JSON file
- embed_databool, optional
Whether to embed the data in the JSON file (
True
) or include it in separate CSV files (False
). The default isFalse
.- minimize_databool, optional
Whether to include only data required for the visualization (
True
) or also other unused columns/fields in the time series (False
). The default isTrue
.- override_stylebool, optional
By default, any unspecified colors will be automatically chosen. If this parameter is set to
True
, all colors will be reassigned, even if already set.