-
Notifications
You must be signed in to change notification settings - Fork 368
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
change LineString facecolor to None #1790
base: main
Are you sure you want to change the base?
Conversation
f63b366
to
ab2ed83
Compare
ab2ed83
to
7e7a90d
Compare
7e7a90d
to
2cce13d
Compare
@@ -753,6 +753,20 @@ def add_geometries(self, geoms, crs, **kwargs): | |||
|
|||
""" | |||
styler = kwargs.pop('styler', 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.
What about updating the styler
here? You can pass a callable that updates the color that way. You might be able to put the isinstance
check in that way and it would act on each geometry then.
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.
OK. But maybe it should be clarified that we only do styler update for LineString when
(1) styler is not set (None
); or
(2) facecolor
is not set, otherwise we should assume the user wants to fill the LineString by explicitly specifying facecolor
.
And, what if user passes a callable to styler?
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 agree with all of that. If a user passes a callable for styler then this should have no effect. You could probably add an if callable(styler): return styler
in there somewhere.
This should also get some tests to make sure it is covering those cases you mentioned and that we are taking the right paths.
951a720
to
6eb951b
Compare
lib/cartopy/mpl/geoaxes.py
Outdated
if ('edgecolor' not in kwargs) or ( | ||
kwargs['edgecolor'] == 'face'): |
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.
if ('edgecolor' not in kwargs) or ( | |
kwargs['edgecolor'] == 'face'): | |
if kwargs.get('edgecolor', 'face') == 'face': |
But why would 'face'
mean patch edgecolor?
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.
Because edgecolor = face
means using facecolor
value for edge. This suggests the user specifies facecolor, and would like to fill the LineString.
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 almost tempted to raise here. Why are we allowing a linestring to be filled at all?
Co-authored-by: Elliott Sales de Andrade <[email protected]>
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.
It has been a while since I looked at this, but it looks like it still needs tests.
lib/cartopy/mpl/geoaxes.py
Outdated
if ('edgecolor' not in kwargs) or ( | ||
kwargs['edgecolor'] == 'face'): |
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 almost tempted to raise here. Why are we allowing a linestring to be filled at all?
Co-authored-by: Elliott Sales de Andrade <[email protected]>
0f532d6
to
1964e12
Compare
Before I move on, I have to address the current test error, which I have no clue how to address. Any help would be appreciated.
|
I think the problem is that the sentinel isn't callable, so then we go into your if clause and build up the dictionary instead. If you are able to make new tests that test all of the various paths, then you can probably replace this test, or you could potentially change it to a >>> import unittest.mock
>>> callable(unittest.mock.sentinel)
False
>>> callable(unittest.mock.Mock())
True |
|
Rationale
close #1782 by changing LineString geometries facecolor to None.
Implications