我想基于3D坐标绘制数据,并且此数据必须将红点绘制为低值,将蓝点绘制为高值。 我想出了怎么做的颜色图部分,但是当我尝试在颜色栏中使用颜色图时,它没有显示正确的颜色和C值;
示例:
x = [1 2 3 4 5 0 20 4]
y = [5 4 2 3 1 2 10 2]
z = [2 2 6 3 4 0 10 33]
C = [1 10 20 30 40 2 10 5] % 1 have to be red and 40 have to be blue
m = length(x);
H = ones(m,1);
for i=1:m
H(i,1) = ((C(i)-min(C))/(max(C)-min(C)))*(1-0.65) + 0.65
end
S = ones(m,1);
V = ones(m,1);
colourmap2 = hsv2rgb([H,S,V]);
f3=figure('pos', [950 50 450 450]);
set(f3,'render','zbuffer');
hold on
for i3=1:m
stem3(x(i3),y(i3),z(i3),'Color',colourmap2(i3,:)...
, 'LineStyle', 'none');
end
clc
xlabel('x'); ylabel('y'); zlabel('z');
colorbar
hold off;
view([-45,-45]);