HOW TO EASILY CREATE BARPLOTS WITH ERROR BARS IN R
library(ggpubr)# Create a simple bar plot
ggbarplot(
ToothGrowth, x ="dose", y ="len",
add = c("mean_se","jitter"),
fill ="#BF504D")
1
2
3
4
5
6
7
8
library(ggpubr)# Grouped bar plots# Colored by groups
ggbarplot(
ToothGrowth, x ="dose", y ="len",
add = c("mean_sd","jitter"),
color ="supp", palette = c("#807F7F","#BF504D"),
position = position_dodge(0.8))
1
2
3
4
5
6
7
8
9
10
library(ggpubr)# Change bars fill color by groups# You need to change also point shapes by groups
ggbarplot(
ToothGrowth, x ="dose", y ="len",
add = c("mean_sd","jitter"),
add.params = list(shape ="supp"),
fill="supp", palette = c("#807F7F","#BF504D"),
position = position_dodge(0.8))