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

Use left/right top/bottom instead of width/height in Rectangle#9072

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
dopplershift merged 5 commits intomatplotlib:masterfromdstansby:rect-timedelta
Dec 4, 2017

Conversation

dstansby
Copy link
Member

This changes the transform inRectangle to usetransforms.Bbox.from_extents instead oftransforms.Bbox.from_bounds. This allows for rectangles whose "width" may be a different type to the actual coordinates (eg.datetime for coords andtimedelta for width/height).

The api is maintained as before, all that has changed is stuff under the hood.

Fixes#4916, thanks to@pganssle for the idea.

@pganssle
Copy link
Member

Excellent, I think this is a much better solution. I have two suggestions for improvement:

  1. I think that a test should be added to check that something likepatch = mpatches.Rectangle((datetime(2017, 1, 1), 0), datetime(1970, 1, 5), 1)also fails - I think that bug isalso fixed by this patch. (Imade a PR against your branch with this additional test).
  2. Presumablytest_datetime_rectangle() should be be an image_comparison test, since it generates actual output? Or something should otherwise be asserted other than "this doesn't raise an error"?

@dstansby
Copy link
MemberAuthor

The reason I didn't do it as an image test is because the axis isn't formatted as datetime (an independent bug), so it would only be changed when that bug is fixed. Thanks for the extra test, I'll merge it.

@dstansby
Copy link
MemberAuthor

Right, thisshould be working now... once the tests pass I'll squash down to a couple of commits.

@dstansby
Copy link
MemberAuthor

All good to go!

Copy link
Member

@efiringefiring left a comment

Choose a reason for hiding this comment

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

Looks reasonable, apart from the question about get_bbox.

self.stale = True

def get_bbox(self):
return transforms.Bbox.from_bounds(self._x, self._y,
self._width, self._height)
return transforms.Bbox.from_extents(self._x0, self._y0,
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this need to use the unit conversions, as in _update_patch_transform()?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I guess it probably does, but no-one every added it originally. I'll add it in another commit.

@dstansby
Copy link
MemberAuthor

I've also taken the opportunity to clean the docstring, since it needed changing anyway.

@dstansbydstansby added this to the2.2 (next next feature release) milestoneSep 19, 2017
@jklymak
Copy link
Member

@dstansby this has been reviewed twice, so should be good to go, but there is a conflict.

@dopplershiftdopplershift merged commitf866168 intomatplotlib:masterDec 4, 2017
@dstansbydstansby deleted the rect-timedelta branchDecember 4, 2017 22:21
self.stale = True

def get_bbox(self):
return transforms.Bbox.from_bounds(self._x, self._y,
self._width, self._height)
x0, y0, x1, y1 = self._convert_units()
Copy link
Member

Choose a reason for hiding this comment

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

Why this call toconvert_units? Am I missing a side effect or was this meant to be passed to thefrom_extents call?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The_x0,_y0 etc. coords are now all stored in the class with units attached, so this strips the units because I don't thinkfrom_extents takes units.

Copy link
Member

Choose a reason for hiding this comment

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

but the next line passes inself._x0 etc notx0.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Ah, I see. PR incoming

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell left review comments

@efiringefiringefiring approved these changes

@dopplershiftdopplershiftdopplershift approved these changes

@WeatherGodWeatherGodWeatherGod approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v2.2.0
Development

Successfully merging this pull request may close these issues.

8 participants
@dstansby@pganssle@jklymak@efiring@tacaswell@dopplershift@WeatherGod@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp