[Bug]: Legend fails for bar plot with numeric label #26824
Labels
Release critical
For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
status: confirmed bug
Milestone
Bug summary
It seems a bug was introduced in Matplotlib 3.8, in which numeric labels for bar charts are no longer getting converted to strings. When trying to add a legend, this causes an
AttributeError: 'int' object has no attribute 'startswith'
.Code for reproduction
Actual outcome
Expected outcome
Legend should work and show "1" as the label (as it did in Matplotlib 3.7).
Additional information
plt.bar()
that's affected;plt.plot()
for example works fine.label=str(1)
) prevents the error.startswith
conditional.Operating system
Ubuntu
Matplotlib Version
3.8.0
Matplotlib Backend
Qt5Agg
Python version
3.11.3
Jupyter version
No response
Installation
conda
The text was updated successfully, but these errors were encountered: