मैं निम्नलिखित कोड (test_seaborn.py
) की कोशिश की:एक फ़ाइल में एक Seaborn साजिश को बचाने के लिए कैसे
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
matplotlib.style.use('ggplot')
import seaborn as sns
sns.set()
df = sns.load_dataset('iris')
sns_plot = sns.pairplot(df, hue='species', size=2.5)
fig = sns_plot.get_figure()
fig.savefig("output.png")
#sns.plt.show()
लेकिन मैं इस त्रुटि मिलती है:
Traceback (most recent call last):
File "test_searborn.py", line 11, in <module>
fig = sns_plot.get_figure()
AttributeError: 'PairGrid' object has no attribute 'get_figure'
मैं उम्मीद अंतिम output.png
मौजूद हैं और लगेगा
मैं टी का समाधान कैसे कर सकते हैं: इस तरह वह समस्या है?
कृपया ध्यान दें कि इस Seaborn 0.7.1 में काम नहीं करता है (अन्य जवाब देखें)। – Guido
** नोटिस ** कि यह उत्तर हालांकि स्वीकार किया गया पुराना है। सही जवाब है कि [यहाँ Salvatore द्वारा दिए गए।] है (http://stackoverflow.com/a/39482402/1391441) – Gabriel