ARTICLE AD BOX
The flickering happens due to z-fighting in the WebGL renderer. When two 3D objects (e.g., a surface and a border line) share identically depth values, the GPU cannot detect which should appear in front, causing visual flickers.
I tried this code it seemed to fix it
I chose to write on output.html since i was facing issues with wsl when i used fig.show() you can change that part of code at the end as per your need.
import numpy as np import plotly.graph_objects as go # spiral surface theta = np.linspace(0, 4*np.pi, 250) r = np.linspace(0.2, 1, 60) theta, r = np.meshgrid(theta, r) x = r * np.cos(theta) y = r * np.sin(theta) z = theta fig = go.Figure() # main surface fig.add_trace(go.Surface( x=x, y=y, z=z, colorscale=[[0, "#67dfe3"], [1, "#67dfe3"]], showscale=False, lighting=dict( ambient=0.9, diffuse=0.4, specular=0.05 ) )) # outer edge border fig.add_trace(go.Scatter3d( x=x[-1], y=y[-1], z=z[-1], mode="lines", line=dict( color="black", width=6 ), showlegend=False )) # inner edge border fig.add_trace(go.Scatter3d( x=x[0], y=y[0], z=z[0], mode="lines", line=dict( color="black", width=6 ), showlegend=False )) # layout styling fig.update_layout( template="none", scene=dict( bgcolor="#f2f2f2", xaxis=dict( title="x", backgroundcolor="#f2f2f2", gridcolor="gray", showbackground=True, zerolinecolor="gray" ), yaxis=dict( title="y", backgroundcolor="#f2f2f2", gridcolor="gray", showbackground=True, zerolinecolor="gray" ), zaxis=dict( title="z", backgroundcolor="#f2f2f2", gridcolor="gray", showbackground=True, zerolinecolor="gray" ), camera=dict( eye=dict( x=1.3, y=1.3, z=0.9 ) ) ), margin=dict(l=0, r=0, b=0, t=40), title="3D Spiral Surface" ) fig.write_html("output.html")