matplotlib - python plot horizontal line for a range of values -


i new python , trying plot speed constant value distince current startpointinmeters next startpointinmeters, speed constant start end (next start).

for example, speed should 13 distance 0 27.82 , 15 27.82 40.12 , on.

any idea?

startpointinmeters speed 0.0     13.0 27.82   15.0 40.12   14.0 75.33   14.0 172.77  17.0 208.64  18.0 253.0   21.0 335.21  20.0 351.16  25.0 590.38  22.0 779.37  21.0 968.35  22.0 1220.66 20.0 1299.17 19.0 1318.32 14.0 1352.7  9.0 

this can done step function of matplotlib:

import matplotlib.pyplot plt  x = [0., 27.82, 40.12, 75.33, 172.77, 208.64, 253., 335.21, 351.16,      590.38, 779.37, 968.35, 1220.66, 1299.17, 1318.32, 1352.7] v = [13., 15., 14., 14., 17., 18., 21., 20., 25., 22., 21., 22., 20.,       19., 14., 9.]   plt.step(x, v, where='post') plt.xlabel('position [m]') plt.ylabel('speed [m/s]') plt.show() 

result:

enter image description here

see this example difference between different values 'where' argument. description seems want 'post' option.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -