How can I plot string vs float in python?

How can I plot a string

versus graph float

using pylab?

x = ['PARIS','LONDON']

y = [2.39, 3.41]

      

how can i build x

versus y

?

+3


source to share


1 answer


Thanks a lot to Miles Baker, here is the solution:



import pylab as pl
x = [0,1]
xTicks = ['LONDON','PARIS']
y = [2.39, 3.41]
pl.xticks(x, xTicks)
pl.xticks(range(2), xTicks, rotation=45) #writes strings with 45 degree angle
pl.plot(x,y,'*')
pl.show()

      

+8


source







All Articles