-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: OverflowError when plotting with sharex=True #40470
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
Hi @shaharkadmiel, thanks for the report! I can reproduce this on current master - based on the traceback it is possible this is a matplotlib issue as well. Investigations welcome! |
This works: fig, (ax1, ax2) = plt.subplots(2, sharex=True)
fig.subplots_adjust(0, 0, 1, 1, hspace=0.15)
ax1.plot(df1.index, df1.x1)
ax2.plot(df2.index, df2.x2) So I am not so sure this is a matplotlib issue. |
Hi, I got the same error and have investigated it. works properly with pandas API, like this fig, (ax1, ax2) = plt.subplots(2, sharex=False)
fig.subplots_adjust(0, 0, 1, 1, hspace=0.15)
df1.x1.plot(ax=ax1, legend=False, sharex=True)
df2.x2.plot(ax=ax2, legend=False, sharex=True) versions
|
This is due to the same underlying issue as #52895 |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
I have two datasets from different sources. They span more or less the same time, contain different data, sampled at different rate.
I am trying to plot these on two subplots with a shared x axis.
Making sample data:
Minimal plotting example:
I get
OverflowError
and a very long traceback but I think the problem is how thesharex=True
is handled. When I setsharex=False
, the error goes away and it plots fine but unaligned.Output of
pd.show_versions()
I get
ImportError: Can't determine version for pip
But:
Pandas: 1.2.3
Matplotlib: 3.3.2
[paste the output of
pd.show_versions()
here leaving a blank line after the details tag]The text was updated successfully, but these errors were encountered: