nltools
nltools copied to clipboard
add vmin, vmax, cmap options to plotting functions
Current plot uses a cmap where the extreme values are white. For example:
Fix would be to allow passing a vmin, vmax, or cmap to _viewer
brain or plot brain, so that it plots like this using cmap="RdBu_r":
For example, change the cmap to RdBu_r in _viewer https://github.com/cosanlab/nltools/blob/91822a45778415ee2cdded7134e60bcde2bb7814/nltools/plotting.py#L115
at https://github.com/cosanlab/nltools/blob/91822a45778415ee2cdded7134e60bcde2bb7814/nltools/plotting.py#L135
like so.
if thresh == 0:
thresh = 1e-6
else:
if percentile_threshold:
thresh = str(thresh) + "%"
if isinstance(idx, int):
b = brain[idx].to_nifti()
else:
b = brain.to_nifti()
if anatomical:
bg_img = anatomical
else:
bg_img = "MNI152"
cut_coords = kwargs.get("cut_coords", [0, 0, 0])
if surface:
return view_img_on_surf(b, threshold=thresh, **kwargs)
else:
return view_img(
b, bg_img=bg_img, threshold=thresh, cut_coords=cut_coords, cmap='RdBu_r', **kwargs
)```