I am using the same facets to divide into stations my dataset. I have done three graphs this way, and I would like to arrange the three graphs in a single plot, I have done it with ggarange()
in ggpubr
, but I'd like to remove the facet labels because they are redundant (keep them in the first row only).
I'll show a minimal reproducible example with dataset iris
:
ggarrange(
ggplot(data=iris, aes(x=Sepal.Length, y=Petal.Length))+ geom_point()+facet_wrap(~Species)+theme(legend.position = "none"),
ggplot(data=iris, aes(x=Sepal.Length, y=Petal.Width))+ geom_point()+facet_wrap(~Species)+theme(legend.position = "none"), #"bottom"),
ggplot(data=iris, aes(x=Sepal.Length, y=Sepal.Width))+ geom_point()+facet_wrap(~Species)+theme(legend.position = "bottom"),
nrow = 3
)
I want to take out the facet labels in rows 2 and 3 since it is redundant.
Thank you.
I would take this in a different approach
First put your data in a correct format, and then facet using 2 variables.
require(tidyr)
iris2 <- iris %>% gather(variable, value, Sepal.Width:Petal.Width)
ggplot(data=iris2, aes(x=Sepal.Length, y=value)) +
geom_point() +
facet_grid(variable~Species)