0

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()

enter image description here

The desired result is that the grid is wider. I mean the figure should be filled by the grid as much as possible.

Elena Greg
  • 1,061
  • 1
  • 11
  • 26
  • what's wrong with your plot? azim 90 means looking from +y and elev 90 means looking from +z, see https://stackoverflow.com/a/64849390/3944322 for illustrations – Stef Jan 27 '21 at 16:00
  • I added the figure. I need to dilate the grid. – Elena Greg Jan 27 '21 at 16:06

1 Answers1

2

add the following to your script:

ax.set_box_aspect((10,5,1))
plt.tight_layout(pad=0)
Stef
  • 28,728
  • 2
  • 24
  • 52