![僅來自 z 資料的曲面圖](https://rvso.com/image/391699/%E5%83%85%E4%BE%86%E8%87%AA%20z%20%E8%B3%87%E6%96%99%E7%9A%84%E6%9B%B2%E9%9D%A2%E5%9C%96.png)
我想從僅包含 z 資料的檔案中繪製網格曲面,並以矩陣形式排列。這個想法是繪製 z 資料與 x 索引和 y 索引的關係圖。有沒有一種簡單的方法可以做到這一點,或者我是否必須訴諸資料檔案的預處理?
pgfplots
(我在手冊和幾個 StackExchange 問題中進行了搜索,但沒有成功。)
虛擬資料範例:
CSV data file `data.txt'
M1,M2,M3,M4
0,0,0,0
3.466,2.058,0,0
4.262,2.976,0.001,0
3.822,3.168,0.006,0.008
2.953,2.936,0.019,0.063
2.065,2.492,0.046,0.265
1.332,1.977,0.092,0.734
0.797,1.478,0.164,1.508
MNWE(對於最小的非工作範例^^):
\documentclass{minimal}
\usepackage{pgfplots,pgfplotstable}
\begin{document}
\begin{tikzpicture}
\pgfplotstableread[col sep=comma]{data.txt}\csvdata
\begin{axis}
\addplot3[surf] table[x expr=\coordindex,y expr={SOME COLUMN INDEX?}] {\csvdata};
\end{axis}
\end{tikzpicture}
\end{document}