Histogram
- Tags
- math
Is a graph used to represent continuous data. The key feature of a histogram is that the area of a bar is proportional to the frequency it represents.
When plotting a histogram you need to calculate the frequency density of each bar as the frequency divided by the length of the class (the spread that was measured).
Table 1:
An example frequency distribution for the speed of of production in a factory. tbl:hist-eg
| Speed ||
For example, consider the distribution in tbl:hist-eg. If we plot this table as a histogram we get fig:hist-eg.
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
ymin=0,ymax=3.5,
ytick={0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5},]
\addplot[ybar interval]coordinates{(0,2.0)(40,2.0)};
\addplot[ybar interval]coordinates{(40,1.5)(50,1.5)};
\addplot[ybar interval]coordinates{(50,2.5)(60,2.5)};
\addplot[ybar interval]coordinates{(60,3.0)(90,3.0)};
\addplot[ybar interval]coordinates{(90,1.5)(110,1.5)};
\end{axis}
\end{tikzpicture}
\caption{A histogram for the data shown in \autoref{tbl:hist-eg}. Observe that the
area of each bar is equal to the frequency value for that class.}
\label{fig:hist-eg}
\end{figure}