 # wrong number of logarithmic minor ticks

From running the code below, I see only 8 subticks between the major

ticks. But the documentation
<http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.set_xscale>
says there should be 10. I'm using matplotlib version 0.99.3.

···

#----------------------------
import matplotlib.pyplot as plt
import numpy as np
y = range(1, 4)
x = np.power(10, y)
plt.gca().set_xscale('log', basex=10, subsx=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
plt.gca().plot(x, y)
plt.show()
#----------------------------

However, even if 10 are being drawn, I think there would only be 9
subticks between the major ticks because the first subtick is on a
major tick. Am I wrong?

Steve

You are mostly correct. The documentation, however, is very wrong. The first visible subtick would be for 20. Therefore, there will only be 8 visible subticks. The suggestion of doing [0, 1, 2, 3, …] for subsx has two problems. First, the subtick at 0 will never show up! Second, the subtick for 1 is also a major tick. While this isn’t technically wrong, (maybe the major ticks get turned off or something…), it is a poor example and I will fix it.

Thank you for pointing it out.

Ben Root

···

On Thu, May 19, 2011 at 10:37 PM, Steve Ward <planet36@…120…287…> wrote:

From running the code below, I see only 8 subticks between the major

ticks. But the documentation

says there should be 10. I’m using matplotlib version 0.99.3.

#----------------------------

import matplotlib.pyplot as plt

import numpy as np

y = range(1, 4)

x = np.power(10, y)

plt.gca().set_xscale(‘log’, basex=10, subsx=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

plt.gca().plot(x, y)

plt.show()

#----------------------------

However, even if 10 are being drawn, I think there would only be 9

subticks between the major ticks because the first subtick is on a

major tick. Am I wrong?

Steve