canvas.print_figure printing a variable amount of my figure

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?

This appears to have never been “fixed” (though I see no opposition expressed looking back at the original thread in the archive) - having forgotten about it and the fact that, at the time, it sent me running to PIL, I got bitten by it again (luckily I had a vague recollection of this thread before posting the same problem again and making a complete ass outta myself). I’m not sure if I have the bleeding edge version of MPL, but as I’m now working on the second different computer I’ve had since the OP, I’m pretty sure I’m running a later version than I was back then. Did this issue ever mature into a ticket?

DG

···

On Mon, Oct 6, 2008 at 10:56 AM, Eric Firing <efiring@…202…> wrote:

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

David Goldsmith wrote:

    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?

This appears to have never been "fixed" (though I see no opposition expressed looking back at the original thread in the archive) - having forgotten about it and the fact that, at the time, it sent me running to PIL, I got bitten by it again (luckily I had a vague recollection of this thread before posting the same problem again and making a complete ass outta myself). I'm not sure if I have the bleeding edge version of MPL, but as I'm now working on the second different computer I've had since the OP, I'm pretty sure I'm running a later version than I was back then. Did this issue ever mature into a ticket?

Not that I know of. I never got back to it, and I don't think anyone else did, either.

Eric

···

On Mon, Oct 6, 2008 at 10:56 AM, Eric Firing <efiring@...202... > <mailto:efiring@…202…>> wrote:

DG

    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