get aspect ratio of axes

前端 未结 4 1671
[愿得一人]
[愿得一人] 2020-12-06 11:49

Is there an easy and reliable way to determine the current aspect ratio of an axes when its aspect is set to \'auto\'?

The obvious thing to

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 12:26

    How about

    import numpy as np
    aspect = sum(np.abs(ax.get_xlim())) / sum(np.abs(ax.get_ylim()))
    

提交回复
热议问题