Skip to content

Fix colourbar's ticks.length argument not working #5529

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 2 commits into from
Nov 27, 2023

Conversation

teunbrand
Copy link
Collaborator

I became aware that the ticks.length argument of guide_colourbar() wasn't working as intended, so this PR fixes that problem.
I've including this argument in an already existing test so that we might know if this breaks again in the future.

Small demonstration of setting the tick length:

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

ggplot(mpg, aes(displ, hwy)) +
  geom_point(aes(colour = cty)) +
  guides(colour = guide_colourbar(ticks.length = unit(0.5, "npc")))

Created on 2023-11-20 with reprex v2.0.2

@teunbrand teunbrand added this to the ggplot2 3.5.0 milestone Nov 20, 2023
@thomasp85
Copy link
Member

What issue does this solve? Can you elaborate since you don't link to an issue?

@teunbrand
Copy link
Collaborator Author

Apologies for not filing an issue first, which I should have.

The issue is that the ticks.length argument was ignored. Here is the same reprex on the current main branch, where you can see that the ticks don't follow the length set in the ticks.length argument and retain the default unit(0.2, "npc") tick length:

library(ggplot2)
packageVersion("ggplot2") # current main
#> [1] '3.4.4.9000'

ggplot(mpg, aes(displ, hwy)) +
  geom_point(aes(colour = cty)) +
  guides(colour = guide_colourbar(ticks.length = unit(0.5, "npc")))

Created on 2023-11-20 with reprex v2.0.2

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

@teunbrand
Copy link
Collaborator Author

Thanks for the review!

@teunbrand teunbrand merged commit 9f3eb1a into tidyverse:main Nov 27, 2023
@teunbrand teunbrand deleted the colourbar_ticks branch November 27, 2023 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants