|
From: David G. <d_l...@ya...> - 2008-10-06 23:41:40
|
The "solution" which worked well for me was to bite the bullet and switch to PIL for my image generating/processing needs. FWIW,
DG
--- On Mon, 10/6/08, Eric Firing <ef...@ha...> wrote:
> From: Eric Firing <ef...@ha...>
> Subject: Re: [Matplotlib-users] canvas.print_figure printing a variable amount of my figure
> To: "Christopher Barker" <Chr...@no...>
> Cc: "David Goldsmith" <d_l...@ya...>, mat...@li...
> Date: Monday, October 6, 2008, 11:56 AM
> Christopher Barker wrote:
> > David Goldsmith wrote:
> >> I feel like I must be missing something
> >
> > yup -- though it's an understandable miss...
>
> I think the longstanding separation between the figure.dpi
> and the
> savefig.dpi is a continual gotcha that we can and should
> eliminate.
> Savefig should use the figure dpi, so that what is saved
> corresponds to
> what is on the screen, unless explicitly overridden. One
> way to reduce
> the problem, with what I hope is an adequate level of
> backwards
> compatibility, would be to have the savefig.dpi default to
> a special
> flag setting that means "track the figure.dpi".
> For example,
> savefig.dpi could be the string, 'screen', by
> default. This could still
> be overridden by a numerical rcParams setting, or by the
> explicit dpi
> kwarg setting in savefig() or print_figure().
>
> There are still other highly confusing dpi things
> internally--such as a
> renderer.dpi setting that is ignored during rendering.
>
> Comments?
>
> Eric
>
> >
> >
> >> Attached are the results on my computer (see usage
> details below).
> >> Granted, I'm increasing the resolution each
> iteration,
> >
> > you are increasing the resolution of the figure, and
> of your
> > calculations, but NOT of the output image. The hint
> was that every image
> > was the same size: 1200X900 , which is
> 12"x9" at 100 dpi.
> >
> > It turns out that print_figure() doesn't respect
> the figures (native
> > DPI), it defaults to 100 dpi, but you can override it:
> >
> > >
> canvas.print_figure("test"+str(DPI)+"dpi.png",
> dpi=DPI)
> >
> > Then you'll get what I think you want.
> >
> > Maybe this will help:
> >
> >
> http://www.scipy.org/Cookbook/Matplotlib/AdjustingImageSize
> >
> > though it there, I talked about Figure.savefig(). I
> don't know if there
> > is a difference between that and Figure.print_figure()
> >
> > -Chris
> >
> >
|