I have
JavaScript
x
5
1
tick_location = np.linspace(0.01, 10, num=10, endpoint=True)
2
ax2.set_xticks(tick_location)
3
tick_labels = np.around(1/new_tick_loc*1e4,decimals=-2)
4
ax2.set_xticklabels(tick_labels)
5
This (and some additional code) produces the following plot, but I’d like to remove the decimal point and the digit after it from the tick labels on the top x axis.
Using matplotlib.ticker.FormatStrFormatter(fmt) does not help
Advertisement
Answer
Convert the numbers into ints:
JavaScript
1
2
1
ax2.set_xticklabels(tick_labels.astype(int))
2