-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
savefig with bbox_inches='tight' ignores annotation without text #3816
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
Comments
I am halfway through a solution for this issue: In short, the |
@itziakos Any progress on this? |
I was hopping that I could spent some time on it over the next two weeks. The main delay is related to making sure that there are tests checking the basic configurations for the annotation arrow. I can make a in-progress PR if it is desirable. |
Just put 'WIP' in the title so we know it is a 'work in progress'. It is probably better to get feed back sooner rather than later. On Thu Jan 08 2015 at 7:29:09 PM Ioannis Tziakos notifications@github.com
|
This will be tied to #4012 as changing the |
Work in progress PR #4023 |
Should be fixed by 26c7d65 |
It appears that the bbox_inches='tight' option in savefig ignores annotations without text. Here is my example code
Here is test.png, showing that I have two annotations. One annotation, with text, below the axes and one annotation, without text, above the axes.
Here is test-tight.png, showing only one annotation. The annotation above the axes, without the text, has been ignored.
Looking in the source code,
bbox_inches='tight'
attempts to find the size and location of artists by callingartist.get_window_extent()
. When I tryarrow1.get_window_extent()
, I get a bounding box that appears to correspond to the text. When I tryarrow2.get_window_extent()
, I get a bounding box with zero height and zero width. Thus, the root of the problem is.get_window_extent()
doesn't include the arrow.Any ideas for how to get around this, in a reasonably robust manner? If I could somehow get the proper bounding box for the whole annotation, then I would be in business. However, I can't even seem to get the line or patch objects out of arrow2.
In case it matters, I am on matplotlib 1.4.0, Python 2.7.6, and Mac OS X 10.8.5
The text was updated successfully, but these errors were encountered: