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')
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