-
Notifications
You must be signed in to change notification settings - Fork 6
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
guide_colourbar_custom can't handle ticks with 2 elements #9
Comments
Thanks for the report David, you can see why I've labelled the package as experimental 😅 |
Thanks for the fixes! It's all weirder edge-case stuff anyway, but might as well fix if it's not too hard |
Should no longer throw any errors: library(gguidance)
#> Loading required package: ggplot2
library(tidyverse)
library(palmerpenguins)
penguins |>
ggplot() +
geom_point(
aes(x = flipper_length_mm,
y = species,
colour = flipper_length_mm)) +
guides(
colour = guide_colourbar_custom(),
) +
theme(legend.ticks.length = ggplot2::rel(c(0.15, 0)))
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_point()`). Note that implementation differs from ggplot2, because of the 'little guides in a trenchcoat' approach. penguins |>
ggplot() +
geom_point(
aes(x = flipper_length_mm,
y = species,
colour = flipper_length_mm)) +
guides(
colour = guide_colourbar_custom(second_guide = "none"),
)
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_point()`). Created on 2024-04-27 with reprex v2.1.0 |
Awesome, thanks! Minor thing - if your theme that you've added already has 2 elements in it, then there is a tick only every 2nd break even once you add
|
In addition to above, are you planning on adding |
Yes but this is also what happens when you use e.g.
No they already have |
Re the 2nd break thing, it works differently to Re the first_guide/second guide, whoops missed that |
True, but I'm not going to mirror that guide perfectly as I'd like to be free of the historic bagage of that guide so that I can do it the way I think it is best. Primarily, it is important to me that the tickmarks and labels are individual guides that can be tweaked as one sees fit separately from the colourbar itself. In the process, we might lose nuances like that, but it is still very much possible to achieve the same result. |
Fair enough - sounds like a good approach |
Created on 2024-04-27 with reprex v2.1.0
The text was updated successfully, but these errors were encountered: