plots.interactive.charts
Attributes
Classes
A class for creating and managing multi-subplot interactive charts using Plotly. |
Module Contents
- class plots.interactive.charts.Chart(rows=None, columns=None, **kwargs)
A class for creating and managing multi-subplot interactive charts using Plotly.
- Parameters:
rows (int, optional) – Number of rows in the chart grid. Default is 1.
columns (int, optional) – Number of columns in the chart grid. Default is 1.
**kwargs (dict) – Additional arguments passed to plotly.subplots.make_subplots.
- add_trace(*args, **kwargs)
Adds a trace to the chart at the appropriate location.
- Parameters:
*args (tuple) – Positional arguments passed to plotly.graph_objects.Figure.add_trace.
**kwargs (dict) – Keyword arguments passed to plotly.graph_objects.Figure.add_trace.
- bar(*args, **kwargs)
Adds a bar plot to the chart.
- Parameters:
data (array-like or earthkit.data.FieldList) – The data to be plotted.
*args (tuple) – Positional arguments passed to the bar plot generation function.
**kwargs (dict) – Additional options for customizing the bar plot.
Notes
Bar plots are added as individual traces to each subplot. Titles are inferred from data attributes if not provided.
- box(*args, **kwargs)
Generate a set of box plot traces based on the provided data and quantiles.
- Parameters:
data (array-like or earthkit.data.FieldList) – The data to be plotted.
*args (tuple) – Positional arguments passed to the plotly go.Box constructors.
quantiles (list of float, optional) – A list of quantiles to calculate for the data. The default is [0.05, 0.25, 0.5, 0.75, 0.95]. Note that any number of quantiles can be provided, but the default is based on the standard five-point box plot.
time_axis (int, optional) – The axis along which to calculate the quantiles. The default is 0.
**kwargs (dict) – Additional keyword arguments passed to the go.Box constructor.
- Return type:
list of plotly.graph_objects.Box
Notes
The width of the box plots is scaled based on the x-axis spacing.
Extra boxes are added for quantiles beyond the standard five-point box plot.
Hover information is included for quantile scatter points, showing the quantile value and percentage.
- property columns
The number of columns in the chart grid.
- property fig
The Plotly figure object representing the chart.
- line(*args, **kwargs)
Adds a line plot to the chart.
- Parameters:
data (array-like or earthkit.data.FieldList) – The data to be plotted.
*args (tuple) – Positional arguments passed to the line plot generation function.
**kwargs (dict) – Additional options for customizing the line plot.
Notes
Line plots are added as individual traces to each subplot. Titles are inferred from data attributes if not provided.
- property rows
The number of rows in the chart grid.
- set_subplot_titles()
- show(*args, **kwargs)
Display the chart.
- Parameters:
*args (tuple) – Additional arguments for plotly.graph_objects.Figure.show.
renderer (str, optional) – The renderer to use for displaying the chart. The default is “browser”. For static plots, use “png”.
**kwargs (dict) – Additional options for rendering the chart.
- Return type:
None
- title(title)
Set the overall chart title.
- Parameters:
title (str) – The title to display at the top of the chart.
- plots.interactive.charts.DEFAULT_LAYOUT