Return an instance of plotly.graph_objects.Figure with the subplots domain set in ‘layout’.
Example 1: # stack two subplots vertically fig = tools.make_subplots(rows=2)
This is the format of your plot grid: [ (1,1) x1,y1 ] [ (2,1) x2,y2 ]
fig[‘data’] += [Scatter(x=[1,2,3], y=[2,1,2])] fig[‘data’] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis=’x2’, yaxis=’y2’)]
# or see Figure.add_trace
Example 2: # subplots with shared x axes fig = tools.make_subplots(rows=2, shared_xaxes=True)
This is the format of your plot grid: [ (1,1) x1,y1 ] [ (2,1) x1,y2 ]
fig[‘data’] += [Scatter(x=[1,2,3], y=[2,1,2])] fig[‘data’] += [Scatter(x=[1,2,3], y=[2,1,2], yaxis=’y2’)]
Example 3: # irregular subplot layout (more examples below under ‘specs’) fig = tools.make_subplots(rows=2, cols=2,
- specs=[[{}, {}],
[{‘colspan’: 2}, None]])
This is the format of your plot grid! [ (1,1) x1,y1 ] [ (1,2) x2,y2 ] [ (2,1) x3,y3 - ]
fig[‘data’] += [Scatter(x=[1,2,3], y=[2,1,2])] fig[‘data’] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis=’x2’, yaxis=’y2’)] fig[‘data’] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis=’x3’, yaxis=’y3’)]
Example 4: # insets fig = tools.make_subplots(insets=[{‘cell’: (1,1), ‘l’: 0.7, ‘b’: 0.3}])
This is the format of your plot grid! [ (1,1) x1,y1 ]
With insets: [ x2,y2 ] over [ (1,1) x1,y1 ]
fig[‘data’] += [Scatter(x=[1,2,3], y=[2,1,2])] fig[‘data’] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis=’x2’, yaxis=’y2’)]
Example 5: # include subplot titles fig = tools.make_subplots(rows=2, subplot_titles=(‘Plot 1’,’Plot 2’))
This is the format of your plot grid: [ (1,1) x1,y1 ] [ (2,1) x2,y2 ]
fig[‘data’] += [Scatter(x=[1,2,3], y=[2,1,2])] fig[‘data’] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis=’x2’, yaxis=’y2’)]
Example 6: # Include subplot title on one plot (but not all) fig = tools.make_subplots(insets=[{‘cell’: (1,1), ‘l’: 0.7, ‘b’: 0.3}],
subplot_titles=(‘’,’Inset’))
This is the format of your plot grid! [ (1,1) x1,y1 ]
With insets: [ x2,y2 ] over [ (1,1) x1,y1 ]
fig[‘data’] += [Scatter(x=[1,2,3], y=[2,1,2])] fig[‘data’] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis=’x2’, yaxis=’y2’)]
Keywords arguments with constant defaults:
Number of rows in the subplot grid.
Number of columns in the subplot grid.
Assign shared x axes. If True, subplots in the same grid column have one common shared x-axis at the bottom of the gird.
To assign shared x axes per subplot grid cell (see ‘specs’), send list (or list of lists, one list per shared x axis) of cell index tuples.
Assign shared y axes. If True, subplots in the same grid row have one common shared y-axis on the left-hand side of the gird.
To assign shared y axes per subplot grid cell (see ‘specs’), send list (or list of lists, one list per shared y axis) of cell index tuples.
Choose the starting cell in the subplot grid used to set the domains of the subplots.
If True, prints a tab-delimited string representation of your plot grid.
Keyword arguments with variable defaults:
Space between subplot columns. Applies to all columns (use ‘specs’ subplot-dependents spacing)
Space between subplot rows. Applies to all rows (use ‘specs’ subplot-dependents spacing)
Title of each subplot. “” can be included in the list if no subplot title is desired in that space so that the titles are properly indexed.
Subplot specifications.
ex1: specs=[[{}, {}], [{‘colspan’: 2}, None]]
ex2: specs=[[{‘rowspan’: 2}, {}], [None, {}]]
Indices of the outer list correspond to subplot grid rows starting from the bottom. The number of rows in ‘specs’ must be equal to ‘rows’.
Indices of the inner lists correspond to subplot grid columns starting from the left. The number of columns in ‘specs’ must be equal to ‘cols’.
Each item in the ‘specs’ list corresponds to one subplot in a subplot grid. (N.B. The subplot grid has exactly ‘rows’ times ‘cols’ cells.)
Use None for blank a subplot cell (or to move pass a col/row span).
Note that specs[0][0] has the specs of the ‘start_cell’ subplot.
The available keys are:
is_3d (boolean, default=False): flag for 3d scenes
for this subplot to span.
for this subplot to span.
l (float, default=0.0): padding left of cell
r (float, default=0.0): padding right of cell
t (float, default=0.0): padding right of cell
b (float, default=0.0): padding bottom of cell
Use ‘horizontal_spacing’ and ‘vertical_spacing’ to adjust the spacing in between the subplots.
Inset specifications.
The available keys are:
subplot cell to overlay inset axes onto.
is_3d (boolean, default=False): flag for 3d scenes
in fraction of cell width
in fraction of cell width (‘to_end’: to cell right edge)
in fraction of cell height
in fraction of cell height (‘to_end’: to cell top edge)
Column_width specifications
Functions similarly to column_width
of plotly.graph_objects.Table
. Specify a list that contains numbers where the amount of numbers in the list is equal to cols
.
The numbers in the list indicate the proportions that each column domains take across the full horizontal domain excluding padding.
For example, if columns_width=[3, 1], horizontal_spacing=0, and cols=2, the domains for each column would be [0. 0.75] and [0.75, 1]
Row_width specifications
Functions similarly to column_width
. Specify a list that contains numbers where the amount of numbers in the list is equal to rows
.
The numbers in the list indicate the proportions that each row domains take along the full vertical domain excluding padding.
For example, if row_width=[3, 1], vertical_spacing=0, and cols=2, the domains for each row from top to botton would be [0. 0.75] and [0.75, 1]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4