# Bar Chart with error bars plots

**URL:** <https://discourse.julialang.org/t/bar-chart-with-error-bars-plots/90155>\
**Category:** Visualization\
**Tags:** plotting, plots\
**Created:** [November 12, 2022, 9:23am UTC](https://discourse.julialang.org/t/bar-chart-with-error-bars-plots/90155 "2022-11-12T09:23:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![indymnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/indymnv/32/212594_2.png) [@indymnv](https://discourse.julialang.org/u/indymnv)\
**Post date:** [November 12, 2022, 9:23am UTC](https://discourse.julialang.org/t/bar-chart-with-error-bars-plots/90155/1 "2022-11-12T09:23:45Z")

</div>

If i have a dataset as follow:

```julia
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.

![bar_plot_with_error_bars](https://global.discourse-cdn.com/julialang/original/3X/c/f/cf18f776a51d03fdd5432a801bb7c412fdb664b5.png)

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [November 12, 2022, 10:18am UTC](https://discourse.julialang.org/t/bar-chart-with-error-bars-plots/90155/2 "2022-11-12T10:18:03Z")

</div>

Using Plots:

```julia
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)

```

 ![Plots_bar_error_bars](https://global.discourse-cdn.com/julialang/original/3X/5/0/5066206c4e39876d68e6e2eb6cbf76247da6bff1.png)

_ **NB:** _  
_The original errors were magnified as too small to plot, otherwise consider adding a secondary y-axis_

---

<div class="post-metadata">

**Author:** ![indymnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/indymnv/32/212594_2.png) [@indymnv](https://discourse.julialang.org/u/indymnv)\
**Post date:** [November 12, 2022, 10:24am UTC](https://discourse.julialang.org/t/bar-chart-with-error-bars-plots/90155/3 "2022-11-12T10:24:10Z")

</div>

Thanks x 2!
