Repository: mne-tools/mne-python

Issue:
add_volume_labels() method from mne.viz.get_brain_class() doesn't allow receiving a dict as legend
### Description of the problem

Hi,

In the MNE documentation for the add_volume_labels() method  from mne.viz.get_brain_class(), it's stated that you pass a dictionary to the legend option, which is actually implemented on the code. However, line 2475 from the _brain.py file actually does a wrong validation since it is set to `_validate_type(legend, (bool, None), 'legend')`; therefore, it actually doesn't allow using the dict option. It should be set to `validate_type(legend, (bool, None, dict), 'legend')` in order to make it work.

Best,
Mauricio

### Steps to reproduce

```Python
This is the code I was using to reproduce:
%matplotlib inline
import os.path as op
import mne
import numpy as np

sample_data_folder = mne.datasets.sample.data_path()
subjects_dir = sample_data_folder / 'subjects'

fname_aseg = op.join(subjects_dir, 'sample', 'mri', 'aseg.mgz')
label_names = mne.get_volume_labels_from_aseg(fname_aseg)

Brain2 = mne.viz.get_brain_class()
brain2 = Brain2('sample', hemi='both', surf='pial', alpha=0.2,
              cortex='low_contrast', subjects_dir=subjects_dir, 
              size=(800, 600))
plotargs = {
    'bcolor':(0.5, 0.5, 0.5), 
    'border':False,
    'size':(0.2, 0.6),
    'loc':'upper left'
}
brain2.add_volume_labels(aseg='aseg', labels=label_names, alpha=1, smooth=0, legend=plotargs)
```


### Link to data

_No response_

### Expected results

The legend is shown in the qt widget.

### Actual results

Legend is not shown and an error is displayed.

### Additional information

Platform:         Linux-5.15.0-52-generic-x86_64-with-glibc2.35
Python:           3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:35:26) [GCC 10.4.0]
Executable:       /home/mcespedes/miniconda3/envs/mne/bin/python
CPU:              x86_64: 8 cores
Memory:           15.4 GB

mne:              1.2.1
numpy:            1.23.4 {OpenBLAS 0.3.21 with 8 threads}
scipy:            1.9.3
matplotlib:       3.6.0 {backend=module://matplotlib_inline.backend_inline}

sklearn:          1.1.3
numba:            0.56.3
nibabel:          4.0.2
nilearn:          0.9.2
dipy:             1.5.0
openmeeg:         Not found
cupy:             Not found
pandas:           1.5.1
pyvista:          0.36.1 {OpenGL 4.6 (Core Profile) Mesa 22.0.5 via Mesa Intel(R) Xe Graphics (TGL GT2)}
pyvistaqt:        0.9.0
ipyvtklink:       0.2.2
vtk:              9.2.2
qtpy:             2.2.1 {PyQt5=5.15.6}
ipympl:           Not found
...
mne_features:     Not found
mne_qt_browser:   0.4.0
mne_connectivity: Not found
mne_icalabel:     Not found


Discussion:
Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴🏽‍♂️

> It should be set to validate_type(legend, (bool, None, dict), 'legend') in order to make it work.

Have you tried making this change? If you do, does it work correctly? If so, a PR to fix this would be great!
Yes I have. Will create the PR then!

Thanks,
Mauricio 

Resolving patch:
diff --git a/mne/viz/_brain/_brain.py b/mne/viz/_brain/_brain.py
--- a/mne/viz/_brain/_brain.py
+++ b/mne/viz/_brain/_brain.py
@@ -2472,7 +2472,7 @@ def add_volume_labels(self, aseg='aparc+aseg', labels=None, colors=None,
             labels = [lut_r[idx] for idx in DEFAULTS['volume_label_indices']]
 
         _validate_type(fill_hole_size, (int, None), 'fill_hole_size')
-        _validate_type(legend, (bool, None), 'legend')
+        _validate_type(legend, (bool, None, dict), 'legend')
         if legend is None:
             legend = len(labels) < 11
 


Test patch:
diff --git a/mne/viz/_brain/tests/test_brain.py b/mne/viz/_brain/tests/test_brain.py
--- a/mne/viz/_brain/tests/test_brain.py
+++ b/mne/viz/_brain/tests/test_brain.py
@@ -331,9 +331,15 @@ def __init__(self):
     brain.remove_skull()
 
     # add volume labels
+    plotargs = {
+        'bcolor': (0.5, 0.5, 0.5),
+        'border': False,
+        'size': (0.2, 0.6),
+        'loc': 'upper left'
+    }
     brain.add_volume_labels(
         aseg='aseg', labels=('Brain-Stem', 'Left-Hippocampus',
-                             'Left-Amygdala'))
+                             'Left-Amygdala'), legend=plotargs)
     brain.remove_volume_labels()
 
     # add sensors