Axes position is changed during rendering

Hello

I have a little problem.

On figure I have 2 Axes created by
        fig = plt.figure(figsize = (16, 10), facecolor='w')
       ax1 = fig.add_axes([0, 0, 1, 0.1])
       ax2 = fig.add_axes([0.1, 0.19, 0.8, 0.72], autoscale_on=True)
There are some text and images on it:
       ...
       drawing on ax1 and ax2
       ...
       ax1.imshow(arr, extent=[0.01, 0.29, 0.1, 0.95])
       ax1.imshow(arr, extent=[0.75, 0.96, 0.5, 0.8])
       ...

My problem - when I plot the figure - ax1 changes it's geometry.
Code:
        print 'ax1:', ax1
        print 'ax2:', ax2

        plt.show()

        print 'ax1:', ax1
        print 'ax2:', ax2
        print 'ax1 position changed during plt.show(). Why???'

Output:

  ax1: Axes(0,0;1x0.1)
  ax2: Axes(0.1,0.19;0.8x0.72)
  ax1: Axes(0.470649,0;0.0587025x0.1)
  ax2: Axes(0.1,0.19;0.8x0.72)
  ax1 position changed during plt.show(). Why???

On resulting plot ax1 has position (0.470649,0;0.0587025x0.1), but desired are (0,0;1x0.1).

Could anyone help me, or give an idea, why axes is moved, or give an advice, how to resolve this situation.

Thank you

"imshow" sets aspect=1 unless you changed your rcparams.
Unless aspect="auto", the axes position changes during the drawing time.

call imshow with aspect="auto"

or use set_aspect method.

http://matplotlib.sourceforge.net/api/axes_api.html?highlight=aspect#matplotlib.axes.Axes.set_aspect

Regards,

-JJ

···

On Thu, Jul 16, 2009 at 10:20 AM, Andrei Kopats<andrei.kopats@...287...> wrote:

Hello

I have a little problem.

On figure I have 2 Axes created by
fig = plt.figure(figsize = (16, 10), facecolor='w')
ax1 = fig.add_axes([0, 0, 1, 0.1])
ax2 = fig.add_axes([0.1, 0.19, 0.8, 0.72], autoscale_on=True)
There are some text and images on it:
...
drawing on ax1 and ax2
...
ax1.imshow(arr, extent=[0.01, 0.29, 0.1, 0.95])
ax1.imshow(arr, extent=[0.75, 0.96, 0.5, 0.8])
...

My problem - when I plot the figure - ax1 changes it's geometry.
Code:
print 'ax1:', ax1
print 'ax2:', ax2

   plt\.show\(\)

   print &#39;ax1:&#39;, ax1
   print &#39;ax2:&#39;, ax2
   print &#39;ax1 position changed during plt\.show\(\)\. Why???&#39;

Output:

   ax1: Axes\(0,0;1x0\.1\)
   ax2: Axes\(0\.1,0\.19;0\.8x0\.72\)
   ax1: Axes\(0\.470649,0;0\.0587025x0\.1\)
   ax2: Axes\(0\.1,0\.19;0\.8x0\.72\)
   ax1 position changed during plt\.show\(\)\. Why???

On resulting plot ax1 has position (0.470649,0;0.0587025x0.1), but
desired are (0,0;1x0.1).

Could anyone help me, or give an idea, why axes is moved, or give an
advice, how to resolve this situation.

Thank you

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options