Hi all, I sent pretty much this question a couple days ago,
> but it was tacked on to another thread, so it may have
> gotten lost in the shuffle. So here it is again:
Sorry Chris, I got half way through answering this a few days ago but
had to take off midstream, and though I thought I had saved the post,
it was lost. Trying again.
> This is how I thought MPL works, but it turns out I'm
> wrong, as the example below indicates. What have I got
> 1) The size of a figure is defined in length units
> (inches), and can be set by:
> Figure.set_figsize_inches( (w,h) )
> 1b) The layout of the figure is defined in "figure units"
> so it can be scaled by changing the figure size.
Not sure what this means, but you can change the figure size and the
layout (eg axes positions) will update.
> 2) Size of text, width of lines, etc is defined in terms of
> length units (points?).
> 3) When displaying to the screen, or creating an image
> (PNG) the pixel size of text and line widths, etc is
> determined by the dpi setting, which is set by:
> Figure.set_dpi( val )
Yep. But you have to be careful here, because savefig has it's own
default dpi, so when creating hardcopy you will need to explicitly set dpi.q
> The trick here is that when printing, it's natural to think
> in terms of inches, but when creating an image (for a web
> page, for instance), it is natural to think in terms of
> pixel size. However, AFAIK, MPL does not have a way to set
> the pixel size directly.
It does now. In 0.84 I added a canvas.resize(w,h) in pixels. So far
this has only been implemented in GTK*. If anyone wants to help with
the other backends, that would be great. See the thread on the dev
list "GUI maintainers: canvas.resize and ResizeEvent"
With the changes in that post, you can dynamically resize the canvas
or figure, eg from the interactive shell, and the GUI figure window
will update, as it should.
> However, changing the dpi of the Figure doesn't seem to
> have any effect. What's up John? shouldn't Figure.set_dpi
> effect the dpi of the resulting PNG? I'm using MPL 0.84 on
See the comment on savefig above.