Plotly subplots using fig objects instead of traces

@dfernan
With Plotly 3.0.0+ you can create what you call subplots of figures. Namely, you define the figures as instances of go.FigureWidget().
If you have two such figures, fw1, fw2, define

fig_subplots=  HBox([fw1, fw2])
fig_subplots #this line displays the subplots in the Jupyter Notebook

To set the horizontal space between figures just update their margins:

fw1.layout.update(margin=dict( r=20))
fw2.layout.update(margin=dict( l=30))

If you have 3 or more figures you can locate them by a combination of VBox and HBox, imported from ipywidgets:

dashboard1=VBox([HBox([fw1, fw2]), HBox([fw3])])
dashboard1

7 Likes