首页 > 解决方案 > 没有科学的y轴matplotlib

问题描述

我正在使用此代码获得科学记数法 y 轴标签。我只想要简单的数字。我怎么做?

import matplotlib.pyplot as plt
import matplotlib

from IPython.core.display import display, HTML
#display(HTML("<style>.container { width:70% !important; }</style>"))
display(HTML("<style>.container { width:100% !important; }</style>"))
%matplotlib inline

from matplotlib.ticker import ScalarFormatter, FormatStrFormatter

plt.rcParams['figure.figsize'] = [20, 10]
fig, ax = plt.subplots()

ax.semilogy(df.close)
ax.grid()
ax.yaxis.set_major_formatter(FormatStrFormatter('%.0f'))

plt.show()

标签: matplotlib

解决方案


推荐阅读