Skip to content
Snippets Groups Projects
Commit f4095ce8 authored by Jannik Dunkelau's avatar Jannik Dunkelau
Browse files

Fix colouring of bar charts

parent 49f371bc
No related branches found
No related tags found
No related merge requests found
...@@ -90,7 +90,8 @@ wie alles angefangen hat. ...@@ -90,7 +90,8 @@ wie alles angefangen hat.
\label{sec:plot} \label{sec:plot}
Sie können mithilfe von \texttt{tikz} und \texttt{pgfplots} 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] \begin{figure}[ht]
\centering \centering
...@@ -110,6 +111,34 @@ ganz leicht Graphen erstellen: ...@@ -110,6 +111,34 @@ ganz leicht Graphen erstellen:
\label{fig:the-plot} \label{fig:the-plot}
\end{figure} \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} \section{Formeln und Algorithmen}
......
\NeedsTeXFormat{LaTeX2e} \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. \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} % Options fallback.
\ProcessOptions\relax \ProcessOptions\relax
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
\newcommand{\blackwhiteprint}{ \newcommand{\blackwhiteprint}{
\printblackwhitetrue \printblackwhitetrue
\pgfplotsset{cycle list name=hhubwcycle} \pgfplotsset{cycle list name=hhubwcycle}
\pgfplotsset{%
/pgfplots/bar cycle list/.style={/pgfplots/cycle list name=hhubwbars}
}
} }
...@@ -84,10 +87,28 @@ ...@@ -84,10 +87,28 @@
loosely dashdotted,every mark/.append style={solid},mark=triangle\\ loosely dashdotted,every mark/.append style={solid},mark=triangle\\
densely dotted,every mark/.append style={solid},mark=star\\ 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 %% Default colour cycle list
%% The colour cycle lists are further defined below. %% The colour cycle lists are further defined below.
%% Note that calling \blackwhiteprint switches this to hhubwcycle. %% Note that calling \blackwhiteprint switches this to hhubwcycle.
\pgfplotsset{cycle list name=hhucolorcycle} \pgfplotsset{cycle list name=hhucolorcycle}
\pgfplotsset{%
/pgfplots/bar cycle list/.style={/pgfplots/cycle list name=hhucolorbars}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment