teunbrand / ggh4x

ggplot extension: options for tailored facets, multiple colourscales and miscellaneous
https://teunbrand.github.io/ggh4x/
Other
534 stars 32 forks source link

Remove ticks with `facet_wrap2()` #77

Closed brunomioto closed 1 year ago

brunomioto commented 1 year ago

My suggestion an argument like remove_labels = all, but also with axis ticks. On my example, I don't thinks it's necessary, but I need them on the 1st column and last row

image

teunbrand commented 1 year ago

Hi there,

I'm sorry I might not understand fully: could you describe it a bit more? So you want to hide all axis labels, except for the eating disorders panel? What exactly should happen to the ticks?

brunomioto commented 1 year ago

Oh, sorry for being too simple on my request. I just wanted a way to remove the axis ticks, like the option to remove labels that already exists on ggh4x Something like this that I edited on paint: Sem título

teunbrand commented 1 year ago

Right, got it, thanks! Aren't currently available strategies sufficient for this purpose? You could just add geom_vline() + geom_hline() to mimick a tickless axis:

library(ggplot2)

p <- ggplot(mpg, aes(displ, cty)) +
  geom_point() +
  facet_wrap(~ trans)

p + geom_vline(xintercept = -Inf, size = 1) +
  geom_hline(yintercept = -Inf, size = 1)

Alternatively:

p + theme(
    panel.border = ggh4x::element_part_rect(side = "lb", fill = NA, size = 1)
  )

Created on 2022-08-27 by the reprex package (v2.0.1)

brunomioto commented 1 year ago

Yeah, I think this could work. Thanks!