How to save two images into two separate files using same python script. The two output images are correlation matrix and a graph. I was using matplotlib

imshow(matrix, interpolation='bilinear')
colorbar()
savefig('/home/sudipta/Downloads/phppython/'+ filename +'.png')
x = range(-width, width)
plt.plot(x, avg_vec)
plt.savefig('/home/sudipta/'+ filename +'plot' +'.png')

The figures overlap each other when I run this script. However, I need two separate images. Initially, I was trying to save those images in same directory. I thought may be there is problem. Then I had tried to save in a different directory. However, I did not succedd

Maybe you should plot them separately with subplot then?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.