Black Lives Matter. Please consider donating to Black Girls Code today.

Dropdown with subplot and single plots

I’m trying to have a dropdown menu where the first item is a subplot and via the menu i can access to every single plot full size.

So far I did this which plot every subplot inside is own box.

import plotly.offline as py
import plotly.graph_objs as go
import plotly.tools as tls
import pandas as pd
import numpy as np

n = 5
df1 = pd.DataFrame({0:np.random.randint(5,10,n),
                    1:np.random.randint(3,10,n),
                    2:np.random.randint(1,4,n)})

df2 = pd.DataFrame({0:np.random.randint(5,10,n),
                    1:np.random.randint(3,10,n),
                    2:np.random.randint(1,4,n)})


trace1 = {'x':df1.index,
          'y':df1[0],
          'name':"df1",
          'type':'bar',
          'marker':{'color': 'orange'}}

trace2 = {'x':df2.index,
          'y':df2[0],
          'name':"df2",
          'type':'bar',
          'marker':{'color': 'steelblue'}}

updatemenus = list([
    dict(active=0,
         buttons=list([
            dict(label = 'both',
                 method = 'update',
                 args = [{'visible': [True, True]},
                         {'title': 'both'}]),

            dict(label = 'df1',
                 method = 'update',
                 args = [{'visible': [True, False]},
                         {'title': 'df1'}]),

            dict(label = 'df2',
                 method = 'update',
                 args = [{'visible': [False, True]},
                         {'title': 'df2'}])
        ]),
    )
])

fig = tls.make_subplots(rows=1, cols=2)

fig.append_trace(trace1,1,1)
fig.append_trace(trace2,1,2)
fig['layout'].update(title='dataframes',
              updatemenus=updatemenus)
py.plot(fig)