Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
When setting the bbox_inches in savefig() to a specific size the resulting pgf file sets the bounding box to the appropriate dimensions but the image is not clipped. It seems that clip option should be added to the \pgfusepath command.
Current commands cut from top of pgf file:
\begingroup%
\makeatletter%
\begin{pgfpicture}%
\pgfpathrectangle{\pgfpointorigin}{\pgfqpoint{2.281265in}{2.224689in}}%
\pgfusepath{use as bounding box}%
Correct \pgfusepath command?:
\pgfusepath{use as bounding box,clip}%
I looked at the pgf file and see the use of \pgfusepath{clip} throughout deeper in the file however it doesn't clip the image. Adding clip as I did above gives the correct behavior in my latex document.
i created the pgf with a python command like:
extent = ax.get_window_extent().transformed(fig.dpi_scale_trans.inverted())
fig.savefig('test.pgf', bbox_inches=extent)