# How to get this simple histogram?

I want to create this:

But I've come up with this one:

I've searched the internet first but the histograms they were plotting were so much complicated.

\begin{tikzpicture}
\begin{axis}[
symbolic x coords={$0$, $1$, $2$},
xtick=data]
($0$, 0.25
($1$, 0.50)
($2$, 0.25)
};
\end{axis}
\end{tikzpicture}


You easily can draw it like normal rectangles using tikz and fill with north east lines from the patterns library.

\documentclass[border=5pt,tikz]{standalone}
\usetikzlibrary{patterns}
\begin{document}

\begin{tikzpicture}[yscale=4]
\draw (-1.5,0)--(3,0) (-1,0)--(-1,.75);
\draw[pattern=north east lines] (-.5,0) rectangle (.5,.25) (.5,0) rectangle (1.5,.5) (1.5,0) rectangle (2.5,.25);
\foreach \x in {0,1,2}
\draw (\x,0) -- (\x,-1pt) node[below]{\footnotesize\x};
\foreach \y in {0.25,0.50}
\draw (-1,\y) -- ({-1cm-4pt},\y) node[left]{\footnotesize\y};
\end{tikzpicture}

\end{document}


• The filling part wasn't actually necessary for me. So, it's much appreciated, thanks a lot! Sep 1 '18 at 1:39
• You're welcome, good luck! Sep 1 '18 at 2:59