Skip to content

Binned scales and date(time) transformations #5103

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

Merged
merged 4 commits into from
Jan 6, 2023

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #4217 and part of #4982.

Briefly, it avoids setdiff(), which strips attributes, and multiplication, which is incompatible with dates.

A small demonstration:

devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2

ggplot(economics, aes(date)) +
  stat_summary(aes(y = unemploy)) +
  scale_x_binned(trans = "date")
#> No summary function supplied, defaulting to `mean_se()`

ggplot(economics, aes(date, unemploy, colour = date)) +
  geom_line() +
  scale_colour_stepsn(
    colours = rainbow(10),
    trans = "date"
  )

Created on 2022-12-11 by the reprex package (v2.0.1)

@teunbrand teunbrand added this to the ggplot2 3.4.1 milestone Jan 5, 2023
Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Successfully merging this pull request may close these issues.

scale_x_binned() vs. POSIXct
2 participants