Issue with Plotly Export: scatter3 Output as 2D Instead of 3D from MATLAB

I’m encountering an issue when exporting a scatter3 plot from MATLAB to Plotly. When I create a scatter3 plot and export it to HTML using fig2plotly, the output in the browser is rendered as a 2D plot instead of the expected 3D plot.
I used the following demo code:

[X,Y,Z] = sphere(16); 
x = [0.5*X(:); 0.75*X(:); X(:)]; 
y = [0.5*Y(:); 0.75*Y(:); Y(:)]; 
z = [0.5*Z(:); 0.75*Z(:); Z(:)]; 
scatter3(x,y,z) 
fig2plotly(gcf); 

The figure in Matlab:


The exported html file

When I use surf or mesh, the output correctly displays as 3D in Plotly. It seems that only scatter3 and plot3 are affected.

Are there any suggestions or workarounds to solve this issue?
I appreciate any help or guidance!

Thank you!

1 Like