ChengKong Wu wrote:
> Dear all,
>
> I have the following data:
> X = [0.0, 1.0, 3.0, 6.0, 10.0, 15.0]
> Y = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
>
> I can plot the XY curve without problem.
>
> But is there a way for me to make the xticks spaced
> evenly? That is, the distance between 0.0 and 1.0, 1.0
> and 3.0, 3.0 and 6.0, ... along the xaxis are the
> same.
What you are really doing, then, is plotting Y not against X but against
an index, like this:
from pylab import *
X = [0.0, 1.0, 3.0, 6.0, 10.0, 15.0]
Y = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
xi = arange(len(X))
xtlabel = ['%.1d'%x for x in X] # or [str(x) for x in X]
plot(xi, Y)
ax = gca()
ax.set_xticks(xi)
ax.set_xticklabels(xtlabel)
show()
Is this what you want?
Eric
