I'm trying to plot heatmaps in a loop over various datasets but with every new heatmap, a new color bar gets added (the map looks fine and no extra maps are added). I could use a workaround by resetting the color bar inside the loop but I would prefer to know what is going on and have a cleaner solution. Thanks in advance for any help!
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns;
# read file
atlas = ['A','B','C','D']
output_path = '/Users/polo/Desktop/Heatmaps/'
for at in range(len(atlas)):
data = pd.read_csv('/Users/polo/Desktop/correl_input_{}.csv'.format(atlas[at]))
hmap = sns.heatmap(data,cmap='seismic',linewidths=.5,vmin=-0.1, vmax=0.1)
hmap.set_ylim(0, 5)
plt.savefig(output_path + 'Heatmap_{}.png'.format(atlas[at]), dpi=1200,bbox_inches='tight')
#plt.savefig('{}_plot.png', format='png', dpi=1200,bbox_inches='tight')