Default Image Size

Hi Folks,

I'm creating a basic graph as follows:

revnos = [ p['revno'] for p in data ]
durations = [ p['duration'] for p in data ]

majorFormatter = FormatStrFormatter('%d')

matplotlib.use('Cairo')
fig = Figure()
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.plot(revnos, durations, '-')
ax.set_title('PQM pre-commit hook durations from Revision %s to %s' %
(revnos[0], revnos[-1]))
ax.xaxis.set_major_formatter(majorFormatter)

ax.grid(True)
ax.set_xlabel('Revision')
ax.set_ylabel('Duration in Minutes')
canvas.draw()
fig.savefig(OUTPUTFILE)

Seems to give me a default size of 1200x900 (which I assume is somehow
related to my screen size) - I've tried altering the fig = line as
follows:

fig = Figure(figsize=(8,6), dpi=100)

but can't seem to change the output size of the image.

Thanks, Tom

···

--

----------------------------------
Tom Haddon
mailto:tom@…1682…
m +1.415.871.4180
www.greenleaftech.net

savefig has it's own DPI ( so screen resolution and print resolution
can differ). So set the figsize in the Figure init method as before,
and then psas dpi to savefig

fig.savefig(blah, dpi=300)

JDH

···

On 8/28/07, Tom Haddon <tom@...1682...> wrote:

fig.savefig(OUTPUTFILE)