数据的等高线图,其中数据的形式为 x_i,y_i,f(x_i,y_i)

数据的等高线图,其中数据的形式为 x_i,y_i,f(x_i,y_i)

我想使用 pgfplots 在等高线图中绘制以下数据:数据.txt。数据的形式为 x_i、y_i、f(x_i,y_i),包含 NaN 值。我能够使用 pgfplots 在曲面图中绘制此精确数据。

我已经阅读了 pgfplots 文档的第 4.6.8 节,但我仍然不清楚如何执行此操作。这是我对 MWE 的尝试:

\documentclass{article}

\usepackage{tikz,pgfplots}
\pgfplotsset{compat = 1.8}

\begin{document}

\begin{tikzpicture}
 \begin{axis}[ view = {0}{90} ]
    \addplot3[ contour gnuplot ]
             file {data.txt};
 \end{axis}
\end{tikzpicture}

\end{document}  

我收到的错误是(我的文件名是 plot_data.tex):

PGFPlots: reading {data.txt}
runsystem(gnuplot "plot_data_contourtmp0.script")...disabled (restricted).

! Package pgfplots Error: sorry, plot file{plot_data_contourtmp0.table} could not be opened.

即使我将所有 NaN 值替换为零,我仍然收到同样的错误。

编辑我已经安装了 gnuplot。我使用 Miktex 2.9 和 WinEdt 8.0。我已使用选项 --tex-option=-shell-escape 启用了 shell 转义,用于我经常使用的 PDFTeXify。我得到了与以前相同的错误,但现在下面有一些更具描述性的文本:

Package pgfplots Warning: the current plot has no coordinates 
(or all have been filtered away) on input line 35.

 [warning /pgfplots/warning/plot without coordinates]

Package pgfplots Warning: You have an axis with empty range (in direction z). 
Replacing it with a default range and clearing all plots. on input line 36.

 [warning /pgfplots/warning/empty range cleared axis]

相关内容