表格
import pandas as pd import matplotlib.pyplot as plt total_width, n = 0.8, 6 # 对每一个日期设置0.8的宽度,有6个指标 width = total_width / n # 每个日期下每个指标的宽度 def column_chart(excel_path, sheet_name): """ 柱状图 :param excel_path: :param sheet_name: :return:x """ plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文标签 plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号 x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # 一共有12行数据 df = pd.read_excel(excel_path, sheet_name=sheet_name) fig = plt.figure() # 每绘制过一个指标,就加上一定的宽度使下一个指标的柱状图不重叠## for i in range(len(x)): x[i] = x[i