I have the following data:
I'm trying to plot x=long, y=short, z=balance
I've done it like this:
fig.add(go.Scatter3d(x=results['long'], y=results['short'], z=results['balance']))
and I get something like that:
what I am really looking for is a surface, like this example:
so, following the example's code, I did:
fig.add_surface(x=results['long'], y=results['short'], z=results['balance'], row=2, col=1)
but:
not only it doesn't display any data, it seems to totally ignore the subplot layout and draws over everything.
here is the complete code:
fig = make_subplots(rows=2, cols=1, specs=[[{'type': 'xy'}], [{'type': 'scene'}]])
fig.add_trace(go.Scatter(x=series1['timestamp'], y=series1['data'], line_color='red', name='series 1'), row=1, col=1)
fig.add_trace(go.Scatter(x=series2['timestamp'], y=series2['data'], line_color='blue', name='series 2'), row=1, col=1)
fig.update_yaxes(title_text="USD", row=1, col=1)
fig.add_surface(x=results['long'], y=results['short'], z=results['balance'], row=2, col=1)
fig.show()
so, my questions are:
Two answers:
surface
traces accept a 2-d matrix for z
layout.scene
object which is distinct from a 2-d cartesian subplotIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With