1

I have recently started using LaTeX for creating graphs for my thesis. So far I've just been focused on using pgfplots...plotting a function is no problem but I am having serious issues plotting a csv file. \

I always get the same error: "Package pgfplots Error: Could not read table file 'Heat_sources_SH_trial.csv' in 'search path=.'".

I've tried with code from several tutorials and people before and they say that it plots no problem for them. Because of this, I don't think this is a syntax issue but it must have something to do with reading the file from my drive. I've also tried several files that I've converted to csv's and several csv files that have been sent to me; but nothing works. I've included the latest code below (which is from a tutorial):

\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}

I have opened the csv files in notepad and confirmed that the columns are separated by commas. I'm really at a loss to what is going on, so if anyone has any idea I would appreciate it so much!

Thanks!

Kayla
  • 21
  • 1
  • 4
  • Can you share `Heat_sources_SH_trial.csv` (a couple of rows should be enough) and also state where it is located in relation to your tex file – samcarter_is_at_topanswers.xyz Aug 04 '20 at 18:21
  • Time from start of January 1 (h),Transformer (W),Elec equipment + lighting (W),Water tanks (W) 0.042,5.4,1194.5,43.75690471 0.125,150,1035,44.32023815 0.208,300,1050,44.13246039 – Kayla Aug 04 '20 at 18:32
  • I'm sorry but I'm not sure what you mean by where it is located in relation to my tex file. I'm using Overleaf for LaTeX and the csv file is on my C: drive – Kayla Aug 04 '20 at 18:33
  • @samcarter_is_at_topanswers.xyz sorry forgot to add your name to the comments...trying to get used to this :) – Kayla Aug 04 '20 at 18:46

0 Answers0