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

facet_grid with remove_labels removes labels but leaves the space between the panels #158

Open
Ari04T opened this issue May 7, 2024 · 2 comments

Comments

@Ari04T
Copy link

Ari04T commented May 7, 2024

Hello

Basically what the title says. facet_grid2 by the way, sorry about the mistake in the title.

mpg %>% 
  ggplot(aes(cyl, class)) +
  geom_point() +
  facet_grid2(. ~ manufacturer, axes = "all", remove_labels = "y")

This is the final result. The labels are removed but the space remains.

Screenshot 2024-05-07 063604

I'm currently using ggplot 3.5.1 with ggh4x 0.2.8.9000

Thanks!

@teunbrand
Copy link
Owner

Thanks for the report. I can reproduce the bug and it would need to get fixed.
If that is the only reason for using facet_grid2(), I can also recommend ggplot2::facet_grid() to achieve the same goal since 3.5.0.

library(ggplot2)

mpg |>
  ggplot(aes(cyl, class)) +
  geom_point() +
  facet_grid(. ~ manufacturer, axes = "all", axis.labels = "all_x")

Created on 2024-05-07 with reprex v2.1.0

@Ari04T
Copy link
Author

Ari04T commented May 7, 2024

Thanks for the suggestion. I'm actually using strip_nested for my actual charts to I do need to use facet_grid2 to get the full capabilities of ggh4x.

I think I can get around it for now by just using theme(panel.spacing = unit(-30, "pt")) or similar to get around the current bug, but I just wanted to let you know that the package is creating this unexpected result at the moment.

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

No branches or pull requests

2 participants