python可视化---并列柱状图
import matplotlib.pyplot as plt import matplotlib as mpl import numpy as npmpl.rcParams["font.sans-serif"] = ["SimHei"] mpl.rcParams["axes.unicode_minus"] = Falsex = np.arange(5) y = [6, 10, 4, 5, 1] y1 = [2, 6, 3, 8, 5]bar_width = 0.35 tick_label = ["A", "B", "C", "D", "E"]plt.bar(x, y, bar_width, align="center", color="c", label="班级A", alpha=0.5) plt.bar(x+bar_width, y1, bar_width, color="b", align="center", label="班级", alpha=0.5)plt.xlabel("测试难度") plt.ylabel("试卷份数")plt.xticks(x+bar_width/2, tick_label)plt.legend()plt.show()
![python可视化---并列柱状图](https://img.it610.com/image/info8/f8dc8a9251bd4dd499bc3ad73dc917e2.png)
文章图片
【python可视化---并列柱状图】转载于:https://www.cnblogs.com/czz0508/p/10458425.html
推荐阅读
- python学习之|python学习之 实现QQ自动发送消息
- 逻辑回归的理解与python示例
- python自定义封装带颜色的logging模块
- 【Leetcode/Python】001-Two|【Leetcode/Python】001-Two Sum
- Python基础|Python基础 - 练习1
- Python爬虫|Python爬虫 --- 1.4 正则表达式(re库)
- 为什么孩子一定要学会可视化思维!
- Python(pathlib模块)
- python青少年编程比赛_第十一届蓝桥杯大赛青少年创意编程组比赛细则
- Python数据分析(一)(Matplotlib使用)