# Makie: Color and theme for errorbars

**URL:** https://discourse.julialang.org/t/makie-color-and-theme-for-errorbars/101428
**Category:** Visualization
**Tags:** plotting, makie
**Created:** [July 10, 2023, 11:39am UTC](https://discourse.julialang.org/t/makie-color-and-theme-for-errorbars/101428 "2023-07-10T11:39:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![barucden](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barucden/32/26154_2.png) [@barucden](https://discourse.julialang.org/u/barucden)
#### Post date: [July 10, 2023, 11:39am UTC](https://discourse.julialang.org/t/makie-color-and-theme-for-errorbars/101428/1 "2023-07-10T11:39:27Z")

</div>

Hi, I have two questions about `errorbars` in Makie. Consider the following example:

```julia
using CairoMakie

set_theme!(Theme(
    Lines=(linewidth = 4,),
    ErrorBars=(linewidth = 4,)
))

x = [1, 2, 3, 4, 5]

y_A = [1, 2, 1, 2, 1]
err_A = [0.1, 0.2, 0.1, 0.2, 0.3]

y_B = [2, 3, 2, 3, 2]
err_B = [0.2, 0.3, 0.2, 0.1, 0.1]

f = Figure()
ax = Axis(f[1, 1])

lines!(ax, x, y_A, label='A')
errorbars!(ax, x, y_A, err_A, label='A')

lines!(ax, x, y_B, label='B')
errorbars!(ax, x, y_B, err_B, label='B')

f

```

It produces this figure:

 ![test](https://global.discourse-cdn.com/julialang/original/3X/5/8/58e9bd55525ad14545726dc35a62bfdc17e2af3a.png)

Question 1: I would like to have the color of the errorbars match the color of the corresponding lines. Is this possible?

Question2: Notice that the `linewidth` settings from the `Theme` is ignored for the errorbars. Is this a bug or did I get it wrong?

Thanks!

---

<div class="post-metadata">

### Author: ![filchristou](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/filchristou/32/26760_2.png) [@filchristou](https://discourse.julialang.org/u/filchristou)
#### Post date: [July 12, 2023, 7:06am UTC](https://discourse.julialang.org/t/makie-color-and-theme-for-errorbars/101428/2 "2023-07-12T07:06:40Z")

</div>

Do

```julia
set_theme!(Theme(
    Lines=(linewidth = 4,),
    Errorbars=(linewidth = 4, cycle=[:color])
))

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/c/6c88ba3b43b550967722db22ec210fb0e37079ea.png)

and it should work.  
Your mistake was the capital B in `ErrorBars`.  
To cycle colors for `Errorbars`, you can use the `cycle` attribute as further explained here [Page Redirection](https://docs.makie.org/stable/documentation/theming/#cycles)

---

<div class="post-metadata">

### Author: ![barucden](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barucden/32/26154_2.png) [@barucden](https://discourse.julialang.org/u/barucden)
#### Post date: [July 12, 2023, 7:23am UTC](https://discourse.julialang.org/t/makie-color-and-theme-for-errorbars/101428/3 "2023-07-12T07:23:42Z")

</div>

Thank you, Filippos! Works perfectly.

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [July 12, 2023, 9:19am UTC](https://discourse.julialang.org/t/makie-color-and-theme-for-errorbars/101428/4 "2023-07-12T09:19:37Z")

</div>

We could think about making that part of the default theme, too
