# Bar plot in PGF plots with no upper limit

I assesed particke size distribution using sieve analysis. Now I want to present the results using PGFplots. The largest opening was 1 mm. I can plot finite intervals (e.g. 0.25 mm -- 0.50 mm), but I don't know how to plot '1 mm and larger', I have to give a finite upper bound.

This is what I have so far:

\begin{tikzpicture}[scale=1.05]
\begin{axis}[
ybar interval,
grid=none,
xlabel={średnica oczek [\si{\milli\meter}]},
ylabel={masa [\si{\gram}]},
minor y tick num=9,
xtick=data,
x tick label style={rotate=90,anchor=east}
]
\addplot[] table[x=sred, y=masa] {cw4.dat};
\end{axis}
\end{tikzpicture}


cw4.dat:

sred    masa
0.000   0.18
0.125   0.72
0.250   1.11
0.500   1.04
1.000   0.02
2.000   0.02


2.000 is the upper bound for the last interval, but the last interval should have no upper bound and I don't know how to do it in PGFplots.

This is what I have:

This is what I want to have:

• There is an inf operator in pgfplots (it behaves like a number), but I cannot try it right now if it fits to your problem. – Malipivo Apr 3 '14 at 11:08

You can define the xticklabel depending on the value of the current xtick

xticklabel={\pgfmathparse{\tick<1?
"\noexpand\pgfmathprintnumber\noexpand\tick--\noexpand\pgfmathprintnumber\noexpand\nexttick"
:"$\noexpand>1$"}\pgfmathresult}


Code:

\documentclass[margin=10pt]{standalone}
\usepackage{pgfplots,siunitx}
\pgfplotsset{compat=1.8}
\usetikzlibrary{babel}
\usepackage[polish]{babel}
\usepackage{polski}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ybar interval,
grid=none,
xlabel={średnica oczek [\si{\milli\meter}]},
ylabel={masa [\si{\gram}]},
minor y tick num=9,
xtick=data,
x tick label style={rotate=90,anchor=east},
xticklabel={\pgfmathparse{\tick<1?
"\noexpand\pgfmathprintnumber\noexpand\tick--\noexpand\pgfmathprintnumber\noexpand\nexttick"
:"$\noexpand>1$"}\pgfmathresult}
]
\addplot[] table[x=sred, y=masa] {cw4.dat};
\end{axis}
\end{tikzpicture}
\end{document}


• Your solution seems to work, unfortunately I use \usepackage[polish]{babel} \usepackage{polski} which seem incompatible with your solution – Kot789 Apr 3 '14 at 18:48
• Then you have to load the tikzlibrary babel in addition. I have changed the code. – esdd Apr 3 '14 at 22:39