5

I have an axes object and a parasite axes within that axes (variable ax of type mpl_toolkits.axes_grid1.parasite_axes.AxesHostAxes). I want to change the position of the parasite axes (for example it's width), but using ax.set_position() doesn't change the position.

I tried both this:

pos = ax.get_position()
ax.set_position([pos.x0, pos.y0, pos.width - 0.1, pos.height])

and this:

ax.set_position(matplotlib.tranforms.Bbox(
   np.array([pos.x0, pos.y0], [pos.width - 0.1, pos.height])))

but the position remains unchanged.

Not that I am running matplotlib in interactive mode, so draw() is called after every change. A related question where draw resets position ignoring the one specified with set_position(): here

In my case however the aspect is not 'equal' - it is 'auto'.

Community
  • 1
  • 1
mmagnuski
  • 1,249
  • 1
  • 11
  • 23

0 Answers0