I have an array of 2d matrices and I would like to turn these into a gif. Each of the matrix has an entry from 1 to 8, denoting fixed states. I would like to specify a color for each state, so for example 1 is red, 2 is blue, 3 is green and so on.

The context is an agent-based model of disease spread. Each matrix (100 x 100) represents a square grid environment of individuals and the elements represent the health status. I would like to visualize the spread of disease.

Does anyone have a Makie.jl, Images.jl or Reel.jl tutorial to do this?

I am getting some errors with thisâ€¦ mainly that each matrix can have unique numbers from 0 to 8 (like in your example, each matrix will have a number from 1:3). Except, my matrices are little bit different. The â€śfirstâ€ť matrix is all zeros. The second matrix may have a 1 in there. The third matrix may have 0, 1, and 2â€¦ and so on. (Basically the matrices evolve over time).

If the first matrix is all zeros (or not exactly 9 unique elements), then I get the following error:

ERROR: BoundsError: attempt to access 10-element Array{RGB{N0f8},1} with eltype RGB{FixedPointNumbers.Normed{UInt8,8}}

In your example, if you just do idxarray[:, :, 1] = zeros(Int64, 100, 100) you will get the same error.