Skip to content

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

Closed
KonradAdamczyk wants to merge 9 commits into
matplotlib:masterfrom
KonradAdamczyk:patch-1
Closed

FIX patch.update_from to also copy _original_edge/facecolor#10575
KonradAdamczyk wants to merge 9 commits into
matplotlib:masterfrom
KonradAdamczyk:patch-1

Conversation

@KonradAdamczyk

@KonradAdamczyk KonradAdamczyk commented Feb 23, 2018

Copy link
Copy Markdown

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

@jklymak jklymak left a comment

Copy link
Copy Markdown
Member

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

jklymak commented Feb 24, 2018

Copy link
Copy Markdown
Member

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

jklymak commented Feb 25, 2018

Copy link
Copy Markdown
Member

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

jklymak commented Feb 27, 2018

Copy link
Copy Markdown
Member

@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
Copy Markdown
Author

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

@jklymak

jklymak commented Mar 7, 2018

Copy link
Copy Markdown
Member

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

@KonradAdamczyk

Copy link
Copy Markdown
Author

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

@jklymak

jklymak commented Mar 7, 2018

Copy link
Copy Markdown
Member

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

@jklymak

jklymak commented Mar 9, 2018

Copy link
Copy Markdown
Member

ping @KonradAdamczyk

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

jklymak commented Mar 14, 2018

Copy link
Copy Markdown
Member

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

@QuLogic

QuLogic commented Mar 14, 2018

Copy link
Copy Markdown
Member

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

@jklymak

jklymak commented Mar 14, 2018

Copy link
Copy Markdown
Member

Ooops, jeez. Good catch @QuLogic

@jklymak jklymak left a comment

Copy link
Copy Markdown
Member

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
Comment thread lib/matplotlib/tests/test_patches.py Outdated
# 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
Copy Markdown
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

@QuLogic QuLogic left a comment

Copy link
Copy Markdown
Member

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.

Comment thread lib/matplotlib/tests/test_patches.py Outdated
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
Copy Markdown
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
Copy Markdown
Author

@dstansby can you approve request now ?

1 similar comment
@KonradAdamczyk

Copy link
Copy Markdown
Author

@dstansby can you approve request now ?

@jklymak

jklymak commented Aug 19, 2018

Copy link
Copy Markdown
Member

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

dstansby commented Nov 3, 2018

Copy link
Copy Markdown
Member

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

@anntzer

anntzer commented Nov 3, 2018

Copy link
Copy Markdown
Contributor

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