I am trying to create a simple time series plot of daily price data using pgfplots. My data file is in CSV format and in the same folder as my working Tex file.
The data file has header titles in each of the top cells (Date and Price). All I need to do is plot the Closing Price on the y axis vs the time in the x axis. The time is in the form: 2010.542466, 2010.545205,... etc for daily price data. The code I have tried thus far in Latex looks like this:
\pgfplotstableread[col sep = comma]{coindesk.csv}
\begin{tikzpicture}
\begin{axis}[
xlabel=t,
ylabel=Close]
\addplot table[x=t,y=Close] {coindesk.csv};
\end{axis}
\end{tikzpicture}
However I get a series of error messages. Any help would be appreciated.
EDIT: The first three lines of my data look like:
t Close
2010.542466 0.09
2010.545205 0.08
2010.547945 0.07
\pgfplotstableread
you need to specify a macroname to save the table to, e.g.\pgfplotstableread{filename.dat}\mydata
. But you don't need to use\pgfplotstableread
as you've added the filename directly in your\addplot
. So then you might needcol sep=comma
there. Does that help? If not, which errors do you get exactly? And can you add the first three lines of your data file exactly like they appear in the file?.csv
file relative to your.tex
file? Same folder, or different folder?