注解
Click here 下载完整的示例代码
美元蜱¶
使用A FormatStrFormatter
在Y轴标签上预先加上美元符号。
import numpy as np
import matplotlib.pyplot as plt
# Fixing random state for reproducibility
np.random.seed(19680801)
fig, ax = plt.subplots()
ax.plot(100*np.random.rand(20))
# Use automatic StrMethodFormatter
ax.yaxis.set_major_formatter('${x:1.2f}')
ax.yaxis.set_tick_params(which='major', labelcolor='green',
labelleft=False, labelright=True)
plt.show()

工具书类¶
以下函数、方法、类和模块的使用如本例所示:
关键词:matplotlib代码示例,codex,python plot,pyplot Gallery generated by Sphinx-Gallery