Monday 14 January 2008

python plot using specific xticks

from pylab import *
plot([1,2,3,4])
xlabel('x axis')
xticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally') )
show()

2 comments:

Cross Z said...
This comment has been removed by the author.
Cross Z said...

"arange" returns ARRAY RANGE.
It comes with numpy, of course exists in pylab as well.

For example:
>>> a=range(1,5)
>>> a
[1, 2, 3, 4]

>>> import pylab
>>> b=pylab.arange(1,5)
>>> print b
[1 2 3 4]
>>> b
array([1, 2, 3, 4])

My photo
London, United Kingdom
twitter.com/zhengxin

Facebook & Twitter