# How to change error bars color without changing the markerstrokecolor

**URL:** https://discourse.julialang.org/t/how-to-change-error-bars-color-without-changing-the-markerstrokecolor/74868
**Category:** General Usage
**Tags:** question, plotting, plot
**Created:** [January 19, 2022, 3:05pm UTC](https://discourse.julialang.org/t/how-to-change-error-bars-color-without-changing-the-markerstrokecolor/74868 "2022-01-19T15:05:11Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![user\_231578](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/user_231578/32/24170_2.png) [@user\_231578](https://discourse.julialang.org/u/user_231578)
#### Post date: [January 19, 2022, 3:05pm UTC](https://discourse.julialang.org/t/how-to-change-error-bars-color-without-changing-the-markerstrokecolor/74868/1 "2022-01-19T15:05:11Z")

</div>

I would like to change the error bars colors to match the graph colors without changing the markerstrokecolor. If I set markerstrokecolor=:auto, also the markers’ border change. I would like the latter to remain black.

Without setting markerstrokecolor=:auto

 ![ir 2](https://global.discourse-cdn.com/julialang/original/3X/7/9/795795cab4e676e85f99eb5936e6e7db5255fb0f.png)

Setting markerstrokecolor=:auto

 ![ir](https://global.discourse-cdn.com/julialang/original/3X/7/c/7ca52d959bb42f882c000d8ea0c5c7b1df466c1d.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: [January 19, 2022, 3:52pm UTC](https://discourse.julialang.org/t/how-to-change-error-bars-color-without-changing-the-markerstrokecolor/74868/2 "2022-01-19T15:52:16Z")

</div>

Replot the markers on top.  
For example:

```julia
using Plots
y1, y2 = rand(9), rand(9)
dy1, dy2 = 0.2rand(9), 0.2rand(9)
plot(y1, yerror=dy1, m=:square, lc=:reds, mc=:reds, msc=:reds)
plot!(y2, yerror=dy2, m=:square, lc=:blues, mc=:blues, msc=:blues)
scatter!(y1, m=:square, mc=:reds, label=false)
scatter!(y2, m=:square, mc=:blues, label=false)

```

---

<div class="post-metadata">

### Author: ![user\_231578](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/user_231578/32/24170_2.png) [@user\_231578](https://discourse.julialang.org/u/user_231578)
#### Post date: [January 20, 2022, 12:37pm UTC](https://discourse.julialang.org/t/how-to-change-error-bars-color-without-changing-the-markerstrokecolor/74868/3 "2022-01-20T12:37:03Z")

</div>

Thanks for your help. This works perfectly!
