PGF addplot3 不适用于 x、y、z 数据表的三角区域

PGF addplot3 不适用于 x、y、z 数据表的三角区域

我有一个存储 x、y、z 值的文件example.dat。此文件的尺寸为 6000 行(包括标题行)和 3 列。我正在使用 pgf 生成表面图。MWE 如下所示。我不断收到以下错误消息:

Package pgfplots Error: Sorry, 'plot mesh' needs either '[mesh/rows=<N>]' or '[mesh/cols=<N>]' set, but it did not find any of them. I also tried rows = sqrt(num points) = sqrt(6045) = 77.74959

当我添加mesh/rows=<N>以匹配中的行数后example.dat,我收到另一条错误消息:

Package pgfplots Error: the arguments of [mesh/rows=6047, mesh/cols=3] assume 18141 points, but I actually got N = 6045 points! The data appears to be incomplete or over complete

我怀疑这个错误是因为样本中的数据是example.dat一个三角形区域,第一列是 x 值,第二列是 y 值,第三列是该三角形区域中的 z 值。我在下面附上了一小段内容example.dat

如何使表面图发挥作用?请参阅平均能量损失以及下面的 example.dat 片段:

平均能量损失

\documentclass[tikz]{standalone}
\usepackage{pgf,pgfplots,pgfplotstable} 
\usepackage{filecontents}   
\usetikzlibrary{shapes,fit, decorations.pathmorphing} 
\usetikzlibrary{matrix}

\pgfplotsset{compat=newest}

\begin{document}

\pgfplotstableread{example.dat}{\surface}

\begin{tikzpicture}[]
    \begin{axis}[
        mesh/rows=6047, 
        mesh/cols=3,
        view={45}{30},
        ]
    \addplot3[surf] table [x ={X}, y={Y}, z={Z}] {\surface};        

    \end{axis}
\end{tikzpicture}
\end{document}

example.dat 文件的片段

X   Y   Z
0.46608831586965926 0.11557597337182614 0.0000221656414657323
0.46608831586965926 0.11657597337182614 0.
0.46708831586965927 0.11487986777623747 0.00008847564624375748
0.46708831586965927 0.11587986777623747 0.
0.46708831586965927 0.11687986777623748 0.
0.46808831586965927 0.1141837621806488  0.0001986557070272621
0.46808831586965927 0.1151837621806488  0.
0.46808831586965927 0.1161837621806488  0.
0.46808831586965927 0.1171837621806488  0.
0.46908831586965927 0.11348765658506015 0.0003524394523312657
0.46908831586965927 0.11448765658506015 0.
0.46908831586965927 0.11548765658506015 0.
0.46908831586965927 0.11648765658506015 0.
0.46908831586965927 0.11748765658506015 0.
0.46908831586965927 0.11848765658506015 0.
0.47008831586965927 0.11279155098947148 0.0005495682535301971
0.47008831586965927 0.11379155098947148 0.
0.47008831586965927 0.11479155098947148 0.
0.47008831586965927 0.11579155098947148 0.
0.47008831586965927 0.11679155098947148 0.
0.47008831586965927 0.11779155098947149 0.
0.47008831586965927 0.11879155098947149 0.
0.47108831586965927 0.11209544539388283 0.000789791040502974
0.47108831586965927 0.11309544539388283 0.
0.47108831586965927 0.11409544539388283 0.
0.47108831586965927 0.11509544539388283 0.
0.47108831586965927 0.11609544539388283 0.
0.47108831586965927 0.11709544539388284 0.
0.47108831586965927 0.11809544539388284 0.
0.47108831586965927 0.11909544539388284 0.
0.47208831586965927 0.11139933979829414 0.0010728641255012272
0.47208831586965927 0.11239933979829414 0.
0.47208831586965927 0.11339933979829414 0.
0.47208831586965927 0.11439933979829414 0.
0.47208831586965927 0.11539933979829414 0.
0.47208831586965927 0.11639933979829414 0.
0.47208831586965927 0.11739933979829414 0.
0.47208831586965927 0.11839933979829415 0.
0.47208831586965927 0.11939933979829415 0.
0.47308831586965927 0.11070323420270549 0.0013985510348768493
0.47308831586965927 0.11170323420270549 0.
0.47308831586965927 0.11270323420270549 0.
0.47308831586965927 0.11370323420270549 0.
0.47308831586965927 0.11470323420270549 0.
0.47308831586965927 0.1157032342027055  0.
0.47308831586965927 0.1167032342027055  0.
0.47308831586965927 0.1177032342027055  0.
0.47308831586965927 0.11870323420270548 0.
0.47308831586965927 0.11970323420270548 0.
0.47308831586965927 0.12070323420270548 0.
0.47408831586965927 0.11000712860711681 0.001766622348345348
0.47408831586965927 0.11100712860711681 0.
0.47408831586965927 0.11200712860711681 0.
0.47408831586965927 0.11300712860711681 0.
0.47408831586965927 0.11400712860711681 0.
0.47408831586965927 0.11500712860711682 0.
0.47408831586965927 0.11600712860711682 0.
0.47408831586965927 0.11700712860711682 0.
0.47408831586965927 0.11800712860711682 0.
0.47408831586965927 0.11900712860711682 0.
0.47408831586965927 0.1200071286071168  0.
0.47408831586965927 0.1210071286071168  0.
0.4750883158696593  0.10931102301152815 0.002176855545407197
0.4750883158696593  0.11031102301152815 0.
0.4750883158696593  0.11131102301152815 0.
0.4750883158696593  0.11231102301152815 0.
0.4750883158696593  0.11331102301152815 0.
0.4750883158696593  0.11431102301152815 0.
0.4750883158696593  0.11531102301152815 0.
0.4750883158696593  0.11631102301152815 0.
0.4750883158696593  0.11731102301152815 0.
0.4750883158696593  0.11831102301152815 0.
0.4750883158696593  0.11931102301152814 0.
0.4750883158696593  0.12031102301152814 0.
0.4750883158696593  0.12131102301152814 0.
0.4760883158696593  0.10861491741593947 0.002629034858747714

相关内容