diff --git a/contents.tex b/contents.tex index 5f475bcccc0e669c9f2bb78af6ecc5e1d3e7b086..d54da4bf2afacfb9fe1858cbfce69bf28a6bdf08 100644 --- a/contents.tex +++ b/contents.tex @@ -90,7 +90,8 @@ wie alles angefangen hat. \label{sec:plot} Sie können mithilfe von \texttt{tikz} und \texttt{pgfplots} -ganz leicht Graphen erstellen: +ganz leicht Graphen oder Bar Charts erstellen, +wie in \cref{fig:the-plot,fig:long-caption} der gezeigt ist. \begin{figure}[ht] \centering @@ -110,6 +111,34 @@ ganz leicht Graphen erstellen: \label{fig:the-plot} \end{figure} +\begin{figure}[ht] + \centering + \begin{tikzpicture} + \begin{axis} + [ + ybar, + xtick=data, + enlarge x limits=1, + symbolic x coords={A, B}, + ymin=0, ymax=100, + ylabel={$\%$ percentage of bar height}, + ] + \addplot coordinates {(A,90) (B, 90)}; + \addplot coordinates {(A,75) (B, 75)}; + \addplot coordinates {(A,60) (B, 60)}; + \addplot coordinates {(A,45) (B, 45)}; + \addplot coordinates {(A,30) (B, 30)}; + \legend{blue, red, green, orange, cyan} + \end{axis} + \end{tikzpicture} + \caption[Short version of caption for List of Figures]{% + A really long caption title. This demonstrates how to describe stuff seen + in the figure, like here, where we see a bar plot showing my favourite + pies. Nah, actually it shows something completely different. + }\label{fig:long-caption} +\end{figure} + + \section{Formeln und Algorithmen} diff --git a/hhuthesis.cls b/hhuthesis.cls index 00e28562318d03d472281775c78bd1b3068af634..61ab6ae4781f9bb212fd4d20f91f5b28c9c67bbd 100644 --- a/hhuthesis.cls +++ b/hhuthesis.cls @@ -1,5 +1,5 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{hhuthesis}[2020/02/12 HHU Thesis LaTeX document class v1.12] +\ProvidesClass{hhuthesis}[2020/02/14 HHU Thesis LaTeX document class v1.13] \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} % Options fallback. \ProcessOptions\relax @@ -33,6 +33,9 @@ \newcommand{\blackwhiteprint}{ \printblackwhitetrue \pgfplotsset{cycle list name=hhubwcycle} + \pgfplotsset{% + /pgfplots/bar cycle list/.style={/pgfplots/cycle list name=hhubwbars} + } } @@ -84,10 +87,28 @@ loosely dashdotted,every mark/.append style={solid},mark=triangle\\ densely dotted,every mark/.append style={solid},mark=star\\ } +%% The same for bar plots +\pgfplotscreateplotcyclelist{hhucolorbars}{ + {fill=hhublue!30!white, draw=hhublue}, + {fill=hhured!30!white, draw=hhured}, + {fill=hhugreen!30!white, draw=hhugreen}, + {fill=hhuorange!30!white, draw=hhuorange}, + {fill=hhucyan!30!white, draw=hhucyan} +} +\pgfplotscreateplotcyclelist{hhubwbars}{ + {fill=black!75!white, draw=black}, + {fill=black!10!white, draw=black}, + {fill=black!65!white, draw=black}, + {fill=black!30!white, draw=black}, + {fill=black!50!white, draw=black} +} %% Default colour cycle list %% The colour cycle lists are further defined below. %% Note that calling \blackwhiteprint switches this to hhubwcycle. \pgfplotsset{cycle list name=hhucolorcycle} +\pgfplotsset{% + /pgfplots/bar cycle list/.style={/pgfplots/cycle list name=hhucolorbars} +}