Saving plot from seaborn

Viewed 61590

When I try to save my plot working with seaborn, like this:

import seaborn as sn
import pandas as pd
import matplotlib.pyplot as plt
from pylab import savefig

array = [[100,0], 
        [33,67]]

df_cm = pd.DataFrame(array)

svm = sn.heatmap(df_cm, annot=True,cmap='coolwarm', linecolor='white', linewidths=1)

svm.savefig('svm_conf.png', dpi=400)

I get this error

AttributeError                            Traceback (most recent call last)
<ipython-input-71-5c0ae9cda020> in <module>()
----> 1 svm.savefig('svm_conf.png', dpi=400)

AttributeError: 'AxesSubplot' object has no attribute 'savefig'

I have saved some boxplots before, with the same code, but this time, it doesn't work.

3 Answers
Related