Reputation: 1165
I would like to have a figure 10,5 with lims, azimuth, and elevation as set below. How to set the ration? Is ax.get_proj solution, if so, I am not able to write the correct arguments.
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure(figsize=[10,5])
ax = fig.gca(projection = '3d')
azimuth=90
elevation=90
ax.azim = azimuth
ax.elev = elevation
ax.get_proj = lambda: np.dot(Axes3D.get_proj(ax), np.diag([1.55, 1.5, 0.8, 1]))
ax.set_xlim(-0.69, 0.69)
ax.set_ylim(-0.32, 0.32)
plt.show()
The desired result is that the grid is wider. I mean the figure should be filled by the grid as much as possible.
Upvotes: 0
Views: 142
Reputation: 30579
add the following to your script:
ax.set_box_aspect((10,5,1))
plt.tight_layout(pad=0)
Upvotes: 2