You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Another solution to that might be to have a flag on the feature that says "these are edges" and override set_color to only set the edgecolor in that case. This would make us more consistent with LineCollection which will still allow you to explicitly set facecolor if you really want. This might also work as a solution for #1782 - though there we probably need to account for some geometries being edges and some not.
I just ran into this again where I wanted to use the new Choropleth style feature artist on a collection of LineStrings to automatically color them based on value and my linestrings weren't showing up because they need to be colored by edges and it apparently also doesn't work to pass in edgecolors=array, so I don't see a way to currently workaround this without fixing the underlying issue.
Thanks @rcomer! I was missing the facecolor="none" and now it works as expected. We do have a PR potentially trying to automatically do this for users too it looks like: #1790
Something to automate this for Line-like geometries would be nice from a user perspective ;)
import matplotlib.pyplot as plt
import numpy as np
import cartopy
import shapely
x = np.arange(10)
lines = [shapely.LineString([(i, 0), (i + 10, 10)]) for i in range(10)]
ax = plt.subplot(111, projection=cartopy.crs.PlateCarree())
ax.add_geometries(lines, cartopy.crs.PlateCarree(), facecolor="none", array=x, cmap='viridis')
ax.coastlines()
ax.set_extent([0, 20, 0, 20])
plt.show()
Another solution to that might be to have a flag on the feature that says "these are edges" and override
set_color
to only set the edgecolor in that case. This would make us more consistent with LineCollection which will still allow you to explicitly set facecolor if you really want. This might also work as a solution for #1782 - though there we probably need to account for some geometries being edges and some not.Originally posted by @rcomer in #2323 (comment)
I have been meaning to work on this but not got around to it so creating an issue before I forget completely!
The text was updated successfully, but these errors were encountered: