\documentclass[12pt,a4paper,twocolumn,landscape]{exam}

\usepackage{xparse}
\usepackage{tikz}
   \usetikzlibrary{arrows,calc,fit}
\usepackage{mathtools}
\usepackage{fullpage}
\usepackage{todonotes}
\usepackage{float}
\usepackage[compact,explicit]{titlesec}% http://ctan.org/pkg/titlesec
\usepackage[utf8]{inputenc}
\usepackage{titling}
\usepackage{pgfplots}
\usepackage{wrapfig}
\usepackage{boxedminipage}
\usepackage{parskip} % Don't indent paragraphs

\usepackage{fib}
\usepackage{common}

\newcommand{\slice}[4]{
  \pgfmathparse{0.5*#1+0.5*#2}
  \let\midangle\pgfmathresult

  % slice
  \draw[thick,fill=black!10] (0,0) -- (#1:1) arc (#1:#2:1) -- cycle;

  % outer label
  \node[label=\midangle:#4] at (\midangle:1) {};

  % inner label
  \pgfmathparse{min((#2-#1-10)/110*(-0.3),0)}
  \let\temp\pgfmathresult
  \pgfmathparse{max(\temp,-0.5) + 0.8}
  \let\innerpos\pgfmathresult
  \node at (\midangle:\innerpos) {#3};
}

\pagestyle{headandfoot}

\firstpageheadrule
\firstpageheader{Ratios}
                {Level 5-6}
                {\today}

\runningheadrule
\runningheader{Ratios}
              {Ratios, Page \thepage\ of \numpages}
              {\today}

\firstpagefooter{}{}{}
\runningfooter{}{}{}

\begin{document}
\section*{Data Processing - Level 5-6}

\begin{wrapfigure}{R}{0.25\linewidth}
    \centering
    \begin{boxedminipage}{\linewidth}
        Keywords:
        \begin{itemize}
            \item Chart
            \item Graph
            \item Data
            \item Stem
        \end{itemize}
    \end{boxedminipage}
\end{wrapfigure}

Data can be represented in many ways, one useful way is to represent it as a
graph or chart.

\subsection*{Stem and Leaf Diagrams}

Stem and leaf diagrams are useful for displaying small to medium amounts of
numerical data.

For example, in the stem and leaf diagram below, you can see some test
results. By looking at the length of the row of numbers, you can tell how many
results fall in to each range.

A very important part of the stem and leaf diagram is the key, this tells you
how to interpret the data in the diagram.

\begin{table}[htbp]
    \centering
    \caption{Stem Plot of test results Key: $1 | 1= 11$}
    \begin{tabular}{r|*{9}{l}}
        Stem & \multicolumn{9}{l}{Leaf} \\
        \hline
        1 & 1 &   &   &   &   &   &   &   &   \\
        2 & 0 & 3 &   &   &   &   &   &   &   \\
        3 & 5 & 6 & 6 & 6 & 7 & 7 & 7 & 8 & 9 \\
        4 & 5 & 7 & 7 & 8 &   &   &   &   &   \\
    \end{tabular}
    \label{tab:addlabel}
\end{table}

\subsection*{Bar Charts}

Bar charts are another way of representing data, here the chart below
represents the number of different colour cars that passed a point on a road
over a hour.

\begin{figure}[H]
    \centering
    \begin{tikzpicture}
        \begin{axis}[
            symbolic x coords={Red, Green, Blue},
            xtick=data
          ]
            \addplot[ybar,fill=black!10] coordinates {
                (Red,   42)
                (Green,  50)
                (Blue,   80)
            };
        \end{axis}
    \end{tikzpicture}
\end{figure}

\subsection*{Pie Charts}

\begin{figure}[H]
    \centering
    \begin{tikzpicture}[scale=3]
        \newcounter{a}
        \newcounter{b}
        \foreach \p/\t in {20/type A, 4/type B, 11/type C,
        49/type D, 16/other}
        {
            \setcounter{a}{\value{b}}
            \addtocounter{b}{\p}
            \slice{\thea/100*360}
            {\theb/100*360}
            {\p\%}{\t}
        }
    \end{tikzpicture}
\end{figure}

\subsection*{Questions}

TODO

\end{document}
