6

Is is possible to give columns in a PGFPlots histogram custom interval of different sizes? Eg. I would like my histogram to have five columns over these intervals:

[-100,-50[
[-50,0[
[0,1[
[1,50[
[50,100[

So that 0 has a single column, preferably as wide as the other columns.

I cannot upload the exact diagram I am currently using, but this example from the pgfplots gallery is close enough:

\begin{tikzpicture}
\begin{axis}[
  ybar interval,
  xticklabel=
\pgfmathprintnumber\tick--\pgfmathprintnumber\nexttick
]
    \addplot+[hist={bins=3}]
        table[row sep=\\,y index=0] {
        data\\
        1\\ 2\\ 1\\ 5\\ 4\\ 10\\ 
        7\\ 10\\ 9\\ 8\\ 9\\ 9\\ 
    };
\end{axis}
\end{tikzpicture}

I would then like to specify the intervals for the data instead of just setting the number of bins and letting pgfplot figure it out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.