Skip to content
Advertisement

How can I remove digits after decimal in axis ticks in matplotlib?

I have

JavaScript

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

top x axis with decimal

Advertisement

Answer

Convert the numbers into ints:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement