-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Histogram of list of datetimes #11899
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
Your example is nt quite complete, so maybe I'm doing something wrong, but for from matplotlib import pyplot as plt
import datetime
n, x = plt.hist([datetime.datetime(2018,1,1), datetime.datetime(2018, 2, 1),
datetime.datetime(2018,3, 1)]) on 2.1.2 I get
So I don't think it worked on 2.1.2 either. |
Thanks for the fast feedback! Code variant with assigning output to variables: from matplotlib import pyplot as plt
from datetime import datetime
n, x, p = plt.hist([datetime(2018,1,1), datetime(2018, 2, 1), datetime(2018,3, 1)])
print(n) Output in 2.12 is: Output in 2.2.3 is: |
@jklymak have i been able to clarify your questions? Greetings! |
This bisects to c02a84d "Correctly convert units for a stacked histogram" @dstansby #9654 Obviously this works for floats, so the issue is that your data is not floats. I guess this used to work before, but whether or not it really should have is debatable. What should
return? It looks like the reason datetime worked at all is that it has a |
To be able to create a histogram from a list of datetimes seems pretty beneficial to me.
In contrast to dates, i haven't that often tried to create histograms of strings, .... π |
This just caused plotting a 70MB file to explode to over 50GB of memory for me, quite surprising that I can't plot a histogram of datetimes. Edit: The fix: Also try histtype='step' if it's slow to render |
This should be fixed on master... |
Awesome! I'm on a pretty old version, so I'll leave the explicit conversion for now |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug summary
When creating a histogram of a list of datetimes, the input seems to be interpreted as a sequency of arrays.
Code for reproduction
Actual outcome
Output of n is a list of arrays, indicating that the input dates are interpreted as a sequence of arrays.
Output of matplotlib version 2.2.0, 2.2.2 and 2.2.3
Expected outcome
This worked in matplotlib version 2.1.2
Matplotlib version
print(matplotlib.get_backend())
): aggThe text was updated successfully, but these errors were encountered: