Вы можете использовать средства форматирования тиков , чтобы отображать числа в миллионах, как показано ниже
import numpy as np
import matplotlib.ticker as ticker
@ticker.FuncFormatter
def million_formatter(x, pos):
return "%.1f M" % (x/1E6)
x = np.arange(1E7,5E7,0.5E7)
y = x
fig, ax = plt.subplots()
ax.plot(x,y)
ax.xaxis.set_major_formatter(million_formatter)
ax.yaxis.set_major_formatter(million_formatter)
ax.set_xlabel('X in millions')
ax.set_ylabel('Y in millions')
plt.xticks(rotation='45')
plt.show
, что приводит к