# colorbar in plot\_topomap

**URL:** <https://mne.discourse.group/t/colorbar-in-plot-topomap/5299>\
**Category:** Support & Discussions\
**Tags:** eeg, visualization\
**Created:** [July 19, 2022, 6:12pm UTC](https://mne.discourse.group/t/colorbar-in-plot-topomap/5299 "2022-07-19T18:12:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![apoorva6262](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@apoorva6262](https://mne.discourse.group/u/apoorva6262)\
**Post date:** [July 19, 2022, 6:12pm UTC](https://mne.discourse.group/t/colorbar-in-plot-topomap/5299/1 "2022-07-19T18:12:26Z")

</div>

Hi,

How do I add a color bar when plotting a eeg based topomap using mne.viz.plot\_topomap?  
I dont see the colorbar argument - [mne.viz.plot\_topomap — MNE 1.0.3 documentation](https://mne.tools/stable/generated/mne.viz.plot_topomap.html)

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [July 19, 2022, 6:50pm UTC](https://mne.discourse.group/t/colorbar-in-plot-topomap/5299/2 "2022-07-19T18:50:40Z")

</div>

Hello, are you sure you want to use `mne.viz.plot_topomap()` and not the `plot_topomap()` method of `Evoked`? What kind of data are you planning to plot?

---

<div class="post-metadata">

**Author:** ![apoorva6262](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@apoorva6262](https://mne.discourse.group/u/apoorva6262)\
**Post date:** [July 19, 2022, 7:05pm UTC](https://mne.discourse.group/t/colorbar-in-plot-topomap/5299/3 "2022-07-19T19:05:32Z")

</div>

@richard ,

I have the average power values for eeg channel on an excel sheet. I am using those values to plot the topomap. And both `mne.viz.plot_topomap()` and not the `plot_topomap()` give me the error - `got an unexpected keyword argument 'colorbar`

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [July 19, 2022, 7:26pm UTC](https://mne.discourse.group/t/colorbar-in-plot-topomap/5299/4 "2022-07-19T19:26:03Z")

</div>

> [@apoorva6262](#):
>
> And both `mne.viz.plot_topomap()` and not the `plot_topomap()` give me the error - `got an unexpected keyword argument 'colorbar`

`Evoked.plot_topomap()` should not throw this error.

`mne.viz.plot_topomap()` returns the image created by Matplotlib, which you can use to create a colorbar. You’d do something like the following (untested):

```python
fig, ax = plt.subplots()
img, _ = mne.viz.plot_topomap(..., axes=ax)
cbar = plt.colorbar(
    ax=ax, shrink=0.75, orientation='vertical', mappable=img,
)
cbar.set_label('Average power')

```
