I want to save a plot with a transparent background using savefig
. The code looks like this:
plt.savefig("filename.png", transparent=True)
plt.show()
It works well and saves the images as expected (some graphs on a transparent background). However, if I change the size of the plot, the output image becomes an empty image, that is, a completely transparent image with no graphs. This is how I changed the size:
plt.figure(figsize=(6.4, 4.8), dpi=100)
plt.savefig("filename.png", transparent=True)
plt.show()
I want a 640x480 image. Even if I don't change the dpi the output images are completely blank. How can i avoid this?