# filter pgfplots data more than once (e.g. with discard if)

You can filter the data more than once by adapting the code (which was originally posted in an answer to Is it possible to change the color of a single bar when the bar plot is based on symbolic values? and Different color for individual bar in bar chart & adding bar labels) slightly, using x filter/.append code instead of x filter/.code:

For filtering on a symbolic column:

\pgfplotsset{
x filter/.append code={
\edef\tempa{\thisrow{#1}}
\edef\tempb{#2}
\ifx\tempa\tempb
\def\pgfmathresult{inf}
\fi
}
},
x filter/.append code={
\edef\tempa{\thisrow{#1}}
\edef\tempb{#2}
\ifx\tempa\tempb
\else
\def\pgfmathresult{inf}
\fi
}
}
}


For filtering on a numerical column:

\pgfplotsset{
x filter/.append code={
\ifdim\thisrow{#1} pt=#2pt
\def\pgfmathresult{inf}
\fi
}
},