OS X Bad Aspect Ratio

Hey all,

When I plot using python 2.5.2 and matplotlib 0.98.3 (and 0.98.1) I have the following problem. If I run a script from the command line that plots and saves the figure, I get the default aspect ratio of (8, 6). If, however, I close the plotting window and replot without exiting the python prompt and starting anew, the aspect changes to something like (8, 6.04). I can reliably get the (8, 6) aspect ratio if I quit the python prompt and load a new prompt. The problem only comes after I close the plot window and replot.

The new aspect ratio is consistent after it first changes. That is, if I plot, close the window, replot, close the window, and replot again, the 2nd and 3rd figures would save with the same aspect ratio while the first would have the one I desire. What could be the problem?

Cheers,

Josh

I just attempted to reproduce your problem with 0.98.3 and couldn't; I managed to get identical screenshots after closing the window and replotting.

Several things you could tell us that might help isolate the problem:

- What GUI backend? TkAgg I'm assuming? If you're unsure, import matplotlib and use the matplotlib.get_backend() function.
- What plotting commands are you using?
- Does the aspect ratio change if you do something simple like, say,

import numpy
from pylab import *
x = numpy.randn(50,50)
imshow(x)
(close window)
imshow(x)

import numpy
from pylab import *
x = numpy.arange(1,10)
plot(x, x**2)
(close window)
plot(x,x**2)

Neither of these lead to an aspect ratio shift for me, on OS X 10.5 with the TkAgg backend, same version of matplotlib.

David

ยทยทยท

On 4-Sep-08, at 10:03 PM, Josh Lawrence wrote:

Hey all,

When I plot using python 2.5.2 and matplotlib 0.98.3 (and 0.98.1) I
have the following problem. If I run a script from the command line
that plots and saves the figure, I get the default aspect ratio of (8,
6). If, however, I close the plotting window and replot without
exiting the python prompt and starting anew, the aspect changes to
something like (8, 6.04). I can reliably get the (8, 6) aspect ratio
if I quit the python prompt and load a new prompt. The problem only
comes after I close the plot window and replot.