First, the code. I'm using Jupyter Notebook 6.0.3 (which may or may not matter).
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
Nmax = 6
x = np.logspace(-1, Nmax)
y = 1/x + x
W = 8
plt.figure(figsize=(W, 4))
plt.plot(x, y)
ax = plt.gca()
ax.set_xscale('log')
ax.set_yscale('log')
ax.xaxis.set_major_locator(mpl.ticker.LogLocator())
This works fine. I get ticks on the X axis at each power of 10.
But if I set Nmax=7
, I only get ticks at even powers of 10 (i.e., 0, 100, etc.) Increasing W (such as W=20
) doesn't matter -- I get a larger figure with the same ticks.
I tried reading the docs for LogLocator
. They don't actually explain all of the input args.