Skip to content
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

Date labels missing #42

Closed
nprihodko opened this issue May 9, 2024 · 1 comment
Closed

Date labels missing #42

nprihodko opened this issue May 9, 2024 · 1 comment
Labels

Comments

@nprihodko
Copy link

After updating plotnine from 0.12.4 to 0.13.5 (this also triggers mizani update from 0.9.3 to 0.11.2) date labels stopped working.

Seems like it breaks when there are more than 3 observations (but maybe there are also other conditions).

All good:

import pandas as pd
from plotnine import *


plot_df = pd.DataFrame(
    {
        "x": ["2023-01-01", "2023-02-01", "2023-03-01"],
        "y": [1, 2, 3],
    }
)
plot_df["x"] = pd.to_datetime(plot_df["x"])
ggplot(plot_df, aes(x="x", y="y")) + geom_point()

But if I add one more row, date axis breaks:

plot_df = pd.DataFrame(
    {
        "x": ["2023-01-01", "2023-02-01", "2023-03-01", "2023-04-01"],
        "y": [1, 2, 3, 4],
    }
)
plot_df["x"] = pd.to_datetime(plot_df["x"])
ggplot(plot_df, aes(x="x", y="y")) + geom_point()

Adding scale_x_datetime() or scale_x_date() explicitly does not affect anything.

@has2k1 has2k1 transferred this issue from has2k1/plotnine May 9, 2024
@has2k1 has2k1 closed this as completed in 9fd95fd May 9, 2024
@has2k1 has2k1 added the bug label May 9, 2024
@has2k1
Copy link
Owner

has2k1 commented May 9, 2024

Fix have been released in mizani v0.11.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants