Skip to content

Add example, Fix get_cmap #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions examples/brain_plotting/plot_intracranial_electrodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,12 @@
fig, axes = plot_brain_overlay(brain, view='lateral')
plt.show()

###############################################################################
# Directly plot Destrieux Atlas region labels overlaid on the brain
brain = Brain('pial', subject_dir='./fsaverage/')

brain.lh.overlay = brain.lh.labels
brain.rh.overlay = brain.rh.labels

fig, axes = plot_brain_overlay(brain, cmap='tab20', vmin=1, vmax=75)
plt.show()
5 changes: 4 additions & 1 deletion naplib/utils/surfdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ def surfdist_viz(

# if cmap is given as string, translate to matplotlib cmap
if isinstance(cmap, str):
cmap = plt.cm.get_cmap(cmap)
try:
cmap = plt.cm.get_cmap(cmap)
except AttributeError:
cmap = plt.get_cmap(cmap)

if ax is None:
premade_ax = False
Expand Down