# Build a real histogram in pgfplots

Always in my long learning TikZ, I would build a "real" histogram from the following set of data :

## 3000 2

The idea is to group the data into amplitude classes with 300 as the minimum value xmin=800 and xmax = 3200. Also, I would not want the y axis but only the grid. There should also be a legend to indicate the unit area.

    \usemodule[tikz]
\usemodule[pgfplots]
\usepgfplotslibrary[statistics]
\pgfplotsset{width=12cm, compat=1.11}
\usemodule[filecontents]
\starttext
\starttikzpicture
\switchtobodyfont[10pt]
\startaxis[
width=10cm,
height=13cm,
ybar interval,
xtick=data,
xticklabel interval boundaries,
x tick label style= {rotate=90,anchor=east,/pgf/number format/1000 sep={}},
axis y line=left,
axis x line=bottom,
enlarge x limits,
ymin=0,
thick,grid=major,
]
coordinates {(800,5) (1100,8) (1400,24) (1700,0) (2000,0) (2300,13)
(2600,0) (2900,2) (3200,0)};
\stopaxis
\stoptikzpicture


• Pardon if I missed it, but what is your question? – darthbith Jan 20 '15 at 22:09
• @ darthbith I modified my original question to clarify – Fabrice Jan 21 '15 at 22:19
• Better no to change the original question, because the others can not see wat the problem was... – Arne Timperman Jan 22 '15 at 12:27
• I still don't get what the question is. Can you make picture of how you want it to look like. – jens_bo Jan 25 '15 at 16:00
• @ jens_bo The picture does not fit the data, but that's what I want to do. – Fabrice Jan 25 '15 at 20:05

I made for my self a histogram this way:

\documentclass[11pt,a4paper]{article}
\usepackage{geometry}
\geometry{margin=1in}

\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{calc,intersections,through,backgrounds,snakes}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usepgfplotslibrary{statistics}
\usepackage{bchart}
\begin{center}
\begin{tikzpicture}
\begin{axis}[
width=1*\textwidth,
height=6cm,
xmin=-1.5,xmax=13.5,
ymin=0, ymax=7,
title=Histogram lichaamslengte,
ybar interval,
xticklabel={[\pgfmathprintnumber\tick;\pgfmathprintnumber\nexttick [}],
table[row sep=\\,y index=0] {
data\\
1\\ 2\\ 1\\ 5\\ 4\\ 10\\ 4\\ 5\\ 7\\ 10\\ 9\\ 8\\ 9\\ 9\\ 11\\
};