Plotly panel resets layout on data update

Hi there,

I am using panel to display a plotly pane. It works quite nicely but as soon as want to update some trace parameters, the layout is reseted at its original view. Is this a feature, a bug or am I doing this wrong?

Below a minimal self-contained example. In order to test the behaviour I am talking about, turn the 3d object with the mouse and then move the opacity slider.

import param
import panel as pn
import plotly.graph_objects as go
pn.extension('plotly')

class MyFig(param.Parameterized):
    opacity = param.Number(default=1, softbounds=(0,1))
    fig_pane = param.ClassSelector(class_=pn.pane.Plotly)
    
    @param.depends('opacity', watch=True)
    def update_opacity(self):
        self.fig_pane.object.data[0].update(opacity=self.opacity)
                              
    def view(self):
        return pn.Column(self.param.opacity, self.fig_pane)

plotly_fig = go.Figure(data=[
    go.Mesh3d(
        x=[0, 1, 2, 0], y=[0, 0, 1, 2], z=[0, 2, 0, 1],
        i=[0, 0, 0, 1], j=[1, 2, 3, 2], k=[2, 3, 1, 3],
    )
])
myfig = MyFig(fig_pane=pn.pane.Plotly(plotly_fig))
myfig.view()

Thanks for your time :wink:

Alex-

Thanks for the question, could you report your version of Panel?

My version of panel is 0.9.5 and bokeh 2.0.1

This definitely seems like a bug, could you raise an issue?

ok, will do