matplotlib纵坐标轴保留两位小数
import numpy as npimport matplotlib.pyplot as pltimport matplotlib.ticker as mtickfig = plt.figure()ax = fig.add_subplot(111)x = np.linspace(0, 300, 20)y = np.linspace(0,300, 20)y = y*1e16ax.plot(x,y)
·
import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as mtick fig = plt.figure() ax = fig.add_subplot(111) x = np.linspace(0, 300, 20) y = np.linspace(0,300, 20) y = y*1e16 ax.plot(x,y) ax.yaxis.set_major_formatter(mtick.FormatStrFormatter('%.2f')) plt.show()
更多推荐
已为社区贡献1条内容
所有评论(0)