Search code examples
rggplot2violin-plot

remove facet.by label from sublot title in violinboxplot


As the title says I need to remove the label related to the facet.by from the title of each subplot in a violin box plot, using ggplot2.

Read the data and create the plot

 plotIt <- read.table("tryit.csv", sep="\t", header=T)

 p <- ggviolin(data, x = "label", y = "aMeasure",  fill="label", palette=rainbowcols, + facet.by="timepoint", add.params = list(fill = "white"), short.panel.labs = FALSE, main=paste("measuring", tolower(reg), sep=" "), ylab="a measure", xlab="", ylim=c(0,8)) + theme(plot.title = element_text(hjust = 0.5), axis.text.x=element_blank())

 advanced <- p + stat_compare_means(comparisons = list(c("tone", "ttwo")), method = "t.test", paired=F, label.y=7.5) + geom_boxplot(width=0.05)

The question is: how to remove the "timepoint" label from the title of each subplot?

EDIT:

these are the packages I'm using for plotting are ggplot and ggpubr

the plot


Solution

  • You should get the desired result by using:

    short.panel.labs = TRUE
    

    This is also the default behaviour of facet, so you can completely remove short.panel.labs. And it doesn't matter whether you use TRUE/FALSE or T/F, but if I remember correctly, the full notation is recommended for clarity.