Skip to content

FIX markerfacecolor / mfc not in rcparams - #8479

Merged
jklymak merged 1 commit into
matplotlib:masterfrom
kalagau:TeamDoItTomorrow3923
Mar 26, 2018
Merged

jklymak merged 1 commit into
matplotlib:masterfrom
kalagau:TeamDoItTomorrow3923

Conversation

@kalagau

@kalagau kalagau commented Apr 13, 2017 •

Copy link
Copy Markdown
Contributor

PR for issue #3293 and #8109 as well as suggested by @anntzer

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Apr 14, 2017
@tacaswell

Copy link
Copy Markdown
Member

The test failures look real, can you reproduce them locally?

https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/tests/baseline_images/test_artist/default_edges.png that is the test that is changed.

@anntzer

anntzer commented Apr 15, 2017

Copy link
Copy Markdown
Contributor

There's also markeredgecolor (#8109). Could you also take care of it?

@kalagau

kalagau commented Apr 15, 2017

Copy link
Copy Markdown
Contributor Author

Sure, I am just trying to figure out the reason behind the tests failing before making anymore changes

@kalagau

kalagau commented Apr 15, 2017

Copy link
Copy Markdown
Contributor Author

@tacaswell the fixes seem to pass both travis and appveyor now

@tacaswell

Copy link
Copy Markdown
Member

@kalagau

kalagau commented Apr 16, 2017

Copy link
Copy Markdown
Contributor Author

Done!

tacaswell
tacaswell previously approved these changes Apr 16, 2017
@tacaswell
tacaswell dismissed their stale review April 16, 2017 23:35

On consideration, this should have a test.

@tacaswell

Copy link
Copy Markdown
Member

Sorry, one more thing, could you add a test? Something like

def test_mfc_rcparams():

    rcParams['line.markerfacecolor'] = 'red'
    ln = Line2D([1, 2], [1, 2])
    assert ln.get_markerfacecolor() == matplotlib.colors.to_rgba('red')

and so-on for the two rcparams added here.

I suggest putting this test in test_lines or test_rcparams.

@kalagau

kalagau commented Apr 17, 2017

Copy link
Copy Markdown
Contributor Author

@tacaswell will these do?

Comment thread lib/matplotlib/tests/test_rcparams.py Outdated
leg = ax.legend()
assert getattr(leg.legendPatch, get_func)() == target

@cleanup

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.

Don't need cleanup anymore on master :)

@tacaswell

Copy link
Copy Markdown
Member

Assuming they pass, yes 👍

@kalagau

kalagau commented Apr 17, 2017

Copy link
Copy Markdown
Contributor Author

Great 👍

@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.

I'm a bit confused about the semantics. Usually, when we use 'none' it means no colour, but it appears that this is treating that as default colour. Have I understood this incorrectly?

Also, when this is complete, can you squash this?

@@ -0,0 +1,14 @@
New rcParams added
----------------------------------------------------------------------

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.

Trim dashes to text length.


* 'lines.markerfacecolor' allows users to set the default markerfacecolor for line plots
* 'lines.markeredgecolor' allows users to set the default markeredgecolor for line plots
The Default color is set to none, and these rcParams are only used if the line does not have any value specifed for these params.

@QuLogic QuLogic Apr 18, 2017 •

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 wrap at 80 here as well. This line looks like it should not be part of the previous bullet point, so add a new line above it.

Comment thread lib/matplotlib/lines.py Outdated
linestyle = rcParams['lines.linestyle']
if marker is None:
marker = rcParams['lines.marker']
if markerfacecolor is None and not rcParams['lines.markerfacecolor'] == 'none':

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.

rcParams['lines.markerfacecolor'] != 'none'

Comment thread lib/matplotlib/lines.py Outdated
marker = rcParams['lines.marker']
if markerfacecolor is None and not rcParams['lines.markerfacecolor'] == 'none':
markerfacecolor = rcParams['lines.markerfacecolor']
if markeredgecolor is None and not rcParams['lines.markeredgecolor'] == 'none':

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.

Same as above.

@kalagau

kalagau commented Apr 18, 2017 •

Copy link
Copy Markdown
Contributor Author

