I am trying to reproduce a graph that shows the hue distribution of an image using an HSV colormap.
I have the information related to the hue channel represented as a dict, aggregated on multiple samples:
hue = {
0 : hue_0,
1 : hue_1,
...
255 : hue_255
}
I have tried to use matplotlib's colorline
example from here in the following way:
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()
but it produced this.
I have figured how to plot the hue dict as a line:
import matplotlib.pyplot as plt
lists = sorted(hue.items())
x, y = zip(*lists)
plt.plot(x, y)
plt.show()
But I cannot figure out how to add an HSV colormap to the plot.