figs = []
w = 5
h = 5
for i in xrange(4):
figs.append(figure(figsize=(w, h)))
plot([1,2,3],[6,4,2])
h = h+1
show()
for each in figs:
print each.get_size_inches()
from pylab import *
fig=figure(figsize=(5,5))
plot([1,2,3],[6,4,2])
show()
fig.get_size_inches()
...gives a square figure window and the console output as expected:
[ 5. 5.]
However, running the following which specifies a different dpi:
from pylab import *
fig=figure(figsize=(5,5), dpi=50)
plot([1,2,3],[6,4,2])
show()
print fig.get_size_inches()
...gives a rectangular figure window and the console output:
[ 6.46 5. ]
So Spyder does not seem to be handling the dpi properly.
I tried it with Spyder 2.0.12 and the latest 2.1.8.
In the 2nd example with dpi, running directly from ipython or python command line gives square figures but with reported dimensions slightly larger than 5x5 inches. Adding these 2 lines to the start of the scripts:
import matplotlib as mpl
mpl.use('QT4Agg')
...makes it give 5x5 inches for both figures. (Adding those 2 lines to the start when running from Spyder has not effect since Spyder consoles have already chosen QT4Agg as the GUI backend.
Best,
Chris