I would like to add colorbars to the topoplots. Ideally, I would like to have only a single bar for all of them. But, this seems to mess up the scaling and the plots end up in different sizes.
When I try the code below and set colorbar = True. I get this error message:
You must provide 2 axes (one for each time plus one for the colorbar), got 1.
I understand that topo and colorbar are two subplots, but do not know how to fix it.
Maybe it is possible to draw a colorbar manually? Unfortunately, I cannot figure it out. Just get lots of errors.
vlim = [-1, 1]
n = 1
fig = plt.figure(figsize=(12, 4))
pi = [False, False, False]
for a, s, p in zip(axi, spi, pi):
ax = fig.add_subplot(1,3,n)
# Plot topo
mne.viz.plot_evoked_topomap(mne.grand_average(aevos[s]['diff']),
show=False,
axes=ax,
vlim=vlim,
times=(ERP_time['AAN'][0]+ERP_time['AAN'][1])/2, average=0.105,
show_names=False,
sensors=True,
mask=mAANch,
colorbar=p,
contours=False,
size=3)
ax.set_title(s)
n+=1
plt.suptitle(f'AAN ')
fig.supxlabel(f'Colors range from {vlim[0]} (blue) to {vlim[1]} \u03BCV (red)')
plt.savefig(os.path.join(DIRFILES, 'AAN_topo.png'), dpi=300)
plt.close()