-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Conversation
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. |
There's also markeredgecolor (#8109). Could you also take care of it? |
Sure, I am just trying to figure out the reason behind the tests failing before making anymore changes |
@tacaswell the fixes seem to pass both travis and appveyor now |
👍 Can you add a note in https://github.com/matplotlib/matplotlib/tree/master/doc/users/whats_new and add these values to https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/mpl-data/stylelib/classic.mplstyle ? |
Done! |
On consideration, this should have a test.
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 |
@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 |
There was a problem hiding this comment.
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 :)
Assuming they pass, yes 👍 |
Great 👍 |
There was a problem hiding this 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 | ||
---------------------------------------------------------------------- |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
lib/matplotlib/lines.py
Outdated
@@ -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': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rcParams['lines.markerfacecolor'] != 'none'
lib/matplotlib/lines.py
Outdated
@@ -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': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
I used no color as a default to be able to tell if the user has specified a value for the rcParam value. 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 |
6b3f521
to
708c44f
Compare
@QuLogic your suggestions were implemented. I think this should be good now unless anyone else has some suggestions? |
It seems okay, except I'm still confused about the semantics, though maybe I'm just mistaken about how rcParam defaults work. @tacaswell? |
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? |
Yes 'none' is a valid color meaning "no color" (which is different than None). The default values should be the current default value. |
There was a problem hiding this 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.
@kalagau Sorry this sat so long! Are you still interested in working on this? |
d1ca0d4
to
9b4dcf5
Compare
@tacaswell I have updated the PR. Assuming all tests pass, I feel that this should be fine now? |
9b4dcf5
to
1d9880c
Compare
I am not sure why Travis CI failed? |
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. |
@jklymak I just refreshed my review. Based on my reading of the latest changes, the comments that @tacaswell provided have been addressed. |
@jklymak is there anything else we are waiting for? |
I think the contributor has addressed concerns, and this has sat a long time.
Thanks a lot for your patience and PR @kalagau! |
Which matplotlib version contains/will contain this? |
3.0 |
PR for issue #3293 and #8109 as well as suggested by @anntzer