Add section about pgfplots
This commit is contained in:
parent
1163a6039a
commit
916e4fc27a
7 changed files with 124 additions and 0 deletions
|
@ -15,6 +15,8 @@
|
||||||
\renewcommand{\glossarysection}[2][]{}
|
\renewcommand{\glossarysection}[2][]{}
|
||||||
\usepackage{hyperref}
|
\usepackage{hyperref}
|
||||||
\usepackage{listings,minted}
|
\usepackage{listings,minted}
|
||||||
|
\usepackage{pgfplots}
|
||||||
|
\pgfplotsset{width=7cm,compat=1.18}
|
||||||
\usepackage[duration=20]{pdfpc}
|
\usepackage[duration=20]{pdfpc}
|
||||||
\usetheme{metropolis}
|
\usetheme{metropolis}
|
||||||
\author{Julius Freudenberger}
|
\author{Julius Freudenberger}
|
||||||
|
@ -397,6 +399,74 @@
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
\section{Diagramme}
|
||||||
|
|
||||||
|
\begin{frame}[fragile]{Einbinden von pgfplots}
|
||||||
|
\begin{itemize}
|
||||||
|
\item Einbinden mit \verb|\usepackage|
|
||||||
|
\item Setzen der Version sehr empfohlen
|
||||||
|
\begin{itemize}
|
||||||
|
\item Garantiert gleiches Verhalten auch mit späteren Versionen von pgfplots
|
||||||
|
\item kann in neuen Dokumenten auf neue Version gesetzt werden (aktuell 1.18)
|
||||||
|
\end{itemize}
|
||||||
|
\end{itemize}
|
||||||
|
\inputminted{latex}{codebeispiele/pgfplots-setup.tex}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}[fragile]{Diagramme mit pgfplots}
|
||||||
|
\begin{columns}
|
||||||
|
\begin{column}{.49\textwidth}
|
||||||
|
\input{codebeispiele/pgfplots.tex}
|
||||||
|
\end{column}
|
||||||
|
\begin{column}{.5\textwidth}
|
||||||
|
\inputminted{latex}{codebeispiele/pgfplots.tex}
|
||||||
|
\end{column}
|
||||||
|
\end{columns}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}[fragile]{Syntax von pgfplots}
|
||||||
|
\begin{itemize}
|
||||||
|
\item Plot liegt immer in \verb|\tikzpicture| und \verb|axis|
|
||||||
|
\item Plot hinzufügen mit \verb|\addplot|
|
||||||
|
\item Plot endet mit \verb|;|
|
||||||
|
\item Achsen und Plots haben sehr viele Optionen, es gibt aber Defaults
|
||||||
|
\end{itemize}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Plots aus Daten}
|
||||||
|
\only<1>{
|
||||||
|
\begin{columns}
|
||||||
|
\begin{column}{.3\textwidth}
|
||||||
|
\inputminted{text}{codebeispiele/pgfplots-data.dat}
|
||||||
|
\end{column}
|
||||||
|
\begin{column}{.6\textwidth}
|
||||||
|
\inputminted{latex}{codebeispiele/pgfplots-plot-data.tex}
|
||||||
|
\end{column}
|
||||||
|
\end{columns}
|
||||||
|
}
|
||||||
|
\only<2>{
|
||||||
|
\centering
|
||||||
|
\input{codebeispiele/pgfplots-plot-data.tex}
|
||||||
|
}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}{Säulendiagramme}
|
||||||
|
\only<1>{
|
||||||
|
\begin{columns}
|
||||||
|
\begin{column}{.3\textwidth}
|
||||||
|
\inputminted{text}{codebeispiele/pgfplots-bars.dat}
|
||||||
|
\end{column}
|
||||||
|
\begin{column}{.6\textwidth}
|
||||||
|
\inputminted{latex}{codebeispiele/pgfplots-bar-chart.tex}
|
||||||
|
\end{column}
|
||||||
|
\end{columns}
|
||||||
|
}
|
||||||
|
\only<2>{
|
||||||
|
\centering
|
||||||
|
\input{codebeispiele/pgfplots-bar-chart.tex}
|
||||||
|
}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
\begin{frame}[fragile]{Bewerbungsunterlagen}
|
\begin{frame}[fragile]{Bewerbungsunterlagen}
|
||||||
\begin{columns}
|
\begin{columns}
|
||||||
\column{.5\textwidth}
|
\column{.5\textwidth}
|
||||||
|
|
13
codebeispiele/pgfplots-bar-chart.tex
Normal file
13
codebeispiele/pgfplots-bar-chart.tex
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
\begin{tikzpicture}
|
||||||
|
\begin{axis}[
|
||||||
|
title=Bar chart,
|
||||||
|
]
|
||||||
|
\addplot [
|
||||||
|
green,
|
||||||
|
fill=green!60!black,
|
||||||
|
ybar,
|
||||||
|
] table
|
||||||
|
{codebeispiele/pgfplots-bars.dat};
|
||||||
|
\legend{Quartalszahlen}
|
||||||
|
\end{axis}
|
||||||
|
\end{tikzpicture}
|
6
codebeispiele/pgfplots-bars.dat
Normal file
6
codebeispiele/pgfplots-bars.dat
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
3 -3
|
||||||
|
4 0
|
||||||
|
5 3
|
||||||
|
6 4
|
9
codebeispiele/pgfplots-data.dat
Normal file
9
codebeispiele/pgfplots-data.dat
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
-4 16
|
||||||
|
-3 9
|
||||||
|
-2 4
|
||||||
|
-1 1
|
||||||
|
0 0
|
||||||
|
1 1
|
||||||
|
2 4
|
||||||
|
3 9
|
||||||
|
4 16
|
12
codebeispiele/pgfplots-plot-data.tex
Normal file
12
codebeispiele/pgfplots-plot-data.tex
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
\begin{tikzpicture}
|
||||||
|
\begin{axis}[
|
||||||
|
title=Import from table,
|
||||||
|
xlabel={$x$},
|
||||||
|
ylabel={$y$},
|
||||||
|
legend pos = outer north east,
|
||||||
|
]
|
||||||
|
\addplot [blue] table
|
||||||
|
{codebeispiele/pgfplots-data.dat};
|
||||||
|
\legend{$\approx x^2$}
|
||||||
|
\end{axis}
|
||||||
|
\end{tikzpicture}
|
2
codebeispiele/pgfplots-setup.tex
Normal file
2
codebeispiele/pgfplots-setup.tex
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
\usepackage{pgfplots}
|
||||||
|
\pgfplotsset{compat=1.18}
|
12
codebeispiele/pgfplots.tex
Normal file
12
codebeispiele/pgfplots.tex
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
\begin{tikzpicture}
|
||||||
|
\begin{axis}[
|
||||||
|
title={Beispieldiagramm},
|
||||||
|
xlabel={$x$-Achse},
|
||||||
|
ylabel={$y$-Achse},
|
||||||
|
]
|
||||||
|
\addplot[red,
|
||||||
|
domain=-5:5,
|
||||||
|
samples=100] { x^2 };
|
||||||
|
\legend{$x^2$}
|
||||||
|
\end{axis}
|
||||||
|
\end{tikzpicture}
|
Loading…
Add table
Add a link
Reference in a new issue