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

Remove labels in facets not working with element_markdown axis #67

Closed
Ari04T opened this issue Apr 30, 2022 · 2 comments
Closed

Remove labels in facets not working with element_markdown axis #67

Ari04T opened this issue Apr 30, 2022 · 2 comments

Comments

@Ari04T
Copy link

Ari04T commented Apr 30, 2022

Hello

First of all, thanks for the great package. You've added a ton of great extra functionality to ggplot2.

I want to report what seems like a bug to me. If I create a chart the following way, everything works properly

mtcars %>% 
    ggplot(aes(as.factor(cyl), mpg)) +
    geom_point() +
    facet_wrap2(~ cyl,  axes = "all", remove_labels = "x", ncol = 1)

With element_text

But if I change the x-axis type to element_markdown, I get the following chart

mtcars %>% 
    ggplot(aes(as.factor(cyl), mpg)) +
    geom_point() +
    facet_wrap2(~ cyl,  axes = "all", remove_labels = "x", ncol = 1) +
    theme(
        axis.text.x = element_markdown()
    )

With element_markdown
As you can see, facet_wrap2 with the remove_labels parameter doesn't remove the x-axis labels when they are specified as a markdown element.

@teunbrand
Copy link
Owner

Ah yes this does seem like an oversight on my end, thanks for reporting it! It seems fixable (specifically for the element_markdown case, don't know about others), but I can't tell you exactly when I might find the time to fix this.

@teunbrand
Copy link
Owner

Should now work for rich text grobs as well, on dev version:

library(ggplot2)
library(ggh4x)
library(ggtext)

ggplot(mtcars, aes(as.factor(cyl), mpg)) +
  geom_point() +
  facet_wrap2(~ cyl, axes = "all", remove_labels = "x", ncol = 1) +
  theme(
    axis.text.x = element_markdown()
  )

Created on 2022-05-14 by the reprex package (v2.0.1)

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