Hello everyone,
I’m having difficulties trying to create a spectral density plot with a topomap. I’m using the configuration sphere=(0.00, 0.02, 0.03, 0.11)
to position the channels in their appropriate locations. However, the colors of the spectral density are not displaying correctly in the topomap region, shifting out of place.
I would like to know if anyone has encountered a similar issue or if you could provide suggestions on how to correct this misalignment between the channels and colors in the plot.
Thanks in advance for your help!
freq_bands = {'Delta': (1, 4),
'Theta': (4, 8),
'Alpha': (8, 13),
'Beta': (13, 30),
'Gamma': (30, 50),
'Super Gamma': (70, 90)}
extrapolations = ["local"]
fig, axes = plt.subplots(2, 3, figsize=(15, 10))
axes = axes.flatten()
all_band_data = [x]
for i, (banda, (baixa, alta)) in enumerate(freq_bands.items()):
raw_banda = raw.copy().filter(l_freq=baixa, h_freq=alta, method='iir', verbose=False)
dados_banda = raw_banda.get_data()[:, 0]
all_band_data.append(dados_banda)
im, _ = mne.viz.plot_topomap(dados_banda, raw_banda.info, axes=axes[i], sphere=(0.00, 0.02, 0.03, 0.11),cmap="Spectral_r", names=channels, contours=5, show=False)
axes[i].set_title(f'Banda {banda}')
vmin = float('inf')
vmax = float('-inf')
for freq in range(len(dados_banda)):
vmin = min(vmin, np.min(dados_banda[freq]))
vmax = max(vmax, np.max(dados_banda[freq]))
norma = plt.Normalize(vmin=vmin, vmax=vmax)
cbar_ax = fig.add_axes([0.92, 0.15, 0.02, 0.7])
cbar = plt.colorbar(im, cax=cbar_ax,
norm=norma)
cbar.ax.set_title("uV²", fontsize=12)
plt.suptitle('frequences, fontsize=16)
plt.tight_layout(rect=[0, 0, 0.9, 0.95])
plt.show()