I have a matrix where the diagonal elements are meaningless. Usually I just fill them with 0, or infinities. The problem is that when I MatrixPlot this matrix, the diagonal elements affect the gradient scale. I just want to exlucde the diagonal from the plot, leave it blank. How can I do this?
Example:
mat = RandomReal[{100, 102}, {10, 10}];
mat2 = mat - DiagonalMatrix@Diagonal@mat;
Here mat2
is a matrix with zeros on the diagonal. When I plot it with MatrixPlot
, I subtract the minimum element to display the variability of the matrix:
MatrixPlot[mat2 - Min@mat2]
Obviously the variability of mat2
is hidden by the zeros on the diagonal. This is clearly visible if we plot the original matrix:
MatrixPlot[mat - Min@mat]
MatrixPlot[SparseArray[{{i_,i_}:> Min@yourArray,{i_,j_}:>yourArray[[i,j]]},Dimensions@yourArray]]
$\endgroup$ – Dr. belisarius Dec 5 '14 at 17:23