-
Notifications
You must be signed in to change notification settings - Fork 389
change LineString facecolor to None #1790
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -753,6 +753,25 @@ def add_geometries(self, geoms, crs, **kwargs): | |||||||
|
|
||||||||
| """ | ||||||||
| styler = kwargs.pop('styler', None) | ||||||||
|
|
||||||||
| if (not callable(styler)) and ('facecolor' not in kwargs): | ||||||||
smartlixx marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| styler_kw = styler | ||||||||
|
|
||||||||
| def styler(geom): | ||||||||
| styler_g = styler_kw if styler_kw else dict() | ||||||||
| styler_g = styler_g.copy() | ||||||||
smartlixx marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
|
|
||||||||
| if isinstance(geom, sgeom.LineString): | ||||||||
| styler_g['facecolor'] = 'none' | ||||||||
| if ('edgecolor' not in kwargs) or ( | ||||||||
| kwargs['edgecolor'] == 'face'): | ||||||||
|
||||||||
| 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?
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
stylerhere? You can pass a callable that updates the color that way. You might be able to put theisinstancecheck 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)
facecoloris not set, otherwise we should assume the user wants to fill the LineString by explicitly specifyingfacecolor.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 stylerin 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.