indymnv
1
If i have a dataset as follow:
df = DataFrame(
group = ["A", "B", "C"],
total = [7.7, 4.6, 5.1],
std_error = [0.04, 0.05, 0.06]
)
How can I create a Barplot with error bars, using plots and statplots? Similar to this kind of pictures.
1 Like
Using Plots:
using DataFrames, Plots
df = DataFrame(group=["A", "B", "C"], total=[7.7, 4.6, 5.1], std_error = [0.04, 0.05, 0.06])
bar(df.group, df.total, c=:blues, lw=0, widen=false)
plot!(1/2:(ncol(df)-1/2), df.total, lw=0, yerror=20*df.std_error, ms=10)
NB:
The original errors were magnified as too small to plot, otherwise consider adding a secondary y-axis
1 Like