答案1
你可以直接画出来tikz
而不需要pgfplot
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\newcommand\rectsep{3pt}
\newcommand\rectbox[6]{%{x}{y}{dx}{dy}{Label}{color}
\draw[fill=#6] (#1cm+\rectsep,#2cm+\rectsep) rectangle node{#5} +(#3cm-2*\rectsep,#4cm-2*\rectsep);}
\draw[->](0,0)--(4,0)node[anchor=north west]{$V_1$};
\draw[->](0,0)--(0,4)node[anchor=south east]{$V_2$};
\foreach \Tick in {1,2,3}{
\draw (\Tick,0)-- +(0,-0.2) node[below]{$\Tick00$};
\draw[thin,gray] (\Tick,0)-- +(0,4);
\draw (0,\Tick)-- +(-0.2,0) node[left]{$\Tick00$};
\draw[thin,gray] (0,\Tick)-- +(4,0);
}
\begin{scope}
\clip (0,0) rectangle (4.7,4.7);
\rectbox{1}{1}{1}{2}{1}{red!40}
\rectbox{1}{3}{1}{2}{2}{blue!40}
\rectbox{2}{1}{1}{1}{3}{green!40}
\rectbox{2}{2}{1}{1}{4}{yellow!40}
\rectbox{2}{3}{1}{2}{5}{magenta!40}
\rectbox{3}{2}{2}{1}{6}{cyan!40}
\rectbox{3}{3}{2}{2}{7}{gray!40}
\end{scope}
\end{tikzpicture}
\end{document}