Barplot with error bar using stat summary function, A shortcut
Автор: Rajendra Choure
Загружено: 9 окт. 2021 г.
Просмотров: 4 989 просмотров
In this video barplot with error-bar has been plotted without calculating summary statistics before the ggplot function.
Instead of stat = Identity, stat="summary" has been used to determine the length of the bar as the mean of the values, and error bars are plotted using the stat_summary layer.
code of the plot is as follows:
library(ggplot2)
head(ToothGrowth)
summary(ToothGrowth)
ToothGrowth$dose
ggplot(ToothGrowth,aes(supp,len,fill=as.factor(dose)))+
geom_bar(stat="summary",fun="mean",position="dodge")+
stat_summary(geom="errorbar",fun.data = mean_se,
position=position_dodge(width=0.9),width=0.5)+
theme_classic()+
theme(legend.position = "top")+
labs(x="Suppliment",y="Length of tooth",fill="dose")
#stackedBarplot
#barplot
groupedBarplot ,
#DataVisualization
#GGplot2,
#Plottingpartofwhole
#R #datavisualisation #Rprogramming #ggplot #datanalysis #barplot
#stat-summary
#errorbar
00:00 introduction
00:28 creat R script and save
00:50 install ggplot2 package
01:16 Data set used
01:45 ggplot function
02:10 converting numeric vector to factor
02:30 shortcut: stat = "stat summary"
03:08 position dodge
03:19 Error bars
4:10 position of error bars
4:43 plot customisation Theme
4:55 legend postion
5:03 labs - plot titles
5:24 final publication read barplot with error bars
5.33 barplot wih error for iris dataset

Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: