I am trying to plot with a limited number of ticks in x-axis. I followed this method. And it almost working, however, I have my number scale between 0.1 to 1, and I would still like to do similar operation: only shows[0.2, 0.3, 0.6]
in scalar format. The plot is restricted to a log-log plot. And I got this:
Obviously, we see the overlapping in [0.2, 0.3, 0.6]
and no overlapping for 0.4
. How I can remove the original set of the xticks?
My program is attached here:
import matplotlib
from matplotlib import pyplot as plt
fig = plt.gcf()
fig.set_size_inches(12, 8)
ax1 = plt.gca()
ax1.plot([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7], [1,2,3, 4, 5, 6, 7])
ax1.set_xscale('log')
ax1.set_yscale('log')
ax1.set_xticks([0.2, 0.3, 0.6])
ax1.get_xaxis().set_major_formatter(matplotlib.ticker.ScalarFormatter())
plt.show()