-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Labels
API: consistencyDifficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuestopic: collections and mappablestopic: color/color & colormaps
Milestone
Description
Bug summary
LineCollection doesn't have a get_gapcolor
or set_gapcolor
, so gapcolor doesn't work in plotting methods that return LineCollections (like vlines or hlines).
Code for reproduction
fig, ax = plt.subplots(figsize=(1,1))
ax.vlines([.25, .75], 0, 1, linestyle=':', gapcolor='orange')
Actual outcome
File ~\miniconda3\envs\prop\lib\site-packages\matplotlib\artist.py:1186, in Artist._internal_update(self, kwargs)
-> 1186 return self._update_props(
1187 kwargs, "{cls.__name__}.set() got an unexpected keyword argument "
1188 "{prop_name!r}")
AttributeError: LineCollection.set() got an unexpected keyword argument 'gapcolor'
Expected outcome
Additional information
I think the easiest fix is probably add set_color
and get_color
to LineCollection, modeled on get_color
and set_color
matplotlib/lib/matplotlib/collections.py
Lines 1463 to 1481 in 5093150
def set_color(self, c): | |
""" | |
Set the edgecolor(s) of the LineCollection. | |
Parameters | |
---------- | |
c : color or list of colors | |
Single color (all lines have same color), or a | |
sequence of RGBA tuples; if it is a sequence the lines will | |
cycle through the sequence. | |
""" | |
self.set_edgecolor(c) | |
set_colors = set_color | |
def get_color(self): | |
return self._edgecolors | |
get_colors = get_color # for compatibility with old versions |
Matplotlib Version
3.7.0.dev1121+g509315008c
rcomer
Metadata
Metadata
Assignees
Labels
API: consistencyDifficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuestopic: collections and mappablestopic: color/color & colormaps