I'm trying to make a pretty simple log-log plot in matplotlib. However, It seems as if I can get minor ticks on the y-axis, but for some matplotlib reason, not on the x-axis. I'd like ticks on all the axis (bottom, left, right and top) and to have the minor ticks on the x-axis (top and bottom).
Here is the code I currently have::
import math
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
from matplotlib.ticker import ScalarFormatter
from matplotlib import colors as mcolors
from matplotlib import gridspec
plt.rcParams.update({'font.size': 14})
plt.clf()
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2,2, sharex=True, sharey=True, gridspec_kw = {'wspace':0, 'hspace':0})
xmin = 0.006
xmax = 70.00
ymin = 0.0003
ymax = 4.00
ax1.set_xlim([xmin,xmax])
ax2.set_xlim([xmin,xmax])
ax3.set_xlim([xmin,xmax])
ax4.set_xlim([xmin,xmax])
ax1.set_xscale('log')
ax2.set_xscale('log')
ax3.set_xscale('log')
ax4.set_xscale('log')
ax1.set_ylim([ymin,ymax])
ax2.set_ylim([ymin,ymax])
ax3.set_ylim([ymin,ymax])
ax4.set_ylim([ymin,ymax])
ax1.set_yscale('log')
ax2.set_yscale('log')
ax3.set_yscale('log')
ax4.set_yscale('log')
ax1.plot(log_wavelength, t, alpha=0.75, color='black')
ax2.plot(log_wavelength, x, alpha=0.75, color='red')
ax3.plot(log_wavelength, y, alpha=0.75, color='green')
ax4.plot(log_wavelength, z, alpha=0.75, color='cyan')
ax1.minorticks_on()
ax2.minorticks_on()
ax3.minorticks_on()
ax4.minorticks_on()
ax1.tick_params(axis='both', which='minor', length=4, color='k')
ax2.tick_params(axis='both', which='minor', length=4, color='k')
ax3.tick_params(axis='both', which='minor', length=4, color='k')
ax4.tick_params(axis='both', which='minor', length=4, color='k')
Is there a reason ax.minorticks_on() isn't working??