Function matrixHistogram