Hi,
I have a matrix B of 94859 x 3. In the the below command, I would like to change each individual marker color based on the data values stored in the B(:,3). Could somebody help me with this ??
plot (B(:,1),B(:,2), '*');

 採用された回答

Mathieu NOE
Mathieu NOE 2022 年 5 月 18 日

0 投票

hello
my suggestions below
S = 35; % size of symbols in pixels
% normalize vector to go from zero to 1
normV = (B(:,3)-min(B(:,3)))./(max(B(:,3))-min(B(:,3)))
% blue to red.
C = [normV zeros(size(normV)) 1-normV];
figure
scatter(B(:,1),B(:,2),S,C,'Marker','s')
colorbar('vert');
% jet colors
CC = jet(numel(normV));
figure
scatter(B(:,1),B(:,2),S,CC,'Marker','s')
colorbar('vert');

3 件のコメント

Mathieu NOE
Mathieu NOE 2022 年 5 月 18 日
maybe you prefer to fill the markers , :
S = 35; % size of symbols in pixels
% normalize vector to go from zero to 1
normV = (B(:,3)-min(B(:,3)))./(max(B(:,3))-min(B(:,3)))
% blue to red.
C = [normV zeros(size(normV)) 1-normV];
figure
scatter(B(:,1),B(:,2),S,C,'fill','Marker','s')
colorbar('vert');
% jet colors
CC = jet(numel(normV));
figure
scatter(B(:,1),B(:,2),S,CC,'fill','Marker','s')
colorbar('vert');
Turbulence Analysis
Turbulence Analysis 2022 年 5 月 18 日
Thanks!!
Mathieu NOE
Mathieu NOE 2022 年 5 月 18 日
My pleasure !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by