Subplots for go.Figure?

I am trying to generate programmatically multiple Figures on a single output, in Plotly. The examples in the docs for subplots (found here: cannot be reproduced when go.Bar or go.Scatter is replaced by go.Figures.

Somebody suggested defining the figures as instances of go.FigureWidget() and then using HBox (from the ipywidgets package for Jupiter Notebooks) as follows:
fig_subplots= HBox([fw1, fw2])

But sadly this yields this weird result:

Same thing if I use .draw():

And without anything:
Screen Shot 2020-07-20 at 4.01.15 AM

Any suggestions would be greatly appreciated! I am willing to not use Jupiter Notebooks if that is what is required.

1 Like


You can use make_subplots, but add to each subplot the heatmap, not the figure:

import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots

heat = go.Heatmap(z=np.random.randint(2, 10, size=(3,5)), coloraxis = 'coloraxis1')

fig = make_subplots(rows=2, cols=3)

ncols= 3
for k in range(6):
    j =  k % ncols
    i = (k-j) // ncols
    fig.add_trace(heat, i+1, j+1);

fig.update_layout(width=900, height=600,
                  coloraxis1= dict(colorscale='matter',