Skip to content

guide_axis_theta: fix missing label for one unique key #6424

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 3 commits into from
Apr 16, 2025

Conversation

Yunuuuu
Copy link
Contributor

@Yunuuuu Yunuuuu commented Apr 14, 2025

fix #6423

I don't understand why the vdiff test gives different results when I run the same code interactively."

ggplot(data.frame(x = "a", y = 1:3), aes(x, y)) +
  geom_point() +
  coord_radial(start = 0, end = pi / 2, inner.radius = 0.5) +
  guides(theta = guide_axis_theta(angle = 0))

image

Copy link
Collaborator

@teunbrand teunbrand left a comment

Choose a reason for hiding this comment

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

Thanks for catching this! Just a small comment on simplifying the test

Comment on lines 385 to 392
test_that("guide_axis_theta with only one axis key", {
p <- ggplot(data.frame(x = "a", y = 1:3), aes(x, y)) +
geom_point() +
coord_radial(start = 0, end = pi / 2, inner.radius = 0.5) +
guides(theta = guide_axis_theta(angle = 0))
expect_doppelganger("guide_axis_theta with only one axis key", p)
})

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this needs a visual snapshot, we can get_guide_data(p, "theta") to test the representation of the guide. The rest of the plot can also be simplified by leaving out the guides() and the arguments to coord_radial().

@Yunuuuu
Copy link
Contributor Author

Yunuuuu commented Apr 14, 2025

Thanks for the clarification—I've simplified the test accordingly.

Copy link
Collaborator

@teunbrand teunbrand left a comment

Choose a reason for hiding this comment

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

This looks good to me, thank you for the contribution!

@teunbrand teunbrand merged commit 1ae5a90 into tidyverse:main Apr 16, 2025
13 checks passed
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.

coord_radial: Missing labels when only one unique value in theta axis
2 participants