LaTeX_Examples/Piecharts/Piecharts.tex

221 lines
6.2 KiB
TeX
Raw Permalink Normal View History

2024-12-05 20:20:53 +00:00
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{hyperref}
\usepackage{tikz}
\usepackage{wheelchart}
\usetikzlibrary{decorations.markings}
\usepackage{siunitx}
\usepackage{adjustbox}
\definecolor{blu}{RGB}{102,140,217}
\definecolor{giallo}{RGB}{255,153,0}
\definecolor{rosso}{RGB}{220,57,18}
\definecolor{viola}{RGB}{153,0,153}
\setlength{\parindent}{0pt}
\hypersetup{
colorlinks=true,
linkcolor=blue,
citecolor=blue,
filecolor=magenta,
urlcolor=blue,
}
\begin{document}
% Insert Image at specified Position
The following \autoref{image0} is inserted at the specified position.
\begin{figure}[h]
\centering
\begin{tikzpicture}
\wheelchart[
counterclockwise,
data=\WCperc,
data style={shift={(0,0.1)}},
gap=0.03,
legend columns=2,
legend row={\tikz\fill[\WCvarB,draw=black] (0,0) rectangle (0.3,0.3); & \WCvarC},
legend={
\node[anchor=north] at (0,-2.5) {%
\begin{tabular}{*{2}{l@{ }l}}%
\WClegend%
\end{tabular}%
};
},
lines=0.5,
lines angle shift{1}=20,
lines angle shift{3}=-20,
lines ext=2,
lines ext left anchor=base west,
lines ext right anchor=base east,
lines sep=-1,
lines style={
postaction=decorate,
decoration={
markings,
mark=at position 0 with {
\fill (0,0) circle[radius=0.1];
}
}
},
radius={0}{2},
title=Open Source,
title style={font=\bfseries}
]{
50/viola/Ja,
50/giallo/Nein
}
\end{tikzpicture}
\caption{image}
\label{image0}
\end{figure}
This Reference to \autoref{image0} was inserted below the figure at the specified position. \\\\
It turns out that to use subfig with tikz, you need an adjustbox!
\begin{figure}[h]
\centering
\begin{subfigure}[b]{0.3\textwidth}
\begin{adjustbox}{width=\linewidth}
\begin{tikzpicture}
\wheelchart[
counterclockwise,
data=\WCperc,
data style={shift={(0,0.1)}},
gap=0.03,
legend columns=2,
legend row={\tikz\fill[\WCvarB,draw=black] (0,0) rectangle (0.3,0.3); & \WCvarC},
legend={
\node[anchor=north] at (0,-2.5) {%
\begin{tabular}{*{2}{l@{ }l}}%
\WClegend%
\end{tabular}%
};
},
lines=0.5,
lines angle shift{1}=20,
lines angle shift{3}=-20,
lines ext=2,
lines ext left anchor=base west,
lines ext right anchor=base east,
lines sep=-1,
lines style={
postaction=decorate,
decoration={
markings,
mark=at position 0 with {
\fill (0,0) circle[radius=0.1];
}
}
},
radius={0}{2},
title=Open Source,
title style={font=\bfseries}
]{
50/viola/Ja,
50/giallo/Nein
}
\end{tikzpicture}
\end{adjustbox}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\begin{adjustbox}{width=\linewidth}
\begin{tikzpicture}
\wheelchart[
counterclockwise,
data=\WCperc,
data style={shift={(0,0.1)}},
gap=0.03,
legend columns=2,
legend row={\tikz\fill[\WCvarB,draw=black] (0,0) rectangle (0.3,0.3); & \WCvarC},
legend={
\node[anchor=north] at (0,-2.5) {%
\begin{tabular}{*{2}{l@{ }l}}%
\WClegend%
\end{tabular}%
};
},
lines=0.5,
lines angle shift{1}=20,
lines angle shift{3}=-20,
lines ext=2,
lines ext left anchor=base west,
lines ext right anchor=base east,
lines sep=-1,
lines style={
postaction=decorate,
decoration={
markings,
mark=at position 0 with {
\fill (0,0) circle[radius=0.1];
}
}
},
radius={0}{2},
title=Open Source,
title style={font=\bfseries}
]{
50/viola/Ja,
50/giallo/Nein
}
\end{tikzpicture}
\end{adjustbox}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\begin{adjustbox}{width=\linewidth}
\begin{tikzpicture}
\wheelchart[
counterclockwise,
data=\WCperc,
data style={shift={(0,0.1)}},
gap=0.03,
legend columns=2,
legend row={\tikz\fill[\WCvarB,draw=black] (0,0) rectangle (0.3,0.3); & \WCvarC},
legend={
\node[anchor=north] at (0,-2.5) {%
\begin{tabular}{*{2}{l@{ }l}}%
\WClegend%
\end{tabular}%
};
},
lines=0.5,
lines angle shift{1}=20,
lines angle shift{3}=-20,
lines ext=2,
lines ext left anchor=base west,
lines ext right anchor=base east,
lines sep=-1,
lines style={
postaction=decorate,
decoration={
markings,
mark=at position 0 with {
\fill (0,0) circle[radius=0.1];
}
}
},
radius={0}{2},
title=Open Source,
title style={font=\bfseries}
]{
50/viola/Ja,
50/giallo/Nein
}
\end{tikzpicture}
\end{adjustbox}
\end{subfigure}
\end{figure}
\pagebreak
\listoffigures
\end{document}