Based on How to plot data from multiple filters using pgfplots I got a follow up one. I would like to filter not only for one value of P for each plot but for also for X values that are smaller than a given value. Here is how I tried to achieve it.
\pgfplotsset{
discard if not and smaller/.style 4 args={
x filter/.code={
\edef\tempa{\thisrow{#1}}
\edef\tempb{#2}
\edef\tempc{\thisrow{#3}}
\edef\tempd{#4}
\ifnum\tempa=\tempb
\ifnum\tempc<\tempd
\def\pgfmathresult{inf}
\else
\fi
\else
\def\pgfmathresult{inf}
\fi
}
}
}
\begin{tikzpicture}
\begin{axis}
\addplot [ultra thick, black, discard if not and smaller={P}{0}{X}{5}] table [x=X, y=Y] {data.dat};
\end{tikzpicture}
But pdfLaTeX tells me that:
! Package pgfkeys Error: I do not know the key '/pgfplots/discard if not and sm
aller/.style 4 args' and I am going to ignore it. Perhaps you misspelled it.
How can I pass these 4 arguments so that pgfplots find the style definition?