How to size / scale a png

Hi there

I would like to generate pngs. The trouble
I have: I can’t size the png. I tried so many variations and browsed through
lots of mailings… it seems, I am too stupid for it. Here is my last approach:

from pylab import *

def create_png(filename, width_in_pixel,
height_in_pixel):

    bar_colors

= ["#E3E3AA", “#BFE0FF”, “#FFE8C4”, “#C6DFDA”,
#D9D1EB”]

    bar_performances

= [7.05, 17.57, 10.45, -6.35, -13.47]

    fig

= Figure()

    canvas

= FigureCanvasBase(fig)

    fig.add_subplot(111)

   

    for

b_num, b_perf in enumerate(bar_performances):

  bar((b_num + 0.55,), (b_perf,), width=.9,

color=bar_colors[b_num])

    gca()

    grid(True)

    xticks(arange(1,6),

(‘Scenario 1\nExpected’, ‘Scenario 2\nBest case’, ‘Scenario 3\nBoom’, ‘Scenario
4\nRecession’, ‘Scenario 5\nWorst case’))

    ylabel('Performance')

   

    dpi

= canvas.figure.get_dpi()

    fig.set_figsize_inches(width_in_pixel

/ dpi, height_in_pixel / dpi)

    canvas.draw()

force a draw

    savefig(filename,

dpi=dpi)

if name == ‘main’:

    create_png('c:/temp/aaaaa_scenarios.png',

400, 150)

Can you give me any hints how to correct
the problem? The png is always around (600,400) pixel… My next approach
would be to create the png and afterwards scale it with PIL - but it can’t
be that matplotlib does not offer a proper scaling/resizing feature - does
it?

Desperate Greetings,

Marco