matplotlib.pyplot 中的 HSV 颜色图

问题描述

我正在尝试重现显示 hue distribution 使用 HSV 颜色图的图像。

我有与色调通道相关的信息,表示为字典,聚合在多个样本上:

hue = {
    0 : hue_0,1 : hue_1,...
  255 : hue_255
}

我尝试通过以下方式使用 here 中 matplotlib 的 colorline 示例:

import matplotlib.pyplot as plt

x = list(hue.keys())
y = list(hue.values())

fig,ax = plt.subplots()
lc = colorline(x,y,cmap='hsv')
plt.colorbar(lc)
plt.xlim(0,255)
plt.ylim(0,max(y))
plt.show()

但它产生了this

我已经想出了如何将 Hue dict 绘制为一条线:

import matplotlib.pyplot as plt

lists = sorted(hue.items())

x,y = zip(*lists)

plt.plot(x,y)
plt.show()

但我不知道如何将 HSV 颜色图添加到绘图中。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)