From e850814da0354491252e14ff3e3a54225d698308 Mon Sep 17 00:00:00 2001 From: Sean Li <22557931+sean0407@users.noreply.github.com> Date: Mon, 19 Oct 2026 22:25:38 +0800 Subject: [PATCH] Fix removed Matplotlib colormap API usage --- bin/import_colmap.py | 2 +- bin/plot_depthmaps | 2 +- bin/plot_matches.py | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bin/import_colmap.py b/bin/import_colmap.py index c592f9d43..b5b146c96 100755 --- a/bin/import_colmap.py +++ b/bin/import_colmap.py @@ -102,7 +102,7 @@ def depth_colormap( """ Colormaps and sets 0 (invalid) values to zero_color """ - sm = cm.ScalarMappable(cmap=cm.get_cmap(cmap)) + sm = cm.ScalarMappable(cmap=pl.get_cmap(cmap)) sm.set_array(d) rgb = sm.to_rgba(d)[:, :, :3] rgb[d == invalid_val] = invalid_color diff --git a/bin/plot_depthmaps b/bin/plot_depthmaps index 30f376838..2cb8408ab 100755 --- a/bin/plot_depthmaps +++ b/bin/plot_depthmaps @@ -22,7 +22,7 @@ def depth_colormap(d, cmap=None, invalid_val=0, invalid_color=(.5, .5, .5)): """ Colormaps and sets 0 (invalid) values to zero_color """ - sm = cm.ScalarMappable(cmap=cm.get_cmap(cmap)) + sm = cm.ScalarMappable(cmap=pl.get_cmap(cmap)) sm.set_array(d) rgb = sm.to_rgba(d)[:, :, :3] rgb[d == invalid_val] = invalid_color diff --git a/bin/plot_matches.py b/bin/plot_matches.py index 019a49304..0ea6e35c5 100755 --- a/bin/plot_matches.py +++ b/bin/plot_matches.py @@ -6,7 +6,6 @@ from itertools import combinations from typing import Iterable, List -import matplotlib.cm as cm import matplotlib.pyplot as pl import numpy as np from numpy import ndarray @@ -31,7 +30,7 @@ def plot_matches(im1: ndarray, im2: ndarray, p1: ndarray, p2: ndarray) -> None: def plot_graph(data: dataset.DataSet) -> None: - cmap = cm.get_cmap("viridis") + cmap = pl.get_cmap("viridis") connectivity = {} for im1 in images: for im2, matches in data.load_matches(im1).items():