I have seen some questions asked about step functions in matplotlib but this one is different. Here is my function:
def JerkFunction(listOfJerk):
\'\'\'R
It's not clear exactly what you're trying to do, but I think this may produce the plot you are looking for. If this is not what you are looking for it will be easier to assist you with more information.
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0,5,4)
y = [1,1,-1,1]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.step(x,y)
ax.set_xlabel('Time (s)')
ax.set_ylabel(r'Jerk ($m/s^3$)')
ax.set_ylim((-1.5,1.5))
ax.set_title('Jerk Produced by the Engine')
plt.show()
