我正在尝试提高 MATLAB 中绘图的质量,因此我使用 Matlab2tikz 来转换 MATLAB 绘图pgfplots
。我想执行颜色插值,但这不起作用,浏览pgfplots
文档和此网站后,我找不到任何解决方案。
这是从原始代码简化而来以满足 MWE 要求的代码。
% This file was created by matlab2tikz.
%
%The latest updates can be retrieved from
% http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz
%where you can also make suggestions and rate matlab2tikz.
%
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots, filecontents}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
width=3.983in,
height=3.141in,
at={(0.668in,0.693in)},
scale only axis,
point meta min=-10,
point meta max=200,
xmin=0,
xmax=2,
ymin=-1,
ymax=2,
axis background/.style={fill=white},
title style={font=\bfseries},
title={matlab2tikz plot},
legend style={legend cell align=left, align=left, draw=white!15!black},
colorbar
]
\addplot[area legend, draw=none, table/row sep=crcr, patch, patch type=rectangle, shader=flat corner, patch table with point meta={%
0 1 4 5 -8\\
1 2 3 4 0\\
5 4 7 6 20\\
4 3 8 7 200\\
}]
table[row sep=crcr] {%
x y\\
0 0\\
1 0\\
2 -1\\
2 0\\
1 1\\
0 1\\
0 2\\
1 2\\
2 1\\
};
\end{axis}
\end{tikzpicture}%
\end{document}
我尝试改成shader = flat corner
,shader = interp
但是没有成功。