I have a dataframe:
surfacex surfacey surfacez
0 -0.50 0.00 0.00
1 -0.48 -0.14 0.00
2 -0.48 -0.12 -0.06
3 -0.48 -0.12 0.06
4 -0.48 -0.10 -0.08
... ... ... ...
3897 0.48 0.10 0.08
3898 0.48 0.12 -0.06
3899 0.48 0.12 0.06
3900 0.48 0.14 0.00
3901 0.50 0.00 0.00
where each row represents a 3D point. I want to plot a surface that bounds these points. In this case, the points all lie on the surface of a sphere, and hence I want to plot a spherical surface. Currently this is what I am trying:
import numpy as np
import plotly.graph_objects as go
X=df['surfacex'].values
Y=df['surfacey'].values
Z=df['surfacez'].values
trace= go.Surface(x=np.reshape(X,(1951,2)),y=np.reshape(Y,(1951,2)),z=np.reshape(Z,(1951,2)))
#I am reshaping as online tells me it needs to be a 2D array, and my df is of length 3902
fig2=go.Figure(data=[trace])
fig2.show()
However, the resulting plot looks like:
which is clearly not what I want. What I want would be something similar to:
How can I achieve the desired plot? Matplotlib or plotly solutions are both ok
Thanks