How to save a Seaborn plot into a file

后端 未结 10 1047
庸人自扰
庸人自扰 2020-12-07 08:43

I tried the following code (test_seaborn.py):

import matplotlib
matplotlib.use(\'Agg\')
import matplotlib.pyplot as plt
matplotlib.style.use(\'g         


        
10条回答
  •  自闭症患者
    2020-12-07 08:56

    This works for me

    import seaborn as sns
    import matplotlib.pyplot as plt
    %matplotlib inline
    
    sns.factorplot(x='holiday',data=data,kind='count',size=5,aspect=1)
    plt.savefig('holiday-vs-count.png')
    

提交回复
热议问题