Closed
Description
Bug report
Bug summary
Code for reproduction
boxplot([])
Actual outcome
Traceback (most recent call last):
File "<string>", line 4, in <module>
File "matplotlib/lib/matplotlib/pyplot.py", line 2452, in boxplot
is not None else {}))
File "matplotlib/lib/matplotlib/__init__.py", line 1517, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)
File "matplotlib/lib/matplotlib/axes/_axes.py", line 3521, in boxplot
labels=labels, autorange=autorange)
File "matplotlib/lib/matplotlib/cbook/__init__.py", line 1243, in boxplot_stats
X = _reshape_2D(X, "X")
File "matplotlib/lib/matplotlib/cbook/__init__.py", line 1419, in _reshape_2D
if X.ndim == 1 and not isinstance(X[0], collections.abc.Iterable):
IndexError: index 0 is out of bounds for axis 0 with size 0
Expected outcome
An empty plot.
Matplotlib version
This is a regression in master, which bisects to #11921. Attn @jklymak
- Operating system: linux
- Matplotlib version: master
- Matplotlib backend (
print(matplotlib.get_backend())
): irrelevant - Python version: 3.7
- Jupyter version (if applicable): none
- Other libraries:
Thanks to @hershen for noticing this in https://github.com/matplotlib/matplotlib/pull/13368/files#r254847320.