I am using matplot lib to plot some curves with the x-axis set to a log scale. I figured out how to set custom ticks from set ticks with logarithmic scale:
import matplotlib
from matplotlib import pyplot as plt
ax = plt.gca()
ax.set_xscale('log')
ax.set_xticks([0.001, 0.003, 0.010, 0.033, 0.10, 0.33, 1.0, 3.3, 10.0, 33.0, 100.0])
ax.get_xaxis().set_major_formatter(matplotlib.ticker.ScalarFormatter())
ax.get_xaxis().set_tick_params(which='minor', size=0, width=0)
plt.savefig('logscale.png')
plt.close()
This code produces the following plot:
As you can see, the two leftmost ticks are 0.00
instead of 0.001
and 0.003
as they should be. How can I format these to show more digits after the decimal point?