In R, how to place error bars at each bar which is stacked?

Advertisements I know there are several answers to this question, but it’s slightly confusing to understand. I believe there are simpler codes than those explained in the current posts. location=c("L1","L2","L1","L2") y=c(5,10,12,12) cat=c("A","A","B","B") se=c(1,2,2,3) df=data.frame(location,y,cat,se) ggplot(data=df, aes(x=location , y=y, fill=cat))+ geom_bar(stat="identity", position = position_stack(reverse=T), width=0.7, size=1) + geom_errorbar(aes(ymin=y-se, ymax=y+se), position = "identity", width=0.5) When I run… Read More In R, how to place error bars at each bar which is stacked?

Plotting confidence interval from the data in Ploty R

Advertisements Trying to add the error bars on the bar graph. library(plotly) library(plyr) year <- c("1993","1994","1995","1996") incident <- c(123.2,489.2,281.3,892.1) lower_int <- c(32.1,23.1,11.1,34.2) upper_int <- c(45.3,43.5,25.6,59.0) data <- data.frame(year, incident, lower_int, upper_int) fig <- plot_ly(data, x = ~year, y = ~incident, type = ‘bar’, error_y = ~list(y_min = ~lower_int, y_max = ~upper_int)) fig This code just… Read More Plotting confidence interval from the data in Ploty R

Faulty positions of error bars in bar chart

Advertisements It seems like some of my error bars were right below the bars themselves, instead of ± from the mean. Would appreciate it if there’s any advice on this. My plot Image1 My script psbs <- read_csv("psbs.csv") spsbs<-summarySE(data=psbs, measurevar="fv", groupvars=c("Line", "genotype")) P1<- ggplot(data=psbs, mapping = aes(x = factor(genotype), y = fv, fill= Line))+ geom_bar(stat… Read More Faulty positions of error bars in bar chart

How to plot errorbars on seaborn barplot?

Advertisements I have the following dataframe: data = {‘Value’:[6.25, 4.55, 4.74, 1.36, 2.56, 1.4, 3.55, 3.21, 3.2, 3.65, 3.45, 3.86, 13.9, 10.3, 15], ‘Name’:[‘Peter’, ‘Anna’, ‘Luke’, ‘Peter’, ‘Anna’, ‘Luke’, ‘Peter’, ‘Anna’, ‘Luke’, ‘Peter’, ‘Anna’, ‘Luke’, ‘Peter’, ‘Anna’, ‘Luke’], ‘Param’: [‘Param1’, ‘Param1’, ‘Param1’, ‘Param2’, ‘Param2’, ‘Param2’, ‘Param3’, ‘Param3’, ‘Param3’, ‘Param4’, ‘Param4’, ‘Param4’, ‘Param5’, ‘Param5’, ‘Param5’], ‘error’:… Read More How to plot errorbars on seaborn barplot?

R plotting a graph with confidence intervals

Advertisements I have a dataframe that looks like this – df = data.frame(recall=c(0.55,0.62,0.43,0.61,0.19,0.14,0,0.19,0.33,0.33,0,0.33), type= c("Phone numbers","Phone numbers","Phone numbers","Phone numbers","Emails","Emails","Emails","Emails","URLs","URLs","URLs","URLs"), model=c("Cognition","TS-SAR","TS-ABINet","TS-RobustScanner", "Cognition","TS-SAR","TS-ABINet","TS-RobustScanner", "Cognition","TS-SAR","TS-ABINet","TS-RobustScanner"), lb=c(0.47,0.55,0.35,0.53, 0.07,0.04,0,0.07, 0.14,0.14,0,0.14), ub=c(0.63,0.7,0.51,0.69, 0.30,0.24,0,0.3, 0.52,0.52,0,0.52)) It consists of the results of 4 ‘text detection in image’ ML models. The recall column has the recall metric values for each model, based on the… Read More R plotting a graph with confidence intervals