Skip to content

Commit

Permalink
Merge pull request #10 from int-brain-lab/fix_cmap
Browse files Browse the repository at this point in the history
color map fix
  • Loading branch information
mayofaulkner authored Jun 10, 2024
2 parents 9d1b8af + 0cee727 commit 8fc095c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions iblatlas/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import numpy as np
from scipy.ndimage import gaussian_filter
from scipy.stats import binned_statistic
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import cm, colors
from matplotlib.patches import Polygon, PathPatch
Expand Down Expand Up @@ -302,7 +303,7 @@ def _plot_slice_vector(coords, slice, values, mapping, empty_color='silver', cle
else:
fig = ax.get_figure()

colormap = colors.get_cmap(cmap)
colormap = matplotlib.colormaps.get_cmap(cmap)
norm = colors.Normalize(vmin=clevels[0], vmax=clevels[1])
nan_vals = np.isnan(values)
rgba_color = np.full((values.size, 4), fill_value=np.nan)
Expand Down Expand Up @@ -521,7 +522,7 @@ def plot_scalar_on_flatmap(regions, values, depth=0, flatmap='dorsal_cortex', ma
d_idx = int(np.round(depth / ba.res_um)) # need to find nearest to 25

if background == 'boundary':
cmap_bound = colors.get_cmap("bone_r").copy()
cmap_bound = matplotlib.colormaps.get_cmap("bone_r").copy()
cmap_bound.set_under([1, 1, 1], 0)

if ax:
Expand Down Expand Up @@ -893,7 +894,7 @@ def plot_swanson_vector(acronyms=None, values=None, ax=None, hemisphere=None, br

if acronyms is not None:
ibr, vals = br.propagate_down(acronyms, values)
colormap = colors.get_cmap(cmap)
colormap = matplotlib.colormaps.get_cmap(cmap)
vmin = vmin or np.nanmin(vals)
vmax = vmax or np.nanmax(vals)
norm = colors.Normalize(vmin=vmin, vmax=vmax)
Expand Down

0 comments on commit 8fc095c

Please sign in to comment.