I think this is quite easy but I searched the internet and matplotlib users mailing list and not able to find an answer. ax2 is an inset axes within the "ax" axes in figure "fig", which I make by following here: http://matplotlib.sourceforge.net/examples/pylab_examples/axes_demo.html
but now my problem is that I cannot fix the ax2 the exact position I want, it seems that draw() command change this:
In [352]: ax2.set_position([0.125,0.63,0.25,0.25]) In [353]: ax2.get_position() Out[353]: Bbox(array([[ 0.125, 0.63 ], [ 0.375, 0.88 ]])) In [354]: draw() In [355]: ax2.get_position() Out[355]: Bbox(array([[ 0.15625, 0.63 ], [ 0.34375, 0.88 ]])) notice that, after "draw()" command, the x0 of ax2 changed. could anyone give any hints?
thanks!
import matplotlib.pyplot as pltfig = plt.figure(figsize=plt.figaspect(0.75))ax2 = fig.add_subplot(111)ax2.set_position([0.125,0.63,0.25,0.25])ax2.get_position()Bbox(array([[ 0.125, 0.63 ],[ 0.375, 0.88 ]]))plt.draw()ax2.get_position()Bbox(array([[ 0.125, 0.63 ],[ 0.375, 0.88 ]]))