我想在不丢失原始颜色数的情况下从颜色图中删除前 n 种颜色

I would like to remove the first n colors from a colormap without losing the original number of colours

from matplotlib import cm
import seaborn as sns
import matplotlib.pyplot as plt

这是原始颜色图

cmap = [cm.inferno(x)[:3] for x in range(0,256)]
sns.palplot(cmap)

我的首选结果与下面显示的颜色图一致,除了,原始颜色数

cmap2 = [cm.inferno(x)[:3] for x in range(0,256)][100:]
sns.palplot(cmap2)

我相信 "same resolution" 你的意思是你想要调色板中有 256 种颜色。我实际上认为这与原始调色板具有不同的分辨率,因为颜色 space 中的值更接近。无论如何,我认为你可以通过做得到你想要的:

import numpy as np
import seaborn as sns
from matplotlib import cm

x = np.linspace(.3, 1, 256)
pal = cm.inferno(x)
sns.palplot(pal)