Greetings, folks. I am a Matplotlib novice.
I'm trying to produce a 2D plot of data points where the X-axis
represents a sequence of named events. A grid and xticklabels have
been enabled for clarity.
For a sample size of 11, all the points fall on the grid. For 12,
they do not. Beyond that seems to be on a case-by-case basis.
I'm sure I must be abusing the relationship between ticks and data,
but the proper solution eludes me.
Below is a distilled version of the script. This was run on
Matplotlib 0.65 and Numarray 1.1.1. We have similar problems with
Matplotlib 0.80 and Numeric 23.8. What am I doing wrong?
--Rick Kwan
---- novice script starts here ----
from pylab import *
# top = 11 # 11 produces point on grid
top = 12 # 12 produces skewed data points
iter = [i for i in range(top)]
ax = subplot(111)
plot(iter, iter, 'gd-')
grid(True)
ax.xaxis.set_major_locator(LinearLocator(top))
xlabs = ax.set_xticklabels(['evt%d'%i for i in range(top)])
show()