% Bar charts
% Author: Stefan Kottwitz
% https://www.packtpub.com/hardware-and-creative/latex-cookbook
\documentclass[border=10pt]{standalone} 
%%%<
\usepackage{verbatim}
%%%>
\begin{comment}
:Title: Bar chart
:Tags: Charts;Graphics;Tikz
:Author: Stefan Kottwitz
:Slug: bar-chart

A bar chart can be used for comparing values.
Here we create a horizontal bar chart.

The pgfplots package provides an easy way.
In this example, I reduced axis data to
focus on the values. So I do not show
x-axis and y-axis, or axis ticks.

Full explanation in Chapter 9, Creating Graphics:
[Building a bar chart](https://latex-cookbook.net/bar-chart/)
\end{comment}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[title  = Contributions per category
                          at LaTeX-Community.org,
    xbar,
    y axis line style = { opacity = 0 },
    axis x line       = none,
    tickwidth         = 0pt,
    ytick             = data,
    enlarge y limits  = 0.2,
    enlarge x limits  = 0.02,
    symbolic y coords = {LaTeX, Tools, Distributions, Editors},
    nodes near coords,
  ]
  \addplot coordinates { (57727,LaTeX)         (5672,Tools)
                         (2193,Distributions)  (11106,Editors) };
  \addplot coordinates { (14320,LaTeX)         (1615,Tools)
                         (560,Distributions)   (3075,Editors)  };
  \legend{Topics, Posts}
  \end{axis}
\end{tikzpicture}
\end{document}

