'matplotlib 3d axes size
I would like to plot points in 3D where the size of the Z axis is different to the X and Y i.e. plotted in an rectangular cuboid and not just a cube.
In this example, I would expect the axes to fill the left side of the figure but it doesn't. Also I have stipulated a square figure and a rectangular one.
X = np.random.uniform(0, 10, size=50)
Y = np.random.uniform(0, 10, size=50)
Z = np.random.uniform(0, 20, size=50)
fig = plt.figure(figsize=(10, 10))
ax = fig.add_axes([0, 0, .5, 1], projection='3d', facecolor='brown')
ax.view_init(elev=0, azim=0)
ax.scatter(X, Y, Z)
ax = fig.add_axes([.5, 0, .5, 1], projection='3d', facecolor='grey')
ax.view_init(elev=0, azim=0)
ax.scatter(X, Y, Z, clip_on=False)
ax.set_zlim(0, 10)
Can I more precisely adjust the shape and position of the 3D axes?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

