-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DateParseError on bar plot #8803
Comments
cc @onesandzeroes @vfilimonov hmm, can you tell if this is coming from matplotlib or pandas? (e.g. I don't think pandas knows that it is multiple plotting). |
It are series, so they are plotting on the current existing (so in this case the same) axis. I think the reason for the error is (simplified) that they are plotted differently: |
Right, its difference in plotting, and xvalues for these plots are different:
results in
results in |
@vfilimonov what version of matplotlib are you using? I don't get a ValueError, but the scale is off. |
As far as a solution, I'm going to hopefully be cleaning up a bunch of DatetimeIndex plotting stuff soon. |
My matplotlib's version is 1.4.1 I get ValueError if I plot |
This is still a bit borked. The first example works correctly now, but the reverse order plotting is not correct (it is still a bar plot after the second |
@wabu I can not reproduce what you are saying. While I don't get an error I don't see the expected behaviour, running the example provided above: While there is no error, I expect to see both the line and the bar chart. Maybe there has been an improvement in the latest releases? I am running pandas 0.23.1 right now. I had a look into the code and I assume the core problem is in line https://github.com/pandas-dev/pandas/blob/master/pandas/plotting/_core.py#L1197 So the x axis of a bar chart is just enumerated instead of keeping the actual scale. This is useful especially if the index of The best I could come up with, to join a multicolumn DataFrame bar plot with a line plot is to rescale the line plot to match the enumeration of the bar chart. df = pd.DataFrame({'a':[4,2,1,3,5], 'b':[4,5,2,3,1]}, index=pd.to_datetime(['2004','2005','2006','2007','2008']))
ax = df.plot(kind='bar')
ax.plot(np.arange(len(df)), df.a, 'g') So I guess we need to handle data with a |
DateParseError
is raised when Series with DateTimeIndex is plotted using bar-plot on axis that already contains another plot:Both of plots work independently, but being called one after another they result in
DateParseError: day is out of range for month
If called in different order:
exception is not raised, but x-axis scale is incorrect
pandas version: 0.15.1
numpy verson: 1.9.1
The text was updated successfully, but these errors were encountered: