Skip to content

Commit 951a720

Browse files
committed
update styler to only modify LineString
1 parent 2cce13d commit 951a720

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

lib/cartopy/mpl/geoaxes.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -752,21 +752,19 @@ def add_geometries(self, geoms, crs, **kwargs):
752752
753753
754754
"""
755-
styler = kwargs.pop('styler', None)
756-
has_LineString = False
757-
try:
758-
for g in iter(tuple(geoms)):
759-
if isinstance(g, sgeom.LineString):
760-
has_LineString = True
761-
break
762-
except TypeError:
763-
if isinstance(geoms, sgeom.LineString):
764-
has_LineString = True
765-
766-
if has_LineString:
767-
kwargs['facecolor'] = 'none'
768-
if 'edgecolor' not in kwargs or kwargs['edgecolor'] == 'face':
769-
kwargs['edgecolor'] = mpl.rcParams['patch.edgecolor']
755+
styler_kw = kwargs.pop('styler', None)
756+
757+
def styler(geom):
758+
styler_g = styler_kw if styler_kw else dict()
759+
styler_g = styler_g.copy()
760+
761+
if isinstance(geom, sgeom.LineString):
762+
styler_g['facecolor'] = 'none'
763+
if ('edgecolor' not in styler_g) or (styler_g['edgecolor'] ==
764+
'face'):
765+
styler_g['edgecolor'] = mpl.rcParams['patch.edgecolor']
766+
return styler_g
767+
770768
feature = cartopy.feature.ShapelyFeature(geoms, crs, **kwargs)
771769
return self.add_feature(feature, styler=styler)
772770

0 commit comments

Comments
 (0)