Skip to content

FIX patch.update_from to also copy _original_edge/facecolor #10575

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
wants to merge 9 commits into from

Conversation

KonradAdamczyk
Copy link

@KonradAdamczyk KonradAdamczyk commented Feb 23, 2018

fix for bug described in
#10574

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

fix for bug described in
matplotlib#10574
Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

Looks good to me! I should have kept reading before opening the same fix.

@jklymak
Copy link
Member

jklymak commented Feb 24, 2018

Actually can you add a small test to check that uodate_property keeps doing the right thing? Need not use legend or have an image test

@jklymak jklymak changed the title fix for #10574 FIX patch.update_from to also copy _original_edge/facecolor Feb 25, 2018
@jklymak
Copy link
Member

jklymak commented Feb 25, 2018

Suggest adding to test_patches.py....

def test_update_from():
    # test that update_from properly sets the facecolor.
    fig, ax = plt.subplots()
    rect = Rectangle((0, 0), 1., 1., facecolor='magenta')
    rect2 = Rectangle((1., 0), 1., 1., facecolor='blue')
    ax.add_patch(rect)
    ax.add_patch(rect2)
    rect2.update_from(rect)
    rect2.set_alpha(0.8)
    assert rect2.get_facecolor() == (1., 0., 1., 0.8)

I tried force pushing, but....

@jklymak
Copy link
Member

jklymak commented Feb 27, 2018

@KonradAdamczyk any chance you can add the test? If not, is it ok to force push onto your PR?

KonradAdamczyk added a commit to KonradAdamczyk/matplotlib that referenced this pull request Feb 27, 2018
@KonradAdamczyk
Copy link
Author

@jklymak
Please review my test, especially if it will be executed under CI
BTW I granted commit permission for you.

@jklymak
Copy link
Member

jklymak commented Mar 7, 2018

@KonradAdamczyk were you going to add the test, or would you like me to?

@KonradAdamczyk
Copy link
Author

@jklymak I already added the test.
See KonradAdamczyk@08a0298

@jklymak
Copy link
Member

jklymak commented Mar 7, 2018

It needs to be in the same git branch as this PR

@jklymak
Copy link
Member

jklymak commented Mar 9, 2018

ping @KonradAdamczyk

@jklymak jklymak modified the milestones: v2.2.1, v3.0 Mar 12, 2018
@jklymak
Copy link
Member

jklymak commented Mar 14, 2018

Great, thanks @KonradAdamczyk ! I'm sure this will attract a second reviewer soon!

@QuLogic
Copy link
Member

QuLogic commented Mar 14, 2018

The test should go in lib/matplotlib/tests/test_patches.py

@jklymak
Copy link
Member

jklymak commented Mar 14, 2018

Ooops, jeez. Good catch @QuLogic

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

Please put tests in proper file!

test set_alpha after update_from changes only alpha in color
this test is moved to lib/matplotlib/tests/test_patches.py
# given
source_facecolor = (0.234, 0.123, 0.135, 0.322)
source_egdecolor = (0.728, 0.682, 0.945, 0.268)
source = mpatches.Rectangle((0, 0), 1., 1., facecolor=source_facecolor, edgecolor=source_egdecolor)
Copy link
Member

Choose a reason for hiding this comment

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

Could you make this line and the one below 79 characters or less long by putting some of the arguments on the next line (and lining them up with the brackets?). Otherwise this looks good to go 👍

@jklymak jklymak dismissed their stale review April 8, 2018 15:05

stale

Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

A small typo. You also have some PEP8 errors.

def test_when_update_from_and_set_alpha_then_only_alpha_changes():
# given
source_facecolor = (0.234, 0.123, 0.135, 0.322)
source_egdecolor = (0.728, 0.682, 0.945, 0.268)
Copy link
Member

Choose a reason for hiding this comment

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

edgecolor

@tacaswell tacaswell removed this from the v3.0 milestone Jul 7, 2018
@tacaswell tacaswell added this to the v3.1 milestone Jul 7, 2018
@KonradAdamczyk
Copy link
Author

@dstansby can you approve request now ?

1 similar comment
@KonradAdamczyk
Copy link
Author

@dstansby can you approve request now ?

@jklymak
Copy link
Member

jklymak commented Aug 19, 2018

This still has flake8 errors...

https://travis-ci.org/matplotlib/matplotlib/jobs/410487655

@jklymak jklymak dismissed dstansby’s stale review August 19, 2018 17:19

stale review

@dstansby
Copy link
Member

dstansby commented Nov 3, 2018

I should have just fixed the PEP8 issues, lets see if travis agrees!

@anntzer
Copy link
Contributor

anntzer commented Nov 3, 2018

Looks equivalent to #11703 (the original bug reports #10575 and #11702 are the same), which has already been merged. Thanks for your PR, sorry it fell through the cracks.
Closing, but please ping for a reopen if I missed anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants