|
From: Philipp B. <li...@ro...> - 2010-02-23 07:18:48
|
Hi David,
I found this one::
xticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )
On the page
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.xticks
If I had that problem I would try to do something like that:
xvalues = linspace(0,100,1000)
xticks(xvalues, ["%.2f" % val for val in xvalues])
# or, with a lambda expression, but in #python they say
# a list comprehension is better (faster)
xticks(xvalues, map(lambda i : "%.2f" % i, xvalues))
The side effect is, of course, that the tick is not exactly at the position he
indicates. Maybe you better use "arange()" to get the right values for your
ticks, just make sure that they cover the interval your xvalues are in.
If you find a better solution, please let me know.
Best regards,
Philipp
|