Hello,
I have a use case where I would like to switch from a line plot involving 2 columns in a data frame to a surface plot involving 3 columns.
The gist of the line plot is the following and everything works properly (it is updating a Div on the web):
g = dcc.Graph(
id='my-graph',
figure={ 'data': [{ 'x': df[1], 'y': df[2], 'type': 'line' }] }
)
return html.Div([ g ])
The same module, depending on the context, needs to return a surface plot and I have the following code (essentially add ‘z’ and changing the ‘type’ from ‘line’ to ‘surface’):
g = dcc.Graph(
id='my-graph',
figure={ 'data': [{ 'x': df[1], 'y': df[2], 'z': df[3], 'type': 'surface' }] }
)
return html.Div([ g ])
This does not work and the Div is not updated on the browser. The example you have uses plotly.graph_objs. I tried that method also and I have the same issue of display not working.
How can I get the above code to display the surface graph?
Thanks!
Edit: I see some error on JavaScript console: “Error: cwise: Arrays do not all have the same shape react-dom@16.8.6.min.js…” I can confirm that I am using the same dataframe and it has 100 rows. I am not sure what data or attributes this error is referring to. Unfortunately, my javascript debugging abilities are quite limited
Edit 2: just realized that the plot needs to be scatter3d