- MNE-Python version: 0.23.0
- macOS
Hi,
I am trying to plot a topomap of data that I calculated for each channel in some MEG data. So for example for channel: MEG0113 I may have a value of 0.5.
I am able to extract x,y positions for each channel using:
# Just gradiometers
layout = mne.channels.read_layout('Vectorview-grad')
channelPos = pd.DataFrame(layout.pos)
channelPos['channel'] = layout.names
which gives me a dataframe that looks like:
I am then using the x and y positions to plot my data with the plot_topomap function like so:
# create a two-panel figure
fig,(ax1,ax2) = plt.subplots(ncols=2, figsize=[12,8])
im, cm = mne.viz.plot_topomap(data1, channelPos[['x', 'y']].values, axes=ax1, names=channelPos['channel'], show_names=False, vmin=vmin_, vmax=vmax_, contours=0, show=False, cmap='Greens')
im, cm = mne.viz.plot_topomap(data2, channelPos[['x', 'y']].values, axes=ax2, names=channelPos['channel'], show_names=False, vmin=vmin_, vmax=vmax_, contours=0, show=False, cmap='Greens')
# colorbar
ax_x_start = 0.95
ax_x_width = 0.02
ax_y_start = 0.3
ax_y_height = 0.5
cbar_ax = fig.add_axes([ax_x_start, ax_y_start, ax_x_width, ax_y_height])
clb = fig.colorbar(im, cax=cbar_ax)
clb.ax.set_title("units",fontsize=10)
plt.show()
gives the following plots:
I’m wondering (1) why the positions are not aligned to the center, and (2) why does the size not fit on the head outline?
I can manually change the x/y values in the channelPos dataframe to align it to head, but is there an automatic way to align it? Or should I be plotting the values in a different way entirely?
Thank you