Question: Problem with plotting colors


I am working in a simulation, which requires me to create a checkerboard of values which I paint afterwards according to its value. The idea is to create a sequence of images (which I could export for every iteration and create into a gif/timelapse afterwards). The problem I am encountering is that when I try to plot it, I only obtain a difuse coloring scheme, without having a specific color for every pixel.

if you search for the color command in plots ( one of the examples is more or less the result I want, but I would like to have it without the gridlines and being able to control the color according to the value of the matrix in said position.


My current attempt, and the one closest to the solution is:


R:=Matrix(1..N,1..N, datatype=integer); for x from 1 to N do for y from 1 to N do R[x,y]:=P[x,y,2]*18+P[x,y,3]: od: od:R;
#P is the matrix where I do the calculations and R is the matrix I want to plot after every step of the calculation.

surfdata(Matrix(R), 1..N, 1..N, style=surface,
         dimension=2, labels=["x", "y"],
#the surfdata I resqued from another proyect I had. I know it is not thought for this tipe of grafs, but it was the closest I could come by.


I do not know if it is a better idea to use an Array or a Matrix to plot this. While the P array isn''t touched, I do not mind modifying in any way the R matrix

Thank you,


Please Wait...