From 2cce13df9afa30c7a9e47cd6d55ff32ea09e5ee9 Mon Sep 17 00:00:00 2001 From: Xianxiang Li Date: Mon, 17 May 2021 20:00:04 +0800 Subject: [PATCH] close cartopy#1782, change LineString facecolor to None --- lib/cartopy/mpl/geoaxes.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/cartopy/mpl/geoaxes.py b/lib/cartopy/mpl/geoaxes.py index 0152301e1..b10bc0019 100644 --- a/lib/cartopy/mpl/geoaxes.py +++ b/lib/cartopy/mpl/geoaxes.py @@ -753,6 +753,20 @@ def add_geometries(self, geoms, crs, **kwargs): """ styler = kwargs.pop('styler', None) + has_LineString = False + try: + for g in iter(tuple(geoms)): + if isinstance(g, sgeom.LineString): + has_LineString = True + break + except TypeError: + if isinstance(geoms, sgeom.LineString): + has_LineString = True + + if has_LineString: + kwargs['facecolor'] = 'none' + if 'edgecolor' not in kwargs or kwargs['edgecolor'] == 'face': + kwargs['edgecolor'] = mpl.rcParams['patch.edgecolor'] feature = cartopy.feature.ShapelyFeature(geoms, crs, **kwargs) return self.add_feature(feature, styler=styler)