I have
tick_location = np.linspace(0.01, 10, num=10, endpoint=True) ax2.set_xticks(tick_location) tick_labels = np.around(1/new_tick_loc*1e4,decimals=-2) ax2.set_xticklabels(tick_labels)
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:
ax2.set_xticklabels(tick_labels.astype(int))