# Change color of specific bar in a bar plot

**URL:** https://discourse.julialang.org/t/change-color-of-specific-bar-in-a-bar-plot/67459
**Category:** New to Julia
**Tags:** visualization, makie
**Created:** [August 31, 2021, 10:13pm UTC](https://discourse.julialang.org/t/change-color-of-specific-bar-in-a-bar-plot/67459 "2021-08-31T22:13:38Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [August 31, 2021, 10:32pm UTC](https://discourse.julialang.org/t/change-color-of-specific-bar-in-a-bar-plot/67459/2 "2021-08-31T22:32:24Z")

</div>

One way would be `ifelse`:

```julia
colorBar_YaxisValue = 10

f = Figure(resolution = (1000, 800))

ax = Axis(f[1, 1], title = "test", ylabel = "Prices")

barplot!(ax, 1:20, 101:120,
    color = ifelse.(1:20 .== colorBar_YaxisValue, :red, :blue),
    direction = :x)

f

```

 ![grafik](https://global.discourse-cdn.com/julialang/original/3X/2/3/239581938adb2c77d7b5782cc3fa46a57c1ff9fa.png)

---

_[View the full topic](https://discourse.julialang.org/t/change-color-of-specific-bar-in-a-bar-plot/67459)._
