如何获得[a,b,c]的x轴值显示?
import pandas as pd import matplotlib.pyplot as plt s = pd.Series([1, 2, 10], index=['a', 'b', 'c']) s.plot() plt.show()
您可以使用来显示xtick标签plt.xticks:
plt.xticks
import pandas as pd import matplotlib.pyplot as plt s = pd.Series([1, 2, 10], index=['a', 'b', 'c']) s.plot() plt.xticks(np.arange(len(s.index)), s.index) plt.show()
输出:
面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦
提 问题
写 面经
写 文章
微信 公众号
回到 顶部
没有帐户? 立即注册
已有帐号?立即登录