Skip to content

Commit

Permalink
Add example for plotting values read from csv files with pgfplots
Browse files Browse the repository at this point in the history
  • Loading branch information
diehlpk committed Feb 28, 2018
1 parent 1e35490 commit 4048ff8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions data/data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
a,b,c,d
1,4,5,1
2,3,1,5
3,5,6,1
4,1,4,9
5,3,4,7
13 changes: 13 additions & 0 deletions latexhints-english.tex
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,19 @@ \section{Weitere Illustrationen}
\end{center}
\caption{Plot of $\sin(x)$ direclty inside the figure environment with pgfplots.}
\end{figure}

\begin{figure}[h]
\begin{center}
\begin{tikzpicture}
\begin{axis}[xlabel=$x$,
ylabel=$y$]
\addplot table [x=a, y=c, col sep=comma] {data/data.csv}; % Read coordinates from csv file and plot them
\end{axis}
\end{tikzpicture}
\end{center}
\caption{Coordinates $x$ and $y$ read from csv file and plotted pgfplots.}
\end{figure}

}{}

\IfFileExists{tikz.sty}{
Expand Down
13 changes: 13 additions & 0 deletions latexhints-german.tex
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,19 @@ \section{Weitere Illustrationen}
\end{center}
\caption{$\sin(x)$ mit pgfplots.}
\end{figure}

\begin{figure}[h]
\begin{center}
\begin{tikzpicture}
\begin{axis}[xlabel=$x$,
ylabel=$y$]
\addplot table [x=a, y=c, col sep=comma] {data/data.csv}; % Koordinaten aus einer CSV-Datei lesen und plotten
\end{axis}
\end{tikzpicture}
\end{center}
\caption{Koordianten $x$ und $y$ aus einer CSV-Datei geplottet mit pgfplots.}
\end{figure}

}{}

\IfFileExists{tikz.sty}{
Expand Down

0 comments on commit 4048ff8

Please sign in to comment.