I would like to change the location of the colorbar when plotting an overlay on top of an inflated brain surface using MNE’s brain class.
The docs as per…
Brain = mne.viz.get_brain_class()
brain.add_data?
… say that I can specify where the color bar is supposed to appear by providing a (row, col) tuple for the colorbar argument instead of a Boolean.
But what does row and column mean in this context? Surely, this isn’t in pixels. It also isn’t in fractions of image dimensions such that (.5, .5) would place it in the center. Only (0, 0) seems to produce a visible color bar and it places it at the bottom of the plot.
How can I put it at the North, South, East, West locations of the plot?
The position of the color bar in Brain’s add_data method is controlled via the colorbar_kwargs. These are passed on to pyvista.Plotter.add_scalar_bar as a dictionary. So to control the color bar position, you need to specify a dictionary such as for instance {'position_x': .05, 'position_y': .05} to place the color bar at the bottom left corner of the image. Position coordinates are expressed in fractions of the image dimensions and the origin is the bottom left corner.
Although the documentation of this quite basic functionality would probably benefit from updating, I refrained from doing so because the intended purpose of the colorbar argument in the add_data method when used with a (row, column) tuple remains opaque to me.