【两个箱式图】

# -*- coding: utf-8 -*-
"""
Created on Mon Oct 10 16:37:45 2022

@author: Lenovo
"""

# import datetime 
# now =datetime.datetime.now()
# print(now)
# minute = now.strftime("%M") 
# print(int(now.strftime("%H"))+float(now.strftime("%M"))/60) #int(now.strftime("%M"))

import os
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

a=pd.read_csv(r'C:\Users\Lenovo\Desktop\6.csv')

a=pd.DataFrame(a)

print(a.describe())

b=pd.read_csv(r'C:\Users\Lenovo\Desktop\7.csv')

b=pd.DataFrame(b)
b=b.iloc[0:50,]
print(b.describe())

c=pd.concat([a,b])
print(c)


new=pd.concat([a,b],keys=('MDS','12Driver'))# concat 竖着拼接
new=new.stack().rename_axis(index=['Legend','nan','assess']) 

print(new)
# # reset 重置索引 
new=new.reset_index(level=[0,2],name='RMSE')

ax=sns.boxplot(data=new, x='assess',hue='Legend',y='RMSE')
# loc = 2,bbox_to_anchor = (1,1) 将图例放在外面
# loc = 'upper right' 放在右上
plt.legend( prop={'size': 25},loc = 2,bbox_to_anchor = (1,1))

ax.xaxis.label.set_visible(False)
ax.yaxis.label.set_visible(True)  # 不显示y轴标签

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值