Python matplotlib 3D surface | How to resize viewport?

32 Views Asked by At

I want to resize viewport to same width with fig size or change viewport shape from a square to a rectangle.

[python code]

fig = plt.figure(figsize=(10,4))
fig.patch.set_facecolor('#151C2C')
ax = fig.add_subplot(111, projection='3d')
plt.subplots_adjust(left=0, bottom=0, right=1, top=1)

x = np.linspace(0, y1.shape[1], y1.shape[1])
y = np.linspace(0, y1.shape[0], y1.shape[0])
xv, yv = np.meshgrid(x, y)
surf = ax.plot_surface(xv, yv, np.log10(y1),cmap='jet')

ax.axis('scaled')
ax.set_box_aspect([3, 1, 1])

[Screen Capture]

https://i.stack.imgur.com/Dz9nd.png

I find subplots_adjust() but i cna't resize viewport width. and set_box_aspect() is just resize plot shape in viewport, not a viewport

0

There are 0 best solutions below