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
PGF back-end fails on simple graph #1128
Comments
I can confirm this. It seems to be related to the use of bbox_inches='tight'. Removing this and the plot works as expected |
If you add the bbox_inches='tight' keyword, the Sorry, but when I implemented the method I thought |
This should be fixed in the latest commit in #1124 Saving the figure prints a warning that the bbox_inches option is not implemented, which is true because I have no idea what that option is and haven't seen any remark about it in backend_template :). Tight_layout however works nicely if that is an option for you. I'll try to figure out what bbox_inches does.. |
Thanks for the fix. bbox_inches isn't too important for me with the pgf backend since the result will be embedded directly into TeX files. For other formats like PDF, it gets rid of extraneous white-space around the figure. |
Ok apparently bbox_inches='tight' causes the figure to be printed to an in-memory buffer twice instead of saving to a file. The first run is for figuring out experimentally what the figure size is. You can use pyplot.tight_layout to do the opposite, changing the layout of the figure so it exactly uses the size you defined. For pixel perfect alignment you need to globally switch (pyplot.switch_backend or mpl.use) to the backend you are using for savefig until a better solution is found. |
Ahh help, I did a terrible mistake. Since PGF is a text file, images that occur in figures must be saved to additional files, in the same directory, based on the same filename. |
I'm not sure if this is related to the other Unicode/codec issue, but I'm trying out the pgf backend and I'm seeing what appears to be an issue with Unicode/codecs using matplotlib git master and Python 2.7 (Ubuntu 12.04):
The graph script is very basic:
I just built the latest git master with "python setup.py build" and used it directly from the build/ directory. Interestingly, the tests included with matplotlib do seem to generate graphs.
The text was updated successfully, but these errors were encountered: