0

I want to export my data in two columns (x and y) and plot them using tikz package in LaTeX. Is there a way to it from a large number of rows? A code snippet would be sufficient.

Kostas
  • 270
  • 1
  • 3
  • 10

1 Answers1

2

Take a look at the pgfplots package. Here a simple example:

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\usepackage{filecontents}

% The content of the data file "data.dat".
% Delete this block if you have your data in an external file.
\begin{filecontents}{data.dat}
x y
0 0.2
1 3.3
2 1.5
3 1.1
4 2.5
\end{filecontents}

\begin{document}
\begin{tikzpicture}
  \begin{axis}
      \addplot table {data.dat};
  \end{axis}
\end{tikzpicture}
\end{document}

The result:

enter image description here

sergej
  • 17,147
  • 6
  • 52
  • 89