-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
TypeError when plotting stacked bar chart with decimal #10788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
First, this can be made even simpler: from decimal import Decimal
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
x = [Decimal(x) for x in range(10)]
y = [Decimal(x) for x in range(10)]
bar1 = ax.bar(x, y) yields:
The problem is that we have to do some math on We can't just force it to float, because other values of x need not be floats (i.e. datetime, categorical). A possible solution is to write a unit converter for |
This also affects
yields
But it works fine using Matplotlib version 2.1.2 |
@Stigjb Your issue is different. You are trying to plot In case you want matplotlib to add support for |
Bug report
Bug summary
When plotting bar graph, TypeError exception is raised if values for bar bases are Decimal types.
Code for reproduction
Actual outcome
Expected outcome
No exception is raised, bar2 line behaves the same way it would if y contained ints or floats.
Matplotlib version
python installed via pyenv, matplotlib via pip
The text was updated successfully, but these errors were encountered: