howto get minor ticks?

In the following code snippet (not a complete example), I get the
dashed lines for the minor ticks on the y (log) axis, but on the x axis, I only
got the major ticks lines. How do I get minor lines to show up?

(Previously, I tried without the MultipleLocator and set_minor_locator, but
still got only major x axis lines plotted)

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)

ax.semilogy (h1.buckets(), h1.cumulative())
ax.semilogy (h2.buckets(), h2.inv_cumulative())
from matplotlib.ticker import MultipleLocator
minorLocator = MultipleLocator(5)
ax.xaxis.set_minor_locator(minorLocator)
plt.grid(b=True, which='major', linestyle='solid')
plt.grid(b=True, which='minor', linestyle='dashed')
plt.show()

Neal,

I can't run your script as is, but something as simple as this show work:

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_xscale('log')

ax.xaxis.grid(True, which='major')
ax.xaxis.grid(True, which='minor')

plt.show()

ยทยทยท

On Tue, May 15, 2012 at 10:18 AM, Neal Becker <ndbecker2@...287...> wrote:

In the following code snippet (not a complete example), I get the
dashed lines for the minor ticks on the y (log) axis, but on the x axis, I only
got the major ticks lines. How do I get minor lines to show up?

(Previously, I tried without the MultipleLocator and set_minor_locator, but
still got only major x axis lines plotted)

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)

ax.semilogy (h1.buckets(), h1.cumulative())
ax.semilogy (h2.buckets(), h2.inv_cumulative())
from matplotlib.ticker import MultipleLocator
minorLocator = MultipleLocator(5)
ax.xaxis.set_minor_locator(minorLocator)
plt.grid(b=True, which='major', linestyle='solid')
plt.grid(b=True, which='minor', linestyle='dashed')
plt.show()

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options