I have a figure in log-scale and would like to set the x-ticks manually to [0.5, 1, 2]:
import matplotlib.pyplot as plt
ax = plt.gca()
ax.set_xscale("log")
ax.set_xticks([0.5,1,2])
ax.set_xticklabels([.5,1,2])
ax.set_xlim([0.5,2]) # issue causing line
However, it automatically also sets one to 6*10^-1, which I can't get rid off.
Even asking ax.get_xticks()
doesn't show this x-tick. How can I get rid of the unwanted tick?
CodePudding user response:
That looks like a minor tick. Try adding
ax.set_xticks([], minor=True)
Output: