0
你好,先謝謝你的幫助! 我用MATLAB製作了4個顏色組的3D散點圖(上傳,見下文)。 現在我想根據時間對散點圖進行動畫處理。所以如果每個點都有時間戳,我想按順序顯示它們。因此,例如:如果我有A,B,C點在車輛的特定xyz位置上悔改錯誤,並且錯誤A是在上午10點製作的,錯誤B在12PM,錯誤C在3PM,我想繪製動畫中的順序點。動畫3D組散點圖關於時間MATLAB
另外如果可能的話,我想用滾動條做一個GUI,這樣我就可以滾動時間或回到時間,從而在我回到時間的同時前進時間或刪除點時添加點。或者至少有一個選項可以暫停scater進程。
注:散點圖將有大約2000-3000點......我不知道這是否會有所作爲。我也是MATLAB新手:-)
非常感謝您的幫助和時間! 親切的問候
阿爾弗雷多
%Scatterplot data
x = [ 50 55 200 210 350 360 400 450 550 560 600 670 750 850 860];
y = [ 50 -50 100 -100 150 -150 151 -151 150 -150 152 -152 150 -150 150];
z = [ 120 120 100 300 100 300 100 300 100 300 100 300 100 300 100];
% alocates space for the z data by creating a matrix array of all ones
g = [0*ones(3,1);1*ones(3,1); 2*ones(3,1); 3*ones(3,1); 4*ones(3,1); ];
%set specific RGB color value for positions 0-4 and background color
color = [0 0 0; 1 0 0; 0 0 1; 1 1 0; 0 1 0]
whitebg([ 0.6758 0.8438 0.8984]) % light blue background
% gscatter creates a 2D matrix with the values from x and y
% and creates groups acording to the 'g' matrix size
% h = gscatter captures output argument and returns an array of handles to the lines on the graph)
h = gscatter(x, y, g, color)
%% for each unique group in 'g', set the ZData property appropriately
gu = unique(g);
for k = 1:numel(gu)
set(h(k), 'ZData', z(g == gu(k)));
end
%set the aspect ratio, grid lines, and Legend names for the 3D figure
daspect([4.5 5 5])
grid on
legend('Position 0','Position 1','Position 2','Position 3','Position 4')
% view a 3D grapgh (for 2D set to "2")
view(3)
嗨,歡迎來到SO!請注意,在這裏通常會意識到,每個帖子只會提出一個問題,並且保持問題簡短並且重點突出。 –