我有一个箱线图,但我想定制它的外观,所以我给出了箱线图方法参数return_type='both'
,以获得轴和字典。我似乎再也抓不出盒子了
不带return_type=True
的代码:
df = pd.DataFrame(
columns=['mean_coverage', 'exon'],
data= {
'mean_coverage': [102, 578, 75, 180],
'exon': [1, 1, 2, 2]
}
)
bp = df.boxplot(
column='mean_coverage',
by='exon',
patch_artist=True,
)
bp.figure.show()
bp.figure.savefig(
os.path.join(
self.output_path,
'boxplot.png'
)
)
用return_type=True
编码:
bp = df.boxplot(
column='mean_coverage',
by='exon',
patch_artist=True,
return_type='both'
)
for row_key, (ax,row) in bp.iteritems():
for box in row['boxes']:
box.set_facecolor('pink')
bp.figure.show()
bp.figure.savefig(
os.path.join(
self.output_path,
'ZRSR2.png'
)
)
AttributeError: 'Series' object has no attribute 'figure'
如何从该系列中获得如示例1所示的方框图
目前没有回答
相关问题 更多 >
编程相关推荐