3D Camera is not being applied to the plot for the first surface plotted

Upon creating a plotly go.Figure() and plotting the first surface plot, and then updating the layout with coordinate limits, aspect ratio, and camera settings, the rendering is not doing what I tell it to for the first trace that is added to the figure. It only applies the parameters on the second trace that is added to the plot. How do I force plotly to apply the camera setting (particularly troublesome) to the figure for the very first surface trace? The relevant code is below:

self.plot = go.Surface(x=X, y=Y, z=Z, surfacecolor=temp, showscale=True, coloraxis='coloraxis', colorscale=self.color_scheme, opacity=self.opacity)
surface_figure.fig.add_trace(self.plot)

self.color_max = 0
for idx in range(len(surface_figure.fig.data)):
    surface_colors = surface_figure.fig.data[idx].surfacecolor
    self.color_max = max(np.abs(surface_colors).max(), self.color_max)

camera = dict(eye=dict(x=1.1*structure.z_max,
                       y=1.1*structure.z_max,
                       z=1.1*structure.z_max))

surface_figure.fig.update_layout(
    scene=dict(
        xaxis_title='X',
        yaxis_title='Y',
        zaxis_title='Z',
        aspectmode='data',
        zaxis=dict(
            autorange=False,
            range=[1.25 * structure.z_min,
                   1.25 * structure.z_max]
        ),
        camera=camera,
        ),
        coloraxis=dict(
            colorscale=self.color_scheme,
            cmin=-self.color_max,
            cmax=self.color_max
        ),
)

surface_figure.fig.update_traces()
QApplication.processEvents()

html = surface_figure.fig.to_html()
with tempfile.NamedTemporaryFile(suffix=".html", delete=False) as tmpfile:
    tmpfile.write(html.encode('utf-8'))
    tmpfile_path = tmpfile.name

surface_figure.view.load(QUrl.fromLocalFile(tmpfile_path))
QApplication.processEvents()

Hey @David_Crouse welcome to the forums.

Could you provide a reproducible example? I am not sure if you’re referring to the camera settings or the axis ranges. I’ve never seen that you could apply camera settings for a single trace.

My guess is that you have several axes in the plot. Try updating all axes:

import plotly.graph_objects as go

fig = go.Figure(
    go.Bar(
        y=[i for i in [20, 14, 23]],
        x=['giraffes', 'orangutans', 'monkeys'],
        orientation='v'
    ), 
)
fig.update_xaxes(range=[0,100], selector=0)
fig.show()

fig.for_each_xaxis(lambda x: x.update({"range": [0,10]}))
fig.show()