I want to plot data from a file using Tikz. I have a data file with 5 columns of data, and I want, for example to plot column 1 and 3 together. How can I make Tikz load the data from the correct columns?
Example of data file:
1,3,6
2,4,5
3,3,7
4,1,2
5,1,1
Current Latex:
\draw[color=blue] plot[smooth,mark=*,mark size=1pt] file {data.dat} node [right] {data};
Best Answer
You should use the
\addplot table
command frompgfplots
. Thex index=0
andy index=2
specify which column is to be selected (numbering starts from 0). I have two\addplot
commands to plot each column separately.