-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
savefig PGF - RuntimeError: Cannot get window extent w/o renderer #2342
Comments
@pwuertz: As the PGF guy, I thought I'd bring this to your attention. |
There is indeed a problem I couldn't solve. The way the tight bbox mechanism currently works is to draw a figure to a dummy stream as some kind of initialization. Then it grabs the active Renderer in order to determine the text element sizes and thus the figure size. So the backend must support writing to a stream,. I implemented stream support in backend_pgf for the ".pdf" and ".png" output, so tight bbox works here. Pgf output on the other hand may consist of multiple files if a figure includes raster images. There is no meaningful way of writing this to a stream, so I denied streams as a target if the output type is ".pgf". This is why tight bbox fails here. To fix this one could eliminate that dummy save-figure procedure in the tight bbox routine and use the |
support tight_bbox for pgf output, fixes #2342
support tight_bbox for pgf output, fixes #2342 (v1.3.x)
I'm trying to save a figure in pyplot with tight margins.
The following code works perfectly with a PDF output:
But not with PGF output
as it returns
RuntimeError: Cannot get window extent w/o renderer
.I have been suggested that this may be a bug -- see question on Stackoverflow.
matplotlib 1.3.0 on Ubuntu 13.04
The text was updated successfully, but these errors were encountered: