Barplot with errorbars Using summary_stat() function in ggplot2 and R programming

Published: 16 May 2023
on channel: Rajendra Choure
935
19

#barplot #datavisualization #datascience #rprogramming #ggplot2 #datavisualization #summarystat

In this video i have demonstrated use of summaey_stat() function with ggoplot() to get barplots with errorbars. I have demonstrated grouped barplot with errorbars also.

with this approach explicit computation of summar statstics like mean and sd using group_by() and summarize() functions is not required. A lot of time is saved.
#code
head(iris)
summary(iris)

library(ggplot2)


ggplot(iris,aes(Species,Sepal.Length))+
stat_summary(fun="mean", geom="col")+
stat_summary(fun.data="mean_se",geom="errorbar", width=0.2, size=1)+
theme_classic()

library(tidyr)

iris_long = pivot_longer(iris,cols=1:4, values_to = "Length",names_to = "Measurement")


ggplot(iris_long,aes(Species,Length,fill=Measurement))+
stat_summary(fun="mean", geom="col", position = "dodge")+
stat_summary(fun.data="mean_se",geom="errorbar", width=0.2, size=1, position = position_dodge(width=0.9))+
theme_classic()

Facebook page:
  / rajendrachoureisc  

Mail Id:
rajuchoure@gmail.com

youtube playlist:
   • R programming tutorials  


On this page of the site you can watch the video online Barplot with errorbars Using summary_stat() function in ggplot2 and R programming with a duration of hours minute second in good quality, which was uploaded by the user Rajendra Choure 16 May 2023, share the link with friends and acquaintances, this video has already been watched 935 times on youtube and it was liked by 19 viewers. Enjoy your viewing!