How to save a Seaborn plot into a file

后端 未结 10 1055
庸人自扰
庸人自扰 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

    Just FYI, the below command worked in seaborn 0.8.1 so I guess the initial answer is still valid.

    sns_plot = sns.pairplot(data, hue='species', size=3)
    sns_plot.savefig("output.png")
    

提交回复
热议问题