Home > Back-end >  How to add a equal-aspect inset axes in the corner of a parent axes
How to add a equal-aspect inset axes in the corner of a parent axes

Time:12-16

I want to add an inset axis to the upper left corner of a parent axis. This can easily be done like so:

fig, ax = plt.subplots()
iax = ax.inset_axes([0,.8, .2, .2])

inset_axes

However, I need the inset axis iax to have an aspect ratio of one. But when I change the aspect ratio, the inset axis shifts slightly to the right.

iax.set_aspect('equal')

offset equal aspect inset axis

How can I make the aspect ratio of the inset axis "equal", while still having it nestled in the upper left corner? I know I could just mess around with the inset_axes location parameter, but ideally I want some method that works for any given axis size.

CodePudding user response:

You need to set the enter image description here

  • Related