我想将多个帧上的相同像素绘制到3d散点图上-我设法使该点起作用,但是我希望每个点的颜色为其值表示的颜色。
我尝试构建所有rgb值的数组并将其传递给colors参数。我也尝试过直接传递相应的rgb值。
#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()
我当前收到错误消息:
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.