# How to plot multiple topomap in one figure?

**URL:** <https://mne.discourse.group/t/how-to-plot-multiple-topomap-in-one-figure/7976>\
**Category:** Support & Discussions\
**Tags:** visualization\
**Created:** [December 8, 2023, 8:35am UTC](https://mne.discourse.group/t/how-to-plot-multiple-topomap-in-one-figure/7976 "2023-12-08T08:35:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Huizhong](https://avatars.discourse-cdn.com/v4/letter/h/b38774/32.png) [@Huizhong](https://mne.discourse.group/u/Huizhong)\
**Post date:** [December 8, 2023, 8:35am UTC](https://mne.discourse.group/t/how-to-plot-multiple-topomap-in-one-figure/7976/1 "2023-12-08T08:35:56Z")

</div>

Hi, I tried to plot topomap of six conditions in one figure, but failed in merging them together. How could I plot all of them in one figure? My code as shown bellow:

```python
fig, axs = plt.subplots(6, 1, figsize=(18, 24), constrained_layout=True, sharex=True, sharey=True)
times = np.arange(-.050, .850, .100)
contrasts = ['contr1', 'contr2', 'contr3', 'contr4', 'contr5', 'contr6']
for ax, contr in zip(axs, contrasts):
    mne.grand_average(evokeds_diff[contr]).plot_topomap(times, average=0.100, ch_type='eeg', show_names=False, sensors=True, contours=False, colorbar=True, show=False)

plt.savefig('all_contrasts.png')
plt.show()

```

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![Huizhong](https://avatars.discourse-cdn.com/v4/letter/h/b38774/32.png) [@Huizhong](https://mne.discourse.group/u/Huizhong)\
**Post date:** [December 8, 2023, 8:44am UTC](https://mne.discourse.group/t/how-to-plot-multiple-topomap-in-one-figure/7976/2 "2023-12-08T08:44:37Z")

</div>

I have tried to add “axes=ax” in mne function, but it popped out error message. I have to change the value of axs into 10 to fix the error. After that, the topomap became too small to see it clearly. So, I don’t think the axes value should be plugged into the mne function (The default value of axes in mne is “None”).

---

<div class="post-metadata">

**Author:** ![sotpapad](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sotpapad/32/2184_2.png) [@sotpapad](https://mne.discourse.group/u/sotpapad)\
**Post date:** [December 8, 2023, 1:56pm UTC](https://mne.discourse.group/t/how-to-plot-multiple-topomap-in-one-figure/7976/3 "2023-12-08T13:56:08Z")

</div>

I am not quite sure I understand your problem, maybe the error message would be informative. But, I suspect that it has something to do with the fact that you want to plot a colorbar. You may be running out of axes too soon as the actual topomap and the colorbar need to occupy one axis each.

---

<div class="post-metadata">

**Author:** ![Huizhong](https://avatars.discourse-cdn.com/v4/letter/h/b38774/32.png) [@Huizhong](https://mne.discourse.group/u/Huizhong)\
**Post date:** [December 9, 2023, 2:54am UTC](https://mne.discourse.group/t/how-to-plot-multiple-topomap-in-one-figure/7976/4 "2023-12-09T02:54:53Z")

</div>

Thanks, Sotiris.

When I set the colorbar as False, I got a right picture, but without the colorbar. So, my next question is how could I put one colorbar on my figure.

 ![Figure_1](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/9/9bf708a0d47220b3eb0e8ba9a23cda8cc6600724.jpeg)

Furthermore, when I write the title value, the results always wrong. The error message is "TypeError: Evoked.plot\_topomap() got an unexpected keyword argument ‘title’ "

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![drammock](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/drammock/32/4_2.png) [@drammock](https://mne.discourse.group/u/drammock)\
**Post date:** [December 11, 2023, 5:25pm UTC](https://mne.discourse.group/t/how-to-plot-multiple-topomap-in-one-figure/7976/5 "2023-12-11T17:25:53Z")

</div>

> [@Huizhong](#):
>
> When I set the colorbar as False, I got a right picture, but without the colorbar. So, my next question is how could I put one colorbar on my figure.

I would start by changing `fig, axes = plt.subplots(6, 1)` to `fig, axes = plt.subplots(6, len(times)+1)`, and pass `colorbar=True`. That should give you enough axes in each row for your evoked topomaps plus one extra for the colorbar. You’ll probably notice that the axis limits on each colorbar are slightly different, which means _you shouldn’t show just one colorbar unless you provide the same fixed `vlim` values for each row_. So now re-do the plot with a `vlim` value passed in too. If it looks OK, then you can _remove_ the colorbars you don’t want (e.g., using `axes[-1, -1].remove()` would remove the bottom-right axes).

> [@Huizhong](#):
>
> when I write the title value, the results always wrong. The error message is "TypeError: Evoked.plot\_topomap() got an unexpected keyword argument ‘title’ "

the `title` parameter was deprecated and removed. please use the matplotlib method `fig.suptitle()` instead.

---

<div class="post-metadata">

**Author:** ![Huizhong](https://avatars.discourse-cdn.com/v4/letter/h/b38774/32.png) [@Huizhong](https://mne.discourse.group/u/Huizhong)\
**Post date:** [December 11, 2023, 7:33pm UTC](https://mne.discourse.group/t/how-to-plot-multiple-topomap-in-one-figure/7976/6 "2023-12-11T19:33:28Z")

</div>

Thanks so much~
