# Plots.jl animation displayed wrong marker color

**URL:** <https://discourse.julialang.org/t/plots-jl-animation-displayed-wrong-marker-color/69417>\
**Category:** New to Julia\
**Tags:** question, plotting, plots\
**Created:** [October 8, 2021, 6:53am UTC](https://discourse.julialang.org/t/plots-jl-animation-displayed-wrong-marker-color/69417 "2021-10-08T06:53:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![comphilano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/comphilano/32/20587_2.png) [@comphilano](https://discourse.julialang.org/u/comphilano)\
**Post date:** [October 8, 2021, 6:53am UTC](https://discourse.julialang.org/t/plots-jl-animation-displayed-wrong-marker-color/69417/1 "2021-10-08T06:53:56Z")

</div>

I’m having this issue while doing this visualization. The color of some markers are supposed to be red instead of black. Could you please help me how to fix this?

 ![Screenshot from 2021-10-08 13-44-30](https://global.discourse-cdn.com/julialang/original/3X/3/f/3faba87e073b6d05e36a336d7198d35759c9dbc9.png)

---

<div class="post-metadata">

**Author:** ![comphilano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/comphilano/32/20587_2.png) [@comphilano](https://discourse.julialang.org/u/comphilano)\
**Post date:** [October 9, 2021, 1:30am UTC](https://discourse.julialang.org/t/plots-jl-animation-displayed-wrong-marker-color/69417/2 "2021-10-09T01:30:24Z")

</div>

Here is my code

```julia
using Plots
using Random 

n = 5

mypoint = (rand(1:10, n), rand(1:10, n))
mybool = []

push!(mybool, BitVector(undef, n))
push!(mybool, bitrand(n))

anim = @animate for v in mybool
    scatter(mypoint, markersize=10, c = map(x -> x ? :red : :green, v))
end

gif(anim, "point.gif", fps=1)

```

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [October 9, 2021, 3:53am UTC](https://discourse.julialang.org/t/plots-jl-animation-displayed-wrong-marker-color/69417/3 "2021-10-09T03:53:21Z")

</div>

I can reproduce this, and it’s _weird_.

Just to get the obvious things out of the way, you can use `falses` to initialize a zeroful BitArray, so

```julia
mybool = (falses(n), bitrand(n))

```

The problem still appears here.

```julia
colors = (fill(:green, n), rand([:red, :green], n))
anim = @animate for v in colors
     scatter(mypoint, markersize=10, c = v)
end

```

shows the same issue.

```julia-auto
colors = (rand([:red, :green],n), rand([:red, :green], n))

```

does not, unless the first vector is all the same color.

```julia-auto
colors = (rand([:red, :green],n), rand([:red, :green, :blue], n))

```

makes the points in the second plot which should be blue gray.

### Conclusion

The first frame in an animation sets the gamut, and any other colors in subsequent plots are replaced by gray. I would have suggested a bug report to `Plots.jl`, but I see you already have.

---

<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:** [October 9, 2021, 6:59am UTC](https://discourse.julialang.org/t/plots-jl-animation-displayed-wrong-marker-color/69417/4 "2021-10-09T06:59:57Z")

</div>

Could this be related to the implementation [of this idea](https://github.com/JuliaPlots/Plots.jl/issues/423) in `ffmpeg_exe` with the new setting: `"palettegen=stats_mode=diff"` ?
