Skip to content

[WIP] Fix annotation get window extent #4023

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

Closed

Conversation

itziakos
Copy link
Contributor

This PR reworks Annotation to provide a get_window_extent method that will return as bounding box the union of the contained text and arrow.

Pending:

  • more tests
  • cleanup

@tacaswell
Copy link
Member

Great!

This looks like it will need a re-base to current master already.

@itziakos
Copy link
Contributor Author

I am on it

Conflicts:
	lib/matplotlib/tests/test_text.py
@itziakos
Copy link
Contributor Author

conflict resolved, please note that I still need to fix and add a couple of tests

@image_comparison(baseline_images=['text_bboxclip'])
def test_bbox_clipping():
plt.text(0.9, 0.2, 'Is bbox clipped?', backgroundcolor='r', clip_on=True)
t = plt.text(0.9, 0.5, 'Is fancy bbox clipped?', clip_on=True)
t.set_bbox({"boxstyle": "round, pad=0.1"})


def test_text_annotation_get_window_extent():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is easier to add the @cleanup decorator use pyplot to make your figure/axes objects.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, I now see why you are doing it this way.

@tacaswell tacaswell added this to the v1.4.3 milestone Jan 26, 2015
@tacaswell tacaswell added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Jan 31, 2015
@tacaswell
Copy link
Member

I have cherry-picked these over to be based on the 1.4.x branch. I should have a version of this merged in the near future.

tacaswell added a commit that referenced this pull request Jan 31, 2015
…w-extent

BUG : annotation objects did not report their window extent properl
@tacaswell
Copy link
Member

Merged in to v1.4.x as 26c7d65

@itziakos
Copy link
Contributor Author

itziakos commented Feb 1, 2015

Thanks @tacaswell.

Sorry for the delay. I will make a separate PR for the additional tests.

@tacaswell
Copy link
Member

@itziakos Thanks for your work.

Sorry if you feel like I stepped on your toes, I wanted to get this in and this was the fastest path to get there.

@itziakos
Copy link
Contributor Author

itziakos commented Feb 2, 2015

Sorry if you feel like I stepped on your toes, I wanted to get this in and this was the fastest path to get there.

There was no offense taken, It is me who should apologize for the delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants