I’d like to plot some function f(x) where f(x) = x for 0 ≤ x ≤ a, and −2 otherwise. And I’d like to plot it on a graph with x axes between two arbitrary points.
How would I go about doing this with Gnuplot?
This is straight out of the gnuplot documentation ("help ternary"):
f(x) = (x>=0 && x <=a)?x:-2
After setting a value for a, you will be able to plot this function over any range you want.