Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

text update properties does not handle bbox properly#4942

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 1 commit intomatplotlib:masterfromjrevans:issue16
Aug 22, 2015

Conversation

jrevans
Copy link

Added a check to make sure any existing bbox is not overridden.

The previous behavior would overwrite the bbox property to None even if it was not specified. This now keeps the bbox property as it was unless bbox is specified as a parameter to 'update'.

This addresses an issue in#4897.

@@ -240,7 +240,8 @@ def update(self, kwargs):
"""
bbox = kwargs.pop('bbox', None)
super(Text, self).update(kwargs)
self.set_bbox(bbox) # depends on font properties
if bbox:
Copy link
Member

Choose a reason for hiding this comment

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

probably to be safe, this should beif bbox is not None:. I can't be sure if bbox is ever a numpy array or not, and doing a test like that on a numpy array will result in errors in some versions, I think.

Copy link
Member

Choose a reason for hiding this comment

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

If that is the case, we have a whole bunch of other places in the code have the same issue.

@tacaswell
Copy link
Member

@efiring You put this in in2eb4313 as part of#4178 can you comment on why?

@tacaswelltacaswell modified the milestone:next point releaseAug 18, 2015
@efiring
Copy link
Member

@tacaswell, I put in the override update method to ensure the bbox setting is processedafter everything else; setting the bbox depends on the font size, so if both are changed, we have to process the font change first.

@efiring
Copy link
Member

I think this PR is fine. I originally overlooked the case that it is addressing. When bbox is supplied as a kwarg, it has to be a dictionary, not a numpy array. Usingif bbox is not None: would be a little more clear, but is not mandatory.

@efiring
Copy link
Member

What is a little confusing is that there used to be a bbox and/or a bbox_patch, and I eliminated the former--but the API still uses set_bbox. This makes it look at first glance like a "bbox" attribute is not getting initialized with this PR. But it's OK, because _bbox_patch is initialized to None in theinit method. Maybe it would all be clarified if the_bbox_patch attribute were renamed to_bbox--although it is really more of a "patch" than a "bbox". Endlessly confusing...

@tacaswell
Copy link
Member

@jrevans Can you add a test for this? It does't need to be an image test, just that calling update does not blow away a previously set bbox.

@efiring If I am following you, we usebbox lots of places to mean 'the bounding box that the artist will fall with in when drawn' and here it means 'the patch that is drawn behind the text that is strictly bigger than the other meaning of the bounding box of the text' ?

tacaswell added a commit that referenced this pull requestAug 22, 2015
FIX: only update bbox_patch if passed in to `Text.update`
@tacaswelltacaswell merged commitc29c773 intomatplotlib:masterAug 22, 2015
@tacaswell
Copy link
Member

@jrevans Can you add the test in a new PR?

@efiring
Copy link
Member

On 2015/08/22 8:19 AM, Thomas A Caswell wrote:

@efiringhttps://github.com/efiring If I am following you, we use
|bbox| lots of places to mean 'the bounding box that the artist will
fall with in when drawn' and here it means 'the patch that is drawn
behind the text that is strictly bigger than the other meaning of the
bounding box of the text' ?

Exactly. It's really a background patch, potentially a very fancy one.
Originally it might have been just a simple patch corresponding to the
true bounding box of the text, but those days are long gone. It might
be worth deprecating the "bbox" kwarg in favor of "patch" or
"background". Even plain "box" would be an improvement.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v1.5.0
Development

Successfully merging this pull request may close these issues.

4 participants
@jrevans@tacaswell@efiring@WeatherGod

[8]ページ先頭

©2009-2025 Movatter.jp