lets-plot
lets-plot copied to clipboard
`scale_x_reverse` breaks datetime formatting
Example:
df = pd.DataFrame({
"x": pd.date_range(start="1-1-2000", end="1-1-2021", freq="10YE"),
"y": [1, 3, 2],
})
ggplot(df, aes("x", "y")) + geom_point() + scale_x_reverse()
Output:
Without scale_x_reverse() formatting is correct:
According to the documentation, scale_x_reverse() corresponds to a continuous scale. For the Lets-Plot API it is more natural to add a new function that knows how to reverse the date scale - something like scale_x_datetime_reversed().
This was fixed by the same commit as #1348
Unlike ggplot2 (there each added scale_x_.. overrides all prev scale settings), the lets-plot approach is to merge properties of all added scale_x_....