With gnuplot one can do a plot like that :

http://www.deqnotes.net/gnuplot/images/impulses.png

It is using option "with impulse".
Is there an equivalent in matplotlib?