Hello I am triying to plot a list of colors in the following format:
img = cv2.imread('./img/a.png')
ground = cv2.imread('./img/b.png')
descriptor = [img[ij] for ij in np.ndindex(ground.shape[:2]) if all(ground[ij])]
descriptor[0]
array([ 72, 70, 115], dtype=uint8)
I want to get a chart like this:
In order to do this I am using a scatter plot of the following way:
fig = plt.figure()
axis = fig.add_subplot(1, 1, 1, projection="3d")
axis.scatter(descriptor[0],descriptor[0],descriptor[0], facecolors=descriptor, marker=".")
plt.show()
But I am getting the following error:
ValueError: 'c' argument must be a mpl color, a sequence of mpl colors or a sequence of numbers, not [array([ 72, 70, 115]
but if I change the list of colors like this:
descriptor = [list(img[ij]) for ij in np.ndindex(ground.shape[:2]) if all(ground[ij])]
descriptor[0]
[ 72, 70, 115]
I get this error:
'c' argument must be a mpl color, a sequence of mpl colors or a sequence of numbers, not [[72, 70, 115], [71, 69, 114]
How can I plot the list like the chart?
Thanks
a = [np.random.randint(10,240,3) for _ in range(20)]
descriptor = a

