SciTools / cartopy

Cartopy - a cartographic python library with matplotlib support
https://scitools.org.uk/cartopy/docs/latest
BSD 3-Clause "New" or "Revised" License
1.42k stars 363 forks source link

Default styler fills LineStrings #1782

Open kdpenner opened 3 years ago

kdpenner commented 3 years ago

Description

Default styler fills LineStrings. IMO this behavior is unexpected; I expect LineStrings to be plotted as line strings. The workaround is to set edgecolor and facecolor.

Code to reproduce

from shapely.geometry import LineString
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

geoms = [LineString([(-40, 10), (-30, 15), (-30, 20)]),
         LineString([(-40, -10), (-30, -15), (-30, -20)])]

robin = ccrs.Robinson()

fig = plt.figure(figsize=(10, 7))
ax = fig.add_subplot(1, 1, 1, projection=robin)
ax.add_geometries(geoms, crs=ccrs.PlateCarree())
ax.coastlines()
plt.show()

t

greglucas commented 3 years ago

I agree with you, I thought there were some other issues mentioning this brought up a while ago, but I can't find them now. It doesn't seem like it would be too hard to change the defaults around with an isinstance(LineString) check when adding features.