From 570c16a57a5e90bd63ca48a161ef9d1d22f26155 Mon Sep 17 00:00:00 2001 From: Matthew Turk Date: Wed, 10 Nov 2021 06:09:08 -0600 Subject: [PATCH] Backport PR #3661: BUG: fix an off-by-one error in ColorTransferFunction.to_map_colormap method --- yt/visualization/volume_rendering/transfer_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt/visualization/volume_rendering/transfer_functions.py b/yt/visualization/volume_rendering/transfer_functions.py index 93eb2864da..6f032ab130 100644 --- a/yt/visualization/volume_rendering/transfer_functions.py +++ b/yt/visualization/volume_rendering/transfer_functions.py @@ -787,7 +787,7 @@ def map_to_colormap( self.nbins * (ma - self.x_bounds[0]) / (self.x_bounds[1] - self.x_bounds[0]) ) rel0 = max(rel0, 0) - rel1 = min(rel1, self.nbins - 1) + rel1 = min(rel1, self.nbins - 1) + 1 tomap = np.linspace(0.0, 1.0, num=rel1 - rel0) cmap = get_cmap(colormap) cc = cmap(tomap)