在以下 MWE 中,散点图addplot3
与提供的数据一起工作。contour
但是,该图抛出了以下内容:
Errors:
garden_heatmap.tex:38: Package pgfplots Error: sorry, plot file{temp_contourtmp0.table} could not be opened. [...{x}, y={y}, z={frequency}] {\contourdata};]
Warnings:
garden_heatmap.tex: LaTeX Warning: Overwriting file `./contourdata.csv'.
garden_heatmap.tex: Package pgfplots Warning: running in backwards compatibility mode (unsuitable tick labels; missing features). Consider writing \pgfplotsset{compat=1.14} into your preamble.
garden_heatmap.tex:38: Package pgfplots Warning: the current plot has no coordinates (or all have been filtered away) on input line 38.
garden_heatmap.tex:40: 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 40.
这里,MWE:
\documentclass[11pt,tikz]{standalone}
\usepackage{tikz,pgfplots}
\usepackage{filecontents}
\begin{filecontents}{contourdata.csv}
x,y,frequency
0,0,1959
0,1,1906
0,2,1726
0,3,1753
0,4,1648
1,0,3328
1,1,2486
1,2,2109
1,3,1951
1,4,1785
2,0,2911
2,1,2508
2,2,2196
2,3,2048
2,4,1897
3,0,2396
3,1,2238
3,2,2104
3,3,2114
3,4,2084
4,0,2153
4,1,2198
4,2,2279
4,3,2249
4,4,2182
\end{filecontents}
\begin{document}
\pgfplotstableread[col sep=comma]{contourdata.csv}{\contourdata}
\begin{tikzpicture}
\begin{axis}[]%
%\addplot3[contour gnuplot={output point meta=rawz}, mesh/rows=5, mesh/cols=5] table[x={x}, y={y}, z={frequency}] {\contourdata};
\addplot3[only marks,scatter] table[x={x}, y={y}, z={frequency}] {\contourdata};
\end{axis}
\end{tikzpicture}
\end{document}
编辑:
考虑到这问题:我已经安装了 gnuplot 并且启用了 shell-escape。