
P <-p + annotate("text", x = annoList], y = annoList], label = annoList])ĭata and call: library(ggplot2) library(data.table) library(magrittr) ĭf_long <- rbind(ToothGrowth,ame(len=40:50,dose=3.0))ĭf_long$ID <- data.table::rowid(df_long$dose) Xlab(x) + ylab(y) + ggtitle("title","subtitle") Scale_color_brewer(palette="Paired") + theme_minimal() + Geom_line(color=coli,size=sizei) + geom_point(color=coli,size=sizei) +

Geom_errorbar(aes(ymin=len-sd, ymax=len+sd),width=.1,color=coli,size=sizei) + Made my own function: ts_test % na.omit %>% unique Lastly, to indicate comparison between groups, I built a larger circle and flattened it at the top. Geom_line(data = arc.df, aes(Group+2, Value+8.5), lty = 2) Geom_line(data = arc.df, aes(Group+1, Value+5.5), lty = 2) +

P + geom_text(data = label.df, label = "*") + To add the arcs that indicate a subgroup comparison, I computed parametric coordinates of a half circle and added them connected with geom_line. P + geom_text(data = label.df, label = "***") Geom_bar(aes(fill = Sub), stat="identity", position="dodge", width=.5)Īdding asterisks above a column is easy, as baptiste already mentioned. Theme_bw() + theme(id = element_blank()) + Scale_fill_manual(values = c("grey80", "grey20"))įull documentation of the package is available at CRAN.įirst, I created some dummy data and a barplot which can be modified as we wish. To create a more advanced plot similar to the one shown by Jens Tierling, you can do: dat <- ame(Group = c("S1", "S1", "S2", "S2"),

Geom_signif(comparisons = list(c("versicolor", "virginica")), Ggplot(iris, aes(x=Species, y=Sepal.Length)) + Instead of tediously adding the geom_line and geom_text to your plot you just add a single layer geom_signif: library(ggplot2) But I recently created a ggplot-extension that simplifies the whole process of adding significance bars: ggsignif I know that this is an old question and the answer by Jens Tierling already provides one solution for the problem.
