python绘制分组柱状图

#!/usr/bin/env python
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
import sys
import os

outdir=sys.argv[1]
depthfile=os.path.join(outdir,'all_stat.csv')    #输入
figfile=os.path.join(outdir,'all_stat.jpg')      #输出
df=pd.read_csv(depthfile,sep='\\s+')
df.columns=['ID','msi','chr','pos','avg','plat']
#print(df.head)
sns.boxplot(x="msi", y="avg", hue="plat", data=df, palette="Set1", width=0.5)
plt.savefig(figfile)

  图片版:

 

 结果:

 

posted @ 2022-08-25 14:56  YlnChen  阅读(359)  评论(0编辑  收藏  举报