この質問はmy previous postにリンクしています。私は、「カラーマップを使用する場合は
:私の質問3Dプロットでのカラーマップの使用方法は?
:これは上記のコードからの画像結果である
%% How to plot each matrix in a cell in 3d plot(1 matrix with 1 color) ?
% Generate Sample data cell A(1x10 cell array)
clear; clc;
A = cell(1,10); % cell A(1x10 cell array)
for kk = 1:numel(A)
z = 10*rand()+(0:pi/50:10*rand()*pi)';
x = 10*rand()*sin(z);
y = 10*rand()*cos(z);
A{kk} = [x,y,z];
end
% Plot point of each matrix in one figure with different color
figure
hold on;
for i = 1:numel(A)%run i from 1 to length A
C = repmat([i],size(A{i},1),1);%create color matrix C
scatter3(A{i}(:,1),A{i}(:,2),A{i}(:,3),C,'filled');
end
grid on;
view(3); % view in 3d plane
colorbar;
:
は、以下のコードを考えてみましょう"マトリックスの数に対応する色を表示するには、どのように行うことができますか?
例:投稿コードでが、私は10個の行列(A{1}
、A{2}
、A{3}
、...、A{10}
)セルA
内部を持っているので、どのようにカラーバーを作るためにプロットに使用10色を表示し、どのようにプロットで使用されている10色に対応する1から10までの10の数値を表示します(画像に示されています)。あなたの次のコード行で