matplotlib画多类型图增加图例保存图片设置坐标轴文字方向

在这里插入代码片大佬万福.请不吝赐教!

   	import matplotlib.pyplot as plt
    
    data = pd.DataFrame(recallDict).T.reset_index()
    data.columns = ['area','con','sug']
    
    #设置横轴文字方向
    plt.xticks(rotation=90)
    #画叠加柱状图
    plt.bar(data['area'], data['con'], color='#2F7336', label='controlRepeat')
    plt.bar(data['area'], data['sug'], color='#F0CB35', label='suggestRepeat')
    #增加图例
    plt.legend()
    #画图后保存
    plt.savefig('freeDegree.jpg')
    
    img = plt.show()

seaborn 入口:http://seaborn.pydata.org/tutorial/relational.html#emphasizing-continuity-with-line-plots
matplotlib:https://matplotlib.org/tutorials/index.html

你可能感兴趣的:(python)