The numbers on the x-axis disappear when turning on “log” scale.
import numpy as np
import matplotlib.pyplot as plt
plt.plot( range(1,10) , range(1,10) , color='#aaaaff')
plt.xscale('log')
plt.xticks(range(1,10) )
plt.show()
If I comment out xscale the numbers on the x-axis are printed. Can someone shed light on why this does not work on log scale axis and how this can be achieved?
Edit:
Simplified code, so that it can be used without the data file. Same thing: No numbers!!
By default tick locations for log axes are in base 10. So in the above case the only possible
xtickis at 1.If you change the
xtickstoyou get ticks at
1and10.You can also play with
tickerwhich allows you to do many stuff. E.g.,If you use:
then you get