I'am trying to do a surface plotting using plotly.graph_objs.
For now I've been able to plot scatter_3D from my data. here is some example data:
x = array([1.7 , 1.7 , 1.7 , 1.81, 1.81, 1.81, 1.81, 1.84, 1.84, 1.84, 1.84,
1.88, 1.88, 1.88, 2. , 2. , 2. , 2. , 2.1 , 2.1 , 2.1 , 2.1 ,
2.1 , 2.26, 2.26, 2.26, 2.26, 2.26, 2.27, 2.27, 2.27, 2.27, 2.27,
2.32])
y = array([ 5, 40, 45, 5, 10, 35, 45, 7, 10, 23, 53, 10, 15, 55, 5, 10, 20,
45, 7, 10, 22, 23, 38, 15, 16, 17, 20, 32, 10, 21, 22, 23, 24, 20],
dtype=int64)
z = array([ 0.19189438, 0.18705345, -0.03860124, 0.2175692 , 0.24031568,
0.27284764, -0.11035185, -0.0619468 , -0.0476288 , -0.15419163,
-0.06448167, 0.0953506 , -0.00442107, -0.11858008, 0.21716799,
0.17083289, 0.18600091, -0.12778652, -0.00543263, -0.0439605 ,
0.04520984, 0.0025256 , -0.10668005, 0.14977772, 0.03381919,
0.09641162, 0.00078166, -0.1974019 , 0.16011119, -0.03023742,
-0.01255179, 0.04970667, -0.03300753, -0.01788695])
here is the code snippet from the scatter_3D:
import plotly.graph_objs as go
entropy = df_capacity_theorique_ALL['entropy'].unique()
mean_yr = df.groupby(['entropy', 'probability'])['distance_vector'].mean().reset_index()
fig = go.Figure(data=[go.Scatter3d(x=mean_yr['entropy'], y=mean_yr['probability'],
z=mean_yr['distance_vector'], mode='markers')])
fig.update_layout(scene=dict(xaxis_title='Entropy', yaxis_title='probability',
zaxis_title='trueYR'))
fig.show(renderer='browser')
here is the code snippet from the surface plot:
x = np.array(mean_yr['entropy'])
y = np.array(mean_yr['probability'])
z = np.array(mean_yr['distance_vector'])
x = x.reshape(len(x), 1, 1)
y = y.reshape(1, len(y), 1)
z = z.reshape(1, 1, len(z))
fig = go.Figure(data=[go.Surface(x=x, y=y, z=z)])
fig.update_layout(scene=dict(xaxis_title='Entropy', yaxis_title='probability', zaxis_title='trueYR'))
fig.show(renderer='browser')
i've try to meshgrid x and y X, Y = np.meshgrid(x, y)
But that change nothing, graph is empty.
Thanks in advance !