Sometimes when plotting very small deviations in matplotlib, say small deviations from 1, matplotlib will automatically make ticks labeled around 0, and then write "+1" up in the left corner. Usually it will even do something worse, and subtract something like 0.999 from the ticks instead of 1. For example, the following code
import pylab as pl
import numpy as np
x=np.linspace(-10,10,100)
pl.plot(x,1+1e-4*np.sin(x))
pl.savefig('test.pdf')
pl.show()
How do I turn off/control this feature?
What I ultimately want is for the ticks to mark only 1, so I added the command
pl.gca().set_yticks([1])
which gives the following ridiculous plot
instead of showing just the 1 in the middle of the left axis. How to fix this?
(apologizes for a bad title, didn't know what to write)