21 lines
479 B
R
21 lines
479 B
R
library(ggplot2)
|
|
|
|
# see https://r-graph-gallery.com/4-barplot-with-error-bar.html
|
|
|
|
png(file = "barplot.png")
|
|
|
|
# create dummy data
|
|
data <- data.frame(
|
|
name=c('','yy','zz','ff','DR12'),
|
|
flux=c(1,2,3,4,5),
|
|
err=c(1,0.2,3,2,4)
|
|
)
|
|
|
|
# Most basic error bar
|
|
ggplot(data) +
|
|
geom_bar(aes(x=name, y=flux), stat="identity", fill="skyblue", alpha=0.7) +
|
|
geom_errorbar( aes(x=name, ymin=flux-err, ymax=flux+err), width=0.4, colour="black", alpha=0.9, linewidth=2)
|
|
|
|
|
|
dev.off()
|