How to disable the minor ticks of log-plot in Matplotlib?

plt.minorticks_off()

Turns em off!

To change the number of them/position them, you can use the subsx parameter. like this:

plt.xscale('log', subsx=[2, 3, 4, 5, 6, 7, 8, 9])

From the docs:

subsx/subsy: Where to place the subticks between each major tick.
Should be a sequence of integers. For example, in a log10 scale: [2,
3, 4, 5, 6, 7, 8, 9]

will place 8 logarithmically spaced minor ticks between each major
tick.

Leave a Comment