# Question:Heatmap Matrix all values +1 or -1, try with Sparsematrix

## Question:Heatmap Matrix all values +1 or -1, try with Sparsematrix

```Hello, I want to repeat in matrix for two colors a matrix, if the element i, j
takes the value +1 is blue and if it is -1 green, it happens that sometimes
the matrix can take all the values ​​as +1 or -1, I used heatmap, but apparently
it gives problems if all the elements of the matrix take +1 or -1.```

restart;
sizeMatriz := 4; iter := 1000; with(Statistics); with(LinearAlgebra); randomize(); with(plots);
sizeMatriz := 4
iter := 1000
f := rand(1 .. 2);
f := proc()  ...  end;
g := rand(1 .. 10);
g := proc()  ...  end;
k := 1;
k := 1
RM := Matrix(sizeMatriz, sizeMatriz, proc (i, j) options operator, arrow; 1 end proc); HeatMap(RM, axis = [gridlines = [sizeMatriz, color = green], thickness = 2], color = [blue, yellow], size = [640, 480]);
Error, (in Statistics:-HeatMap) the 2nd argument should be of type {numeric, string}

How i made this?, is posible by other command that not Heatmap, other way? I try with sparsematrix:

restart;
sizeMatriz := 4; iter := 1000; with(Statistics); with(LinearAlgebra); randomize(); with(plots);
sizeMatriz := 4
iter := 1000
f := rand(1 .. 2);
RM := Matrix(sizeMatriz, sizeMatriz, proc (i, j) options operator, arrow; (-1)^f() end proc)
PA := sparsematrixplot(RM, matrixview, color = ["Blue","Red"]);

but this paint alls vaues matrix[i,j] +1 or -1 in the same color.

Regards.

﻿