Skip to content

Non sensical POSIXct axis labels #3475

Closed
@BartJanvanRossum

Description

@BartJanvanRossum

Looking at the example below the first plot produces an output that looks perfectly fine. However when plotting only one point as in the second plot, the date time value on the x-axis is set to the number of seconds, so only a value of 50 is displayed.
I know this can be fixed manually by setting date_labels in scale_x_datetime. However I think a more sensible default would be nice.

library(ggplot2)
library(lubridate)

dat <- data.frame(x = as_datetime(c("2010-08-03 00:50:50", 
                                    "2010-08-04 00:50:50")), y = 1)

ggplot(dat, aes(x = x, y = y)) + geom_point()
ggplot(dat[1, ], aes(x = x, y = y)) + geom_point() 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions