使用datafrom直接画箱图
比如,有如下一组数据,直接使用dataframe.plot 画图 【官网了解更多】:
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv(yourfile, sep='\t', header=0, index_col=0)
df.head()
df.plot(kind='box')
plt.show()

① 调整绘制箱图参数
df.plot(kind='box',
title='box title',
showmeans=True,
meanline=True,
showfliers=True,
rot=60,
figsize=(15,5),
)
使用kind 参数选择画图类型:  显示均值时,设置显示线型:meanline=True  设置meanline=False :均值显示为小三角 
② 设置坐标轴
y轴设置:(x轴同理)
plt.ylabel('y label')
plt.ylim([-2, 10])

plt.yticks([-2,3,5])

③ 图中添加文本或直线
plt.text(3, 5, 'text',
fontsize=15,
color='red',
alpha=0.5,
)
plt.text(5, 2, 'new text',
fontsize=15,
color='red',
alpha=0.5,
)
plt.plot((2.5,2.5), (0,5),
color='orange',
alpha=0.5,
linewidth=1,
)

④ 更多参数
对特定图,有特定的模块与对应的参数,比如箱图boxplot :箱图参数。所以也可以将这些参数作为dataframe.plot 的参数使用。   》上图截图来源:https://zhuanlan.zhihu.com/p/38199913
附:python画图示例官网:matplotlib https://matplotlib.org/stable/gallery/index.html
数据的处理
df2 = np.log2(df+0.0001)

from scipy import stats
df.shape[0]
df.shape[1]
zs_arr = stats.zscore(df, axis=1, ddof=0)

|