下面是我生成条形图的Python代码:
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt
objects = ('Increasing operational efficiency',
'Informing strategic direction',
'Better customer service',
'Identifying and developing new products',
'Enhanced customer experience',
'Identifying new markets',
'Faster go to market',
'Complying with regulations',
'Other')
y_pos = np.arange(len(objects))
performance = [51, 36, 27, 24, 20, 11, 8, 6, 3]
plt.bar(y_pos, performance, align='center', alpha=0.5)
plt.xticks(y_pos, objects)
plt.show()
在输出中,xtick被重叠了,有什么方法可以克服它吗。我的第二个疑问是,从0到60的值之间的间隔是10,有没有办法在0%、10%、…、60%等数字的同时加上“%”符号,而不是0、10、…、60%。在
谢谢你的帮助,我是mathplotlib新手
你只要简单的搜索就能找到问题的答案。。。在
可以使用
plt.gcf().autofmt_xdate()
旋转x轴标签对于y轴上的百分比符号,使用
相关问题 更多 >
编程相关推荐