是否可以在通过阈值分隔区域的显式矩阵图中添加轮廓(例如使用 countours gnuplot)?请参阅 MWE 中手动添加的红线作为所需行为。
\documentclass{standalone}
\usepackage{pgfplots,pgfplotstable}
\usepgfplotslibrary{colormaps}
\pgfplotsset{compat=newest}
\begin{filecontents}{dataTest.txt}
X,Y,Z
0.1,0.1,2
0.1,0.2,2
0.1,0.3,2
0.2,0.1,0
0.2,0.2,2
0.2,0.3,2
0.25,0.1,0
0.25,0.2,2
0.25,0.3,2
0.3,0.1,0
0.3,0.2,2
0.3,0.3,2
0.6,0.1,0
0.6,0.2,0
0.6,0.3,2
\end{filecontents}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
colorbar,
colormap/viridis,
point meta=explicit,
point meta min=0,
point meta max=2,
]
\addplot[matrix plot*]
table [x=X,y=Y, meta=Z, col sep=comma] {dataTest.txt};
\draw[red,thick] (axis cs: 0.15,0.05)
-- (axis cs: 0.15,0.15)
-- (axis cs: 0.45,0.15)
-- (axis cs: 0.45,0.25)
-- (axis cs: 0.8,0.25);
\end{axis}
\end{tikzpicture}
\end{document}
谢谢你!