How to apply multiple filters for an axis in a pgfplot? I am not sure with the correct syntax in Latex.

I need this two filters:

x/(x^2/y)<12 ? x/(x^2/y) : 12
x/(x^2/y)>1 ? x/(x^2/y) : 1

Do I have to place it like an array?

Minimal working example:


            grid = both,
            faceted color=black,
            y domain=0:3500,
            z filter/.expression={
                x/(x^2/y)<12 ? x/(x^2/y) : 12
                x/(x^2/y)>1 ? x/(x^2/y) : 1 %%%%%% Error here
  • Please add a minimal working example (MWE). I could not find any reference to the expression key handler in the documentation of pgf and pgfplots. – TonioElGringo Feb 16 '17 at 8:37
  • I added this MWE. Reference in chapter 4.22, page 366. Version 1.13 from 2016/01/06. – Benjamin1956 Feb 16 '17 at 8:43
  • 1
    Thank you, I was reading an outdated version of the documentation... Looking at the implementation of the key handler, it seems that it is not possible to have multiple filters on the same coordinate. You can try something like this: x/(x^2/y)<12 ? (x/(x^2/y)>1 ? x/(x^2/y) : 1) : 12 – TonioElGringo Feb 16 '17 at 8:59

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.