Change color of specific bar in a bar plot

One way would be ifelse:

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

1 Like