When plotting my figure with plt.axis('auto')
, 'natural' x-ticks are written with frequency 500,
Wishing a frequency 200, I have used:
import matplotlib.ticker as ticker
ticks_loc = ticker.MultipleLocator(base=200)
fig = plt.figure('Cutlines x-axis')
ax = fig.add_subplot(111)
...
plt.axis('equal')
ax.xaxis.set_major_locator(ticks_loc)
ax.yaxis.set_major_locator(ticks_loc)
plt.grid()
which gives,
Curiously
plt.show()
differs from savefig
(in plt.show()
'only' ticks -1000 and -800 are missing, not -600).I have tried reducing the font size (with very tiny one) and/or by writing vertically -> no effect : always the same ticks are missing.
Is there a way to have all the ticks visible (in horizontal mode) ?
Why don't you simply use xticks
instead of ticker
fig = plt.figure('Cutlines x-axis')
ax = fig.add_subplot(111)
...
xlim = ax.get_xlim()
plt.xticks(np.arange(xlim[0], xlim[1]+200, 200))