Skip to content

Breaks should be computed on pre-expanded range #3592

Closed
@hadley

Description

@hadley

Otherwise when you adjust the number of breaks, you can end up with breaks right on the margin of the plot

library(ggplot2)

may01 <- as.POSIXct("2020-05-01")
df <- data.frame(x = c(may01, may01 + 60 * 86400))

ggplot(df, aes(x, 1)) + 
  geom_blank() + 
  scale_x_datetime(NULL, date_breaks = "7 days", date_labels = "%d %b") + 
  scale_y_continuous(NULL, breaks = NULL)

Created on 2019-10-27 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions