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

The colorbar guide (guide_colourbar) converts units into cm and then uses them as mm #2398

Closed
clauswilke opened this issue Jan 11, 2018 · 2 comments
Labels
bug an unexpected problem or unintended behavior themes 💃 wip work in progress

Comments

@clauswilke
Copy link
Member

clauswilke commented Jan 11, 2018

The colorbar guide (guide_colourbar) converts units into cm and then uses them as mm. Reproducible example:

library(ggplot2)
p1 <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Petal.Width)) + geom_point() +
  scale_color_distiller(name = "gap width = 1cm") +
  theme(legend.spacing.x = grid::unit(1, "cm"),
        legend.position = "top")
p2 <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Petal.Width)) + geom_point() +
  scale_color_distiller(name = "gap width = 10cm") +
  theme(legend.spacing.x = grid::unit(10, "cm"),
        legend.position = "top")
p3 <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Petal.Width)) + geom_point() +
  scale_color_distiller(name = "gap width = 50cm") +
  theme(legend.spacing.x = grid::unit(50, "cm"),
        legend.position = "top")

cowplot::plot_grid(p1, p2, p3, nrow = 1)

screen shot 2018-01-11 at 11 47 13 am

The problem exists for both legend.spacing.x and legend.spacing.y but cannot be shown for legend.spacing.y because of issue #2260, which has not yet been fixed for guide_colourbar.

The relevant lines in the code are here (convert legend.spacing.x and legend.spacing.y into cm) and here (use all widths and heights as mm values.)

@batpigandme
Copy link
Contributor

If ./tests/figs/deps.txt can be trusted, it looks like Freetype 2.7.0 (obviously worth waiting for hadley to confirm/deny)

FreeType: 2.7.0

@lock
Copy link

lock bot commented Oct 29, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Oct 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior themes 💃 wip work in progress
Projects
None yet
Development

No branches or pull requests

3 participants