Skip to content
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

Scale types overhaul #1526

hadley opened this issue Jan 28, 2016 · 4 comments


Copy link

commented Jan 28, 2016

  • Make sure all scales work with dates/datetimes
  • Better colour/fill scales for ordered factors
  • Warn when mapping factor to size
  • Consider different viridis scales (using viridisLite) for fill/colour
  • Better default breaks for log axes
  • Document how to extend with your own S3 classes
  • Consider support for percentage, proportion, and likert s3 types
  • Could we have a jitter_na() type for position scales?

hadley added a commit that referenced this issue Jan 31, 2016

Better infrastructure for default scales.
Add methods for date/datetime. #1526

This comment has been minimized.

Copy link

commented Aug 2, 2016

@hadley Regarding your last point, ‘different colour scales for fill/colour’: If you’re thinking about the continuous colour scales, I recommend watching this (fascinating!) video about the new default colour scale in matplotlib. (There’s also an R implementation.)

@hadley hadley added the feature label Jan 25, 2017


This comment has been minimized.

Copy link
Member Author

commented Jan 25, 2017

@huftis yup I'm aware of viridis, and I'm considering making it the default.


This comment has been minimized.

Copy link
Member Author

commented May 24, 2017

One hacky way of better display for missing values:

add_na <- function(x, prop = 0.1) {
  x[sample(seq_along(x) <= prop * length(x))] <- NA

df <- tibble(
  x = letters[1:3] %>% sample(100, replace = TRUE) %>% add_na(),
  y = rnorm(100) %>% add_na()

ggplot(df, aes(x, y)) +

miss <- df %>% filter(

# Jittering and display at one end of the scale is an old idea
# Andreas Buja and was implemented in XGobi/GGobi

ggplot(df, aes(x, y)) +
  geom_point(na.rm = TRUE) +
  geom_jitter(aes(y = 3.5), data = miss, width = 0.05, height = 0.05, colour = "darkred") +
  geom_hline(yintercept = 2.8, size = 10, colour = "white") +
    breaks = c(-2, -1, 0, 1, 2, 3.5),
    labels = c(-2, -1, 0, 1, 2, "NA")

This comment has been minimized.

Copy link
Member Author

commented Oct 30, 2017

Mostly done by @karawoo

@hadley hadley closed this Oct 30, 2017

@lock lock bot locked as resolved and limited conversation to collaborators Jun 18, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
2 participants
You can’t perform that action at this time.