how to set figure size

You have two options. savefig does have a dpi option that

    > will essentially set the figure size for the saved file:
    > savefig('myfile.png',dpi=300)

    > play with dpi until you get a figure size you like.

    > The other way to set the figure size is to specify it when
    > you create the figure: figure(1,(10,8)) would create a
    > fairly large figure. The figure (1 in this case) must not
    > already exist or at least it can't be shown on your screen
    > already. By that I mean if you have already called
    > figure(1) previously in your code, you must close it before
    > you try to call figure(1,(10,8)) or the figure size won't be
    > affected.

Just to elaborate a bit. The figure size in pixels is the figure size
in inches * the dpi. you can set the figure size in inches when you
create it

  fig = figure(figsize=(6,8)) # 6x8 inches

and when you save it set the dpi

  fig.savefig('somefile.png', dpi=200)

and you will have a 1200x1600 pixel PNG file.