Sub plots
Multiple sub plots can be combined into one plot using the make_subplots function. This function accepts multiple plot objects, and returns a single plot object. The plot objects can be any of the plot types supported by Deephaven Express. They can be arranged in a grid, or in a single row or column. The shared_xaxes and shared_yaxes parameters can be used to share axes between plots.
Examples
Four unique plots
Create a series of plots as subplots, all providing unique perspectives on the data of interest.
Existing Titles as Subplot Titles
By default, titles from the original figures are converted to subplot titles if they exist.
Adding New Subplot Titles
Add titles to individual subplots using the subplot_titles parameter. Provide a list or tuple of titles, ordered from left to right, top to bottom.
Adding a Title
Add a title to the combined subplot figure using the title parameter.
Share Axes
Share axes between plots with the shared_xaxes and shared_yaxes parameters.
Share All Axes
When shared_xaxes or shared_yaxes is set to "all", all axes of the same type are shared.
When one axis is adjusted, all axes are adjusted to match.
Share Y Axes
When shared_yaxis is set to True, all y axes are shared along the same row.
When one y-axis is adjusted, all axes along the same row are adjusted to match.
To share the y axes along the same column, set shared_yaxes to "columns".
Share X Axes
When shared_xaxis is set to True, all x axes are shared along the same column.
When one x-axis is adjusted, all axes along the same column are adjusted to match.
To share the x axes along the same column, set shared_yaxes to "columns".
API Reference
Create subplots. Either figs and at least one of rows and cols or grid should be passed.
Returns: DeephavenFigure The DeephavenFigure with subplots
| Parameters | Type | Default | Description |
|---|---|---|---|
| *figs | Figure | DeephavenFigure | Figures to use. Should be used with rows and/or cols. | |
| rows | int | 0 | A list of rows in the resulting subplot grid. This is calculated from cols and number of figs provided if not passed but cols is. One of rows or cols should be provided if passing figs directly. |
| cols | int | 0 | A list of cols in the resulting subplot grid. This is calculated from rows and number of figs provided if not passed but rows is. One of rows or cols should be provided if passing figs directly. |
| shared_xaxes | str | bool | None | None | "rows", "columns"/True, "all" or None depending on what axes should be shared |
| shared_yaxes | str | bool | None | None | "rows"/True, "columns", "all" or None depending on what axes should be shared |
| grid | List[List[Figure | DeephavenFigure]] | None | None | A grid (list of lists) of figures to draw. None can be provided in a grid entry |
| horizontal_spacing | float | None | None | Spacing between each column. Default 0.2 / cols |
| vertical_spacing | float | None | None | Spacing between each row. Default 0.3 / rows |
| column_widths | list[float] | None | None | The widths of each column. Should sum to 1. |
| row_heights | list[float] | None | None | The heights of each row. Should sum to 1. |
| specs | list[SubplotSpecDict] | List[List[SubplotSpecDict]] | None | None | A list or grid of dicts that contain specs. An empty dictionary represents no specs, and None represents no figure, either to leave a gap on the subplots on provide room for a figure spanning multiple columns. 'l' is a float that adds left padding 'r' is a float that adds right padding 't' is a float that adds top padding 'b' is a float that adds bottom padding 'rowspan' is an int to make this figure span multiple rows 'colspan' is an int to make this figure span multiple columns |
| subplot_titles | list[str] | tuple[str, ...] | bool | True | True by default, which automatically extracts and uses titles from the input figures as subplot titles. If False or an empty list/tuple, one of the subplot titles ends up as the chart title. See the title parameter to override this behavior. If a list or tuple is provided, these are the titles for each subplot. Titles are filled left to right, top to bottom. Empty strings ("") can be included in the list if no subplot title is desired in that space. |
| title | str | None | None | The overall title for the combined subplot figure. If an empty string, no overall title is shown. |
| unsafe_update_figure | Callable | <function default_callback> | An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. Note that the existing data traces should not be removed. This may lead to unexpected behavior if traces are modified in a way that break data mappings. |