python绘制箱线图

  • Post author:
  • Post category:python



用python绘制箱线图_大奸猫的博客-CSDN博客_python画箱线图

画两个并行的箱型图:
# 导入Excel数据studentshuju.xls的代码:
import matplotlib.pyplot as plt
import pandas as pd
import xlrd
import seaborn as sns
path = "../GCMC/test_dis_att1.csv"
df = pd.read_csv(path)

# df = pd.DataFrame(data)
print(df)

# 做箱式图的代码:
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.boxplot(df['topology'])
ax.boxplot((df['topology'], df['feature']),labels=('T','F'))
# plt.show()
plt.savefig('test_dis_att.pdf')#保存箱型图时,去掉show()



版权声明:本文为Serendipity_han原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。