I've been trying to make a scatterplot with maptlotlib where the axes are integers, and I had attempted to use MultipleLocator
to do so (I had previously attempted to use MaxNLocator(integer=True)
, as found in this thread, to no avail.)
training_data_figure = plt.figure()
training_data_plot = training_data_figure.add_subplot(1, 1, 1)
training_data_plot.scatter(training_x_points, training_y_points)
training_data_plot.get_yaxis().set_major_locator(matplotlib.ticker.MultipleLocator(10))
# ...
plt.plot()
Hoewver, this oddly produces non-integer ticks.
The docs state that MultipleLocator will "Set a tick on each integer multiple of a base within the view interval," which is clearly not what's happening here.
These points on the ticks seem to be actual points from my data, oddly enough.
How can I force these ticks to be integers?