I want to plot the same pixel across multiple frames onto a 3d scatter plot - I have managed to get the plot working however I want the colour of each point to be the colour its values represent.
I have tried building an array of all the rgb values and passing it into the colors parameter. I have also tried passing in the corresponding rgb values directly.
#Data visualisation
from matplotlib import pyplot
from mpl_toolkits.mplot3d import Axes3D
fig = pyplot.figure()
ax = Axes3D(fig)
B_vals = []
G_vals = []
R_vals = []
rgb_array = []
x_pix = 1
y_pix = 1
for i in range(len(img_list)):
blue = img_list[i][x_pix][y_pix][0]
green = img_list[i][x_pix][y_pix][1]
red = img_list[i][x_pix][y_pix][2]
B_vals.append(blue)
G_vals.append(green)
R_vals.append(red)
rgb_array.append(list(img_list[i][x_pix][y_pix]))
ax.set_xlim(0, 255)
ax.set_ylim(0, 255)
ax.set_zlim(0, 255)
ax.set_xlabel('Blue')
ax.set_ylabel('Green')
ax.set_zlabel('Red')
ax.scatter(B_vals, G_vals, R_vals, color = (B_vals,G_vals,R_vals))
pyplot.show()
I am currently getting the error:
ValueError: 'color' kwarg must be an mpl color spec or sequence of color specs.
For a sequence of values to be color-mapped, use the 'c' argument instead.