Building a bar chart
A classic way of displaying categories with corresponding values is a bar chart. It consists of rectangular bars, and they are proportional to the represented values. The main purpose is to visually compare those values.
We will draw a chart visualizing web forum statistics.
How to do it...
We will use the pgfplots
package. It's for natively plotting in LaTeX with a convenient user interface. We will use it to produce a horizontal bar chart.
Perform these steps:
Start with a document class:
\documentclass{article}
Load the
pgfplots
package:\usepackage{pgfplots} \pgfplotsset{width=7cm,compat=1.8}
Begin the document:
\begin{document}
Begin a TikZ picture, which will be the container for the plot:
\begin{tikzpicture}
Open an axis environment:
\begin{axis}
Give options to the axis:
[ title = Contributions per category at LaTeX-Community.org, xbar, y axis line style = { opacity = 0 }, axis x line = none, tickwidth = 0pt, enlarge...