我的代码片段:
\newcommand*{\datafile}{sr_data_test.csv}
\addplot [color=blue, solid, line width=1.0pt, mark size=3.0pt, mark=x, mark options={solid}]
table[x index =0, y index = 1, col sep=comma]{\datafile};
\addlegendentry{303.15K};
答案1
该代码片段运行良好:
\newcommand*{\datafile}{sr_data_test.csv}
\begin{filecontents*}{\datafile}
x,y
1,0
2,3
3,4
4,3
5,2
\end{filecontents*}
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot[
color=blue,
solid,
line width=1.0pt,
mark size=3.0pt,
mark=x,
mark options={solid}
] table[
x index=0,
y index=1,
col sep=comma
]{\datafile};
\addlegendentry{303.15K};
\end{axis}
\end{tikzpicture}
\end{document}