1

I'm using Plotly in python to create multiple 3d scatter plots (plotly.express.scatter_3d)

Each one is a complete and independent px.scatter_3d fig. They are gathered in a list:

all_figs = [fig1,fig2, ... , fig6]

I want to create a single fig with a button (or buttons) that allows me to toggle between each one (one at a time)

I've tried multiple approaches with no success. My latest version is:

(1) for each fig inside all figs i've crreated a dictionary, and concatinated them to a list called all_figs_dicts

all_figs_dicts = list()

.

for selected_observation_idx, selected_observation in enumarate(obs):
        #....

        fig_dict = dict()
        fig_dict['label'] = selected_observation
        fig_dict['method'] = 'update'
        visible = [False] * len(all_figs)
        visible[selected_observation_idx] = True
        fig_dict['args'] = [{'title': f'--> {selected_observation}', 'visible': visible}, ]
        all_figs_dicts.append(fig_dict)

And then combining them as follows:

    updatemenus = list([
        dict(active=0,
             buttons=all_figs_dicts
             )
    ])

    layout = dict(title='Yahoo', showlegend=False,
                  updatemenus=updatemenus)

    fig = dict(data=all_figs_dicts, layout=layout)
    plotly.offline.plot(fig, auto_open=True, show_link=True)

But i get an error message:

Did you mean "line"?

Bad property path:
label
^^^^^

Thanks

Guy Barash
  • 470
  • 5
  • 17

0 Answers0