I used no color as a default to be able to tell if the user has specified a value for the rcParam value.
Previously I had a check like:
if markerfacecolor is None
markerfacecolor = rcParams['lines.markerfacecolor']

with the default rcParams['lines.markerfacecolor'] set to 'b'

But this would interfere with the tests. because it would replace the markerfacecolor with the default value, which I had initially set to blue

@kalagau
kalagau force-pushed the TeamDoItTomorrow3923 branch 2 times, most recently from 6b3f521 to 708c44f Compare April 18, 2017 22:21
@kalagau

kalagau commented Apr 19, 2017

Copy link
Copy Markdown
Contributor Author

@QuLogic your suggestions were implemented. I think this should be good now unless anyone else has some suggestions?

@kalagau kalagau changed the title FIX markerfacecolor / mfc not in rcparams [MRG+1] FIX markerfacecolor / mfc not in rcparams Apr 23, 2017
@QuLogic

QuLogic commented Apr 29, 2017

Copy link
Copy Markdown
Member

It seems okay, except I'm still confused about the semantics, though maybe I'm just mistaken about how rcParam defaults work. @tacaswell?

@kalagau

kalagau commented Apr 30, 2017

Copy link
Copy Markdown
Contributor Author

By initially setting the rcParam to 'none', what essentially ends up happening is that the line gets drawn the same way when the user does not specify the color.

I think what you were perhaps implying before is that 'none' is a color option where no color is filled and by selecting that as a default I perhaps take away the user option to use that?

@tacaswell

Copy link
Copy Markdown
Member

I think what you were perhaps implying before is that 'none' is a color option where no color is filled and by selecting that as a default I perhaps take away the user option to use that?

Yes 'none' is a valid color meaning "no color" (which is different than None). The default values should be the current default value.

@tacaswell tacaswell 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.

The default value should not be special cased where used, it should instead be set to the current default value.

@tacaswell

Copy link
Copy Markdown
Member

@kalagau Sorry this sat so long! Are you still interested in working on this?

@tacaswell tacaswell modified the milestones: 2.2 (next next feature release), 2.1 (next point release) Aug 10, 2017
@kalagau

kalagau commented Mar 12, 2018

Copy link
Copy Markdown
Contributor Author

@tacaswell I have updated the PR. Assuming all tests pass, I feel that this should be fine now?

@kalagau
kalagau force-pushed the TeamDoItTomorrow3923 branch from 9b4dcf5 to 1d9880c Compare March 12, 2018 09:40
@kalagau

kalagau commented Mar 12, 2018

Copy link
Copy Markdown
Contributor Author

I am not sure why Travis CI failed?

@jklymak

jklymak commented Mar 14, 2018

Copy link
Copy Markdown
Member

We had some test failures with OS X. The CI is clean.

I'm not merging yet because @phobson 's review is quite stale. It'd be nice to have a more recent review, and marking as such. @tacaswell is quite busy, so may dismiss his review if there is other support for this.

@phobson

phobson commented Mar 19, 2018

Copy link
Copy Markdown
Member

@jklymak I just refreshed my review.

Based on my reading of the latest changes, the comments that @tacaswell provided have been addressed.

@kalagau

kalagau commented Mar 26, 2018

Copy link
Copy Markdown
Contributor Author

@jklymak is there anything else we are waiting for?

@jklymak
jklymak dismissed tacaswell’s stale review March 26, 2018 21:18

I think the contributor has addressed concerns, and this has sat a long time.

@jklymak
jklymak merged commit 912f9b6 into matplotlib:master Mar 26, 2018
@jklymak

jklymak commented Mar 26, 2018

Copy link
Copy Markdown
Member

Thanks a lot for your patience and PR @kalagau!

@QuLogic QuLogic modified the milestones: needs sorting, v3.0 Mar 26, 2018
@QuLogic QuLogic changed the title [MRG+1] FIX markerfacecolor / mfc not in rcparams FIX markerfacecolor / mfc not in rcparams Mar 26, 2018
@carstenbauer

Copy link
Copy Markdown

Which matplotlib version contains/will contain this?

@jklymak

jklymak commented May 18, 2018

Copy link
Copy Markdown
Member

3.0

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants