从宏读取内联表

从宏读取内联表

对于补丁图,我需要从先前定义的宏中读取补丁表\mytable。但是这会导致错误:

 ! Package pgfplots Error: Sorry, the choice 'row sep=crcr' is currently only av
ailable for inline tables, not for external files.

See the pgfplots package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.15 ...s { (0,0) (1,1) (2,0) (3,1) (2,0) (4,0) };

?

带有来自宏的内联表的失败文档:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}

\begin{document}
\def\mytable{
0 1 2 100\\
1 2 3 10\\
4 3 5 0\\}

\begin{tikzpicture}
\begin{axis}
% this uses per-patch color data:
\addplot[patch,table/row sep=\\, patch table with point meta=\mytable]
coordinates { (0,0) (1,1) (2,0) (3,1) (2,0) (4,0) };
\end{axis}
\end{tikzpicture}
\end{document}

内联表的工作示例如下

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}

\begin{document}
\begin{tikzpicture}
\begin{axis}
% this uses per-patch color data:
\addplot[patch,table/row sep=\\, patch table with point meta={
  0 1 2 100\\
  1 2 3 10\\
  4 3 5 0\\
}]
coordinates { (0,0) (1,1) (2,0) (3,1) (2,0) (4,0) };
\end{axis}
\end{tikzpicture}
\end{document}

我该如何修改第一个代码才能产生与第二个代码相同的结果?

相关内容