matplotlib.pyplot箱线图绘制

读取csv数据,并画出箱线图

import matplotlib.pyplot as plt
import pandas as pd

def draw_box(csv_file_path):
    data = pd.read_csv(csv_file_path, encoding='utf-8')
    plt.rc('font', family='Times New Roman')
    data = data.iloc[:, 1:]
    data.plot.box(title="difficulty rating")
    plt.grid(linestyle="--", alpha=0.3)
    plt.savefig('./results_imgs.png', bbox_inches='tight', dpi=300)
posted @ 2023-07-04 14:28  快乐码小农  阅读(28)  评论(0编辑  收藏  举报