Home > database >  grouping mistake in ggerrorplot
grouping mistake in ggerrorplot

Time:04-18

I'm having trouble with the facet.by parameter of the ggerrorplot fonction. When I use a grouping variable, the facets still show all data labels in both groups, but with blank spaces. Is there a way to erase the extra labels, or to recreate this in ggplot? thanks!

ggerrorplot(aile_data, x = "lignee", y = "longueur",
            desc_stat = "mean_ci", ci = 0.95, color = "black",
            add = "jitter", add.params = list(color = "darkgray"), facet.by = "type")

Plot

CodePudding user response:

Haven't found an option in the docs but you could free the scales by manually adding a facet_wrap.

Using the default example from ggpubr::ggerrorplot:

library(ggpubr)
#> Loading required package: ggplot2

df<- ToothGrowth

# Plot mean_se
p <- ggerrorplot(df, x = "dose", y = "len", facet.by = "dose")

p

p   facet_wrap(~dose, scales = "free_x")

  • Related