Description
Bug summary
The documentation for https://matplotlib.org/stable/api/_as_gen/matplotlib.patches.Patch.html mentions that 'auto' can be designated as an option for edgecolor, but when I try, it doesn't appear to work appropriately.
Code for reproduction
import matplotlib.pyplot as plt
import matplotlib.patches as patches
_, ax = plt.subplots()
patch = patches.Rectangle([0.25,0.25], 0.25, 0.25, fill=None)
patch.set_edgecolor('auto')
ax.add_patch(patch)
plt.show()
### Actual outcome
ValueError Traceback (most recent call last)
in
4 _, ax = plt.subplots()
5 patch = patches.Rectangle([0.25,0.25], 0.25, 0.25, fill=None)
----> 6 patch.set_edgecolor('auto')
7 ax.add_patch(patch)
8 plt.show()
~/.local/lib/python3.8/site-packages/matplotlib/patches.py in set_edgecolor(self, color)
335 """
336 self._original_edgecolor = color
--> 337 self._set_edgecolor(color)
338
339 def _set_facecolor(self, color):
~/.local/lib/python3.8/site-packages/matplotlib/patches.py in _set_edgecolor(self, color)
321 set_hatch_color = False
322
--> 323 self._edgecolor = colors.to_rgba(color, self._alpha)
324 if set_hatch_color:
325 self._hatch_color = self._edgecolor
~/.local/lib/python3.8/site-packages/matplotlib/colors.py in to_rgba(c, alpha)
187 rgba = None
188 if rgba is None: # Suppress exception chaining of cache lookup failure.
--> 189 rgba = _to_rgba_no_colorcycle(c, alpha)
190 try:
191 _colors_full_map.cache[c, alpha] = rgba
~/.local/lib/python3.8/site-packages/matplotlib/colors.py in _to_rgba_no_colorcycle(c, alpha)
258 f"Value must be within 0-1 range")
259 return c, c, c, alpha if alpha is not None else 1.
--> 260 raise ValueError(f"Invalid RGBA argument: {orig_c!r}")
261 # tuple color.
262 if not np.iterable(c):
ValueError: Invalid RGBA argument: 'auto'
### Expected outcome
I would expect 'auto' to randomly assign a color to each of the patch edges.
### Operating system
Linux
### Matplotlib Version
3.3.3
### Matplotlib Backend
module://ipykernel.pylab.backend_inline
### Python version
3.8.11
### Jupyter version
6.1.6
### Other libraries
_No response_
### Installation
conda
### Conda channel
fastchan (or maybe default)