0

我最近开始使用 LaTeX 为我的论文创建图表。到目前为止,我一直专注于使用 pgfplots...绘制函数没问题,但我在绘制 csv 文件时遇到了严重问题。\

我总是遇到同样的错误:“Package pgfplots Error: could not read table file 'Heat_sources_SH_trial.csv' in 'search path=.'”。

我之前已经尝试过几个教程和人的代码,他们说这对他们来说没有问题。因此,我认为这不是语法问题,但它一定与从我的驱动器中读取文件有关。我还尝试了几个已转换为 csv 的文件和几个已发送给我的 csv 文件;但没有任何效果。我在下面包含了最新的代码(来自教程):

\documentclass{standalone}

\usepackage{tikz}

\usepackage{pgfplots}

\usepackage{siunitx}

\pgfplotsset{compat=newest} 

\usepgfplotslibrary{units}
 

\sisetup{
  round-mode          = places,
  round-precision     = 2,
}

\begin{document}

\begin{tikzpicture}

\begin{axis}[

xmin = 0, xmax = 30,
ymin = -1.5, ymax = 2.0,
xtick distance = 5,
ytick distance = 1,
grid = both,
minor tick num = 1,
major grid style = {lightgray},
minor grid style = {lightgray!25},
width = \textwidth,
height = 0.5\textwidth,

]


\addplot[] table[col sep=comma, x=Time from start of January 1 (h), y=Transformer (W)]
{Heat_sources_SH_trial.csv};


\end{axis}

\end{tikzpicture}

\end{document}

我已经在记事本中打开了 csv 文件,并确认这些列是用逗号分隔的。我真的不知道发生了什么,所以如果有人有任何想法,我会非常感激!

谢谢!

4

0 回答 0