-
Notifications
You must be signed in to change notification settings - Fork 51
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
scale_x_datetime(): error building plot for early dates #346
Comments
I'm having the same issue with First the setup: from lets_plot import *
import pandas as pd
presidential = pd.read_csv("https://vincentarelbundock.github.io/Rdatasets/csv/ggplot2/presidential.csv", index_col=0)
presidential = presidential.astype({"start": "datetime64[ns]", "end": "datetime64[ns]"})
presidential["id"] = 33 + presidential.index Note that the data are:
Now the following code, with only the last few entries (shorter time span) included, works: (
ggplot(presidential.iloc[-5:], aes(x="start", y="id")) +
geom_point() +
geom_segment(aes(xend="end", yend="id")) +
scale_x_datetime(breaks=presidential["start"], format="%Y")
) But the full dataset, (
ggplot(presidential, aes(x="start", y="id")) +
geom_point() +
geom_segment(aes(xend="end", yend="id")) +
scale_x_datetime(breaks=presidential["start"], format="%Y")
) Produces an error:
|
Unfortunately, at the moment the earliest date scale datetime can handle is 1.1.1970 @aeturrell, a relatively easy workaround in your case would be to extract year from dates and add "year" as a numeric column to the dataset. |
integer formatting is just "d", sorry. |
Woop! Thanks so much! |
Look at the following example:
Here we get:
If we remove the scale, it works:
If we remove the earliest date, it works again:
The text was updated successfully, but these errors were encountered: