lets-plot icon indicating copy to clipboard operation
lets-plot copied to clipboard

scale_x_datetime(): error building plot for early dates

Open ASmirnov-HORIS opened this issue 4 years ago • 0 comments

Look at the following example:

from datetime import datetime

import pandas as pd

from lets_plot import *
LetsPlot.setup_html()

df = pd.DataFrame(
    {
        'd': pd.to_datetime(
            [
                datetime(1972, 6, 9), 
                datetime(1972, 6, 10), 
                datetime(2021, 3, 5)
            ]
        ), 
        'x': [0, 1, 2]
    }
)

ggplot(df, aes('d', 'x')) + geom_point() + scale_x_datetime()

Here we get:

If we remove the scale, it works:

If we remove the earliest date, it works again:

ASmirnov-HORIS avatar Mar 05 '21 16:03 ASmirnov-HORIS