Piecewise funtion using Matplolib for Python.