Closed
Description
Bug report
Bug summary
Currently calling stairs
with no values and a single edge crashes with an AttributeError.
Code for reproduction
from pylab import *; stairs([], [0])
Actual outcome
AttributeError: 'StepPatch' object has no attribute '_path'
Expected outcome
The zero-value, single-edge case can occur naturally when using stairs to plot piecewise-constant functions (rather than pre-binned histograms), and it would seem reasonable to simply be a no-op in that case (except for adjusting the xlims to include the edge position (just like plot([0], [0])
effectively draws nothing but adjusts the data limits).
Even if we decide that we really do not want to support this case (I would disagree with such a choice), we should at least error out cleanly rather than with an obscure AttributeError.
Matplotlib version
- Operating system:
- Matplotlib version: master
- Matplotlib backend (
print(matplotlib.get_backend())
): - Python version:
- Jupyter version (if applicable):
- Other libraries:
Metadata
Metadata
Assignees
Labels
No labels