in python, I would like to use:
from pylab import *
Then use plot provided in this module. However, the curves I plot were not what I want:
Say two lists:
x = [1, 2, 3, 4]
y = [1.4, 5.6, 6, 3.5]
and I am after a plot method that can plot the following chart:
Plot a line that joins the points: (1, 0) and (1, 1.4)
Plot a line that joins the points: (2, 0) and (2, 5.6)
Plot a line that joins the points: (3, 0) and (3, 6)
Plot a line that joins the points: (4, 0) and (4, 3.5)
…
i.e.: it should plot a spectra like graphs, such as plot(x, type='h') in R. I suppose the plot method I use just joins all the points by lines. So, for my purpose, which methods to choose please? thanks!!
in python, I would like to use: from pylab import * Then use plot
Share
Maybe you want just vertical lines? You could use
vlines(x, [0], y). See this exampleYou could also have a look at this page (screenshots) to help you select the right function.