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

Updatemenu for plotly.graph_objects.Isosurface and plotly.graph_objects.Surface

I’m struggling to figure out how to use updatemenu to update plotly.graph_objects.Isosurface and plotly.graph_objects.Surface content in my plots.

I guess my main issue is, that I cannot find documention describing how to use “args”.

My attempt is on the form:

fig = go.Figure(data=go.Surface(...))

slice0 = [go.Isosurface(...)]

fig.update_layout(updatemenus=[go.layout.Updatemenu(type="buttons",
                                                    buttons=[dict(label="None",
                                                                  method="update",
                                                                  args=["none", []]),
                                                             dict(label="Slice 0",
                                                                  method="update",
                                                                  args=["isosurface", slice0]),
                                                            ],
                                                   )
                              ]
                 )

plotly.offline.plot(fig, filename=path_figures+'with_toggle.html', include_mathjax='cdn')

Some help on how to use this functionality would be highly appreciated.

Does this tutorial https://plot.ly/python/visualizing-mri-volume-slices/ help? If not, could you please give more details on how you want to do the animation (what are your frames etc.)?

No, unfortunately not.

I want to make a figure that includes an Isosurface and a Surface (and any other kinds of elements in future figures). And then I want to include buttons, that can switch each of them on/off.