Skip to content

Commit

Permalink
Support old matplotlib by matplotlib.cm.get_cmap
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Feb 14, 2023
1 parent c55bfb6 commit d8b8357
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion imgviz/depth.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ def __call__(self, depth, dtype=np.uint8):
normalized[isnan] = 0

if isinstance(self._colormap, str):
colormap_func = matplotlib.colormaps[self._colormap]
if hasattr(matplotlib, "colormaps"):
colormap_func = matplotlib.colormaps[self._colormap]
else:
colormap_func = matplotlib.cm.get_cmap(self._colormap)
else:
colormap_func = self._colormap
rgb = colormap_func(normalized)[:, :, :3]
Expand Down

0 comments on commit d8b8357

Please sign in to comment.