当我保存一个笔直的人物时,便切开了传说

时间:2018-07-24 14:53:11

标签: python seaborn

我已经使用seaborn构建了一个小提琴图,我想将其另存为图像。该图是在控制台中这样打印的:

enter image description here

但它会随裁剪的图例一起保存:

enter image description here

有人知道我该如何解决吗? 代码:

import seaborn as sns 
import matplotlib.pyplot as plt 

sns.set('paper', color_codes=True) 
protein_name = input('What is the name of your protein?') 
my_pal = {"3mer": "red", "9mer": "blue"} fig = 

sns.violinplot(y= 'Percentage', x= 'Secondary structure',hue= 'Type of library', data = df, split = True, palette = my_pal) 
fig.set_title('Distribution of secondary structures in' + protein_name) 
leg=plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.5) 
leg.set_title('Type of library')
plt.ylim(0, 100)

plt.savefig(protein_name + "_violin_plots.jpg") 

0 个答案:

没有答案