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?
Here is my code
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)
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
mybool = (falses(n), bitrand(n))
The problem still appears here.
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.
colors = (rand([:red, :green],n), rand([:red, :green], n))
does not, unless the first vector is all the same color.
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.
1 Like
Could this be related to the implementation of this idea in ffmpeg_exe
with the new setting: "palettegen=stats_mode=diff"
?