I would like to save a venn diagram as a .png (or some other file) to insert into a document. I am using matplotlib_venn.
Following the solution here:
How to save VennDiagram as PNG figure in matplotlib_venn
I just get an empty (white) .png file as follows:
My code is:
from matplotlib_venn import venn2
from matplotlib import pyplot as plt
venn2(subsets=(5,8,4))
plt.savefig(path+'venn1A.png')
EDIT:
I am using ATOM IDE and it displays the Venn diagram automatically (ie plt.show()
implicitly). As per Anurag Dabas's solution below, submitting both lines of code together works. Thanks for the solution.
write plt.savefig(path+'venn1A.png')
before plt.show()
because plt.show()
free memory space taken by graph so if you write plt.savefig(path+'venn1A.png')
after plt.show()
then you will got an empty(white) image.
Note:-if you don't provide the .png extension then by default savefig() method saves images in png format
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments