jha*_*fen 7 python django charts graph matplotlib
我试图在matplotlib条形图的yaxis上添加mi或km(英里,公里).
现在我只是提供matplotlib值,它会自动生成yaxis标签.我无法弄清楚如何将mi附加到值的末尾.
24> 24英里
ax.set_7ticklabels()有一个选项,但是我需要静态设置它们.
Joe*_*ton 11
你想要这样的东西吗?
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
x = range(10)
plt.plot(x)
plt.gca().xaxis.set_major_formatter(FormatStrFormatter('%d km'))
plt.show()
Run Code Online (Sandbox Code Playgroud)
