📜  matplotlib 在数字后将他的 yticks 更改为两个数字 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:05.405000             🧑  作者: Mango

代码示例1
from matplotlib.ticker import StrMethodFormatter
plt.gca().yaxis.set_major_formatter(StrMethodFormatter('{x:,.0f}')) # No decimal places
plt.gca().yaxis.set_major_formatter(StrMethodFormatter('{x:,.2f}')) # 2 decimal places