0

I have the log scale in the y axis set as plt.yscale('log'). I also want to specify the labels and ticks on this same axis. For some reason, there is a plot for which I do

plt.yticks([10**(-3), 10**(-1), 1, 10**1, 10**3], (r'$10^{-3}$', r'$10^{-1}$', r'$10^{0}$', r'$10^{1}$', r'$10^{3}$'))

but there is a lot of extra ticks that do not correspond to the labels between e.g. 10^1 and 10^3. Is there a way to remove these?

user2820579
  • 3,261
  • 7
  • 30
  • 45
  • Nevermind I found the answer [here](https://stackoverflow.com/questions/14530113/set-ticks-with-logarithmic-scale), though it is buried in some other answer. One needs to use `matplotlib.rcParams['xtick.minor.size'] = 0 matplotlib.rcParams['xtick.minor.width'] = 0` – user2820579 Apr 16 '20 at 18:39
  • Does this answer your question? [How to disable the minor ticks of log-plot in Matplotlib?](https://stackoverflow.com/questions/10781077/how-to-disable-the-minor-ticks-of-log-plot-in-matplotlib) `plt.minorticks_off()` – JohanC Apr 16 '20 at 18:50
  • 1
    As stated by the OP...this answers the question [set ticks with logarithmic scale](https://stackoverflow.com/questions/14530113/set-ticks-with-logarithmic-scale) – Trenton McKinney Apr 16 '20 at 21:54

0 Answers0