PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteiTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
To show intermediate ticks on a base-10 logarithmic axis, set that axis’s minor locator to LogLocator(base=10, subs=range(2, 10)). This requests positions at 2 through 9 times each integer power of 10—for example, 2, 3, …, 9 between 10 and 100. Tick positions and tick labels are separate: a locator chooses where marks go, while a formatter controls whether they receive labels.
Set a LogLocator for the axis you want to change
Set the axis to a logarithmic scale, then assign a LogLocator to its minor locator. For a y-axis, use ax.yaxis; for an x-axis, use ax.xaxis.
import matplotlib.pyplot as plt
from matplotlib.ticker import LogLocator
fig, ax = plt.subplots()
ax.set_yscale("log")
ax.plot(x, y)
ax.yaxis.set_minor_locator(LogLocator(base=10, subs=range(2, 10)))
Replace x and y with your data. To apply the same pattern to the x-axis, use ax.xaxis.set_minor_locator(...). Matplotlib’s scale handling provides scale-specific locators and formatters; the code above explicitly configures the minor locator to request intermediate multiples. See the Matplotlib axis scales guide and the ticker API reference.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Choose which multiples appear with subs
LogLocator places ticks according to subs[j] * base**i. With base 10, each value in subs is multiplied by powers of 10. The documented default, subs=(1.0,), places ticks at integer powers of the base; it does not request the familiar intermediate multiples.
#1 Best Overall
- Use an explicit sequence such as
range(2, 10)when you want multiples 2 through 9 within each decade. - Use
subs='auto'when you want the locator to choose intermediate positions based on the current view limits. - Use
subs='all'when you want view-limit-dependent positions both between and at integer powers. - Use
subs=Nonefor the current documented API’s equivalent of'auto'.
The number of generated ticks is also influenced by numticks. In the current API, its default is None; once the locator is attached to an axis, Matplotlib attempts to choose a suitable number. Without an attached axis, the documented fallback is 9. Consult the LogLocator API reference for the current signature and behavior.
Keep tick marks and labels distinct
A minor locator determines tick positions; a formatter determines their text labels. If the intermediate marks appear but have no labels, the locator may be working as intended. Matplotlib’s LogFormatter controls log tick labeling, including minor-label behavior through settings such as labelOnlyBase and minor_thresholds. Match the formatter’s base to the locator’s base.
Rank #2
If you want the minor marks but no minor labels, use a NullFormatter for the minor ticks. Avoid labeling every intermediate mark when the resulting text would crowd the plotted range. The formatter options are documented in the ticker API reference.
Use defaults or specify the locator yourself
Axis.minorticks_on() turns on scale-dependent minor ticks; on a logarithmic axis, the default minor locator is a LogLocator. That is useful when the default pattern is sufficient. Set a specific LogLocator with subs when you need to control the multiples. See Axis.minorticks_on.
Make the locator work with zooming and multiple axes
Prefer a locator for interactive limits
Locators choose positions based on the current view limits, so locator-based ticks can adjust as you zoom or pan. Manually setting tick positions is more appropriate for a fixed final plot; manually chosen positions do not adapt to interaction. Matplotlib explains this distinction in its axis ticks guide.
Create a separate locator for each axis
Do not reuse one locator instance across multiple axes. The API documentation says locator instances should not be shared between axes; construct a new LogLocator for each axis that needs one.
Check version-specific API details
The current stable references cited here are Matplotlib 3.11.2 for the ticker API and axes guides, and 3.11.1 for Axis.minorticks_on. Older Matplotlib documentation can show a different LogLocator signature—for example, the 3.6.1 reference includes a numdecs parameter. If you support an older installation, check that installed version’s documentation rather than assuming its API matches the current stable reference.
Recommended Free Tools
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

