-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
time series plotting gap causes strange jump #16266
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
You will get faster turnaround on this if you can provide something more minimal with a data set you can type out rather than providing it as a zip file. In producing that minimal example you may discover the specific problem and narrow down if the problem is in matplotlib or your data. Even better would be to not require pandas. Thanks! |
There are some NaT rows in your dataset. I guess old pandas (which I don't have around) would convert these to some nonsensical value when using toordinal() (which is what we use internally in dates._to_ordinalf); pandas 1.0(pre) now raises a ValueError here. I guess we could detect NaT and convert it to nan here... (pandas-dev/pandas#10372?) Edit: Actually I think the change is due to pandas-dev/pandas#18720. |
Fixing the offending NaT fixed the issue. I guess the real bug here is that neither pandas nor mpl threw an error for an invalid value and just attempted to finish what it started no matter what. |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
I am comfortable leaving this closed as it was fixed upstream by pandas. |
Bug report
Gap in time series data causes MPL to jump to a very small datetime that doesnt exist in the dataset.

If I don't manually set the axis, it tries to autofit.
Autofitting looks like this:

Note that the minimum x datetime in the dataset is in 2019! Not sure where the 1680ish time comes from. I've manually checked what actually gets passed into mpl, a numpy object array of datetime objects, does not have a time value below 2019.
Abbreviated code:
temps.zip
Matplotlib version
Operating system: debian (raspbian)
Matplotlib version: 3.1.2 , in a venv, installed by pip
Matplotlib backend (
print(matplotlib.get_backend())
): aggPython version: 3.7
Other libraries: pandas, Pillow
The text was updated successfully, but these errors were encountered: