答案1
pgfplots
可以做矩阵图。
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{colorbrewer}
\begin{document}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false,colorbar,colormap/Purples]
\addplot [matrix plot,point meta=explicit]
coordinates {
(0,0) [0] (1,0) [1] (2,0) [2]
(0,1) [3] (1,1) [4] (2,1) [5]
(0,2) [6] (1,2) [7] (2,2) [8]
};
\end{axis}
\end{tikzpicture}
\end{document}