Skip to content

Commit

Permalink
Use an mpl LinearSegmentedColormap (#262)
Browse files Browse the repository at this point in the history
* Use an mpl LinearSegmentedColormap in order to ensure palette colors are interpolated

* Fixed failing tests
  • Loading branch information
ricardogsilva authored Oct 7, 2024
1 parent c4da393 commit 5a22f46
Show file tree
Hide file tree
Showing 3 changed files with 295 additions and 238 deletions.
4 changes: 3 additions & 1 deletion arpav_ppcv/palette.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def apply_palette(
# this converts from the AARRGGBB format which is what the .pal files have
# to RRGGBB
rgb_colors = [f"#{c[3:]}" for c in colors]
cmap = mpl.colors.ListedColormap(rgb_colors)
cmap = mpl.colors.LinearSegmentedColormap.from_list(
"arpav-palette", rgb_colors, N=250
)
result = []
step = (maximum - minimum) / (num_stops - 1)
for current_stop in range(num_stops):
Expand Down
Loading

0 comments on commit 5a22f46

Please sign in to comment.