0

i'm working with plotly.graph_objects to generate a 3D plot.

import plotly.graph_objects as go
import numpy as np

t = np.linspace(0,1,10)

fig = go.Figure(layout=go.Layout(width=1000, height=400))
fig.add_trace(go.Scatter3d(x=np.sin(t), y=np.cos(t), z=t,
                    mode='markers', marker=dict(size=2, color='blue'), name='Base'))

and the result is reported in the following image: Result

I would like the actual plot to be resized to 1000x400, not just the image with a small plot in the middle of it. Does anybody know how I can achieve this? Thanks

Sala
  • 480
  • 4
  • 19
  • Try this: `camera = dict(eye=dict(x=2, y=2, z=0.1));fig.update_layout(width=1000, height=400, scene_camera=camera, margin=dict(r=20, b=10, l=10, t=10))` – r-beginners Dec 02 '22 at 10:10
  • Nope, doesnt work – Sala Dec 02 '22 at 11:36
  • Try stopping the layout setup on the first graph object and adding new code (commented). `fig = go.Figure()` – r-beginners Dec 02 '22 at 12:57
  • No, sorry, still not working for me – Sala Dec 02 '22 at 13:47
  • I will share the code on which my comments are based, and I will expand it to Colab so you can check it out. Please check [Colab](https://colab.research.google.com/drive/17kK_Yh5Cq5cmvGywFzgP9l_CFPXFO6l1?usp=sharing) and comment so that you can check it out. Upon confirmation, I will disable this link. – r-beginners Dec 02 '22 at 14:01

0 Answers0