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

Appearance settings

FIX markerfacecolor / mfc not in rcparams #8479

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

Merged
merged 1 commit into from
Mar 26, 2018

Conversation

kalagau
Copy link
Contributor

@kalagau kalagau commented Apr 13, 2017

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
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
Copy link
Contributor

anntzer commented Apr 15, 2017

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

@kalagau
Copy link
Contributor Author

kalagau commented Apr 15, 2017

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

@kalagau
Copy link
Contributor Author

kalagau commented Apr 15, 2017

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

@tacaswell
Copy link
Member

@kalagau
Copy link
Contributor Author

kalagau commented Apr 16, 2017

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
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
Copy link
Contributor Author

kalagau commented Apr 17, 2017

@tacaswell will these do?

@@ -210,6 +210,19 @@ def test_legend_colors(color_type, param_dict, target):
leg = ax.legend()
assert getattr(leg.legendPatch, get_func)() == target

@cleanup
Copy link
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
Member

Assuming they pass, yes 👍

@kalagau
Copy link
Contributor Author

kalagau commented Apr 17, 2017

Great 👍

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.

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
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.
Copy link
Member

@QuLogic QuLogic Apr 18, 2017

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.

@@ -339,6 +339,10 @@ def __init__(self, xdata, ydata,
linestyle = rcParams['lines.linestyle']
if marker is None:
marker = rcParams['lines.marker']
if markerfacecolor is None and not rcParams['lines.markerfacecolor'] == 'none':
Copy link
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'

@@ -339,6 +339,10 @@ def __init__(self, xdata, ydata,
linestyle = rcParams['lines.linestyle']
if marker is None:
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
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
Copy link
Contributor Author

kalagau commented Apr 18, 2017

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
Copy link
Contributor Author

kalagau commented Apr 19, 2017

@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
Copy link
Member

QuLogic commented Apr 29, 2017

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

@kalagau
Copy link
Contributor Author

kalagau commented Apr 30, 2017

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

Copy link
Member

@tacaswell tacaswell left a comment

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
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
Copy link
Contributor Author

kalagau commented Mar 12, 2018

@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
Copy link
Contributor Author

kalagau commented Mar 12, 2018

I am not sure why Travis CI failed?

@jklymak
Copy link
Member

jklymak commented Mar 14, 2018

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
Copy link
Member

phobson commented Mar 19, 2018

@jklymak I just refreshed my review.

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

@kalagau
Copy link
Contributor Author

kalagau commented Mar 26, 2018

@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
Copy link
Member

jklymak commented Mar 26, 2018

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

Which matplotlib version contains/will contain this?

@jklymak
Copy link
Member

jklymak commented May 18, 2018

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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.