How do I add a colorbar to a polarscatter chart?
10 ビュー (過去 30 日間)
古いコメントを表示
How can I add a colorbar based on the ''value'' value for my Polarscatter chart?
azi_dif=36;
deggorad=pi/180;
azi=[0;36;72;108;144;180;216;252;-288;324;360];
th =deggorad*azi;
radi=[0;0.1;0.3;0.5;0.8;0.85;1;0.9;0.65;0.84;0.86];
val=[15;20;14;17;19;15;13;14;17;19;22];
cn = ceil(max(val));
cm = colormap(jet(cn));
figure(2)
s=polarscatter(th, radi, [], cm(fix(val),:), 'filled');
colorbar
s.SizeData =100;
grid on
採用された回答
Dave B
2023 年 1 月 14 日
編集済み: Dave B
2023 年 1 月 14 日
I think you can simplify this task by passing the data directly into scatter
deggorad=pi/180;
azi=[0;36;72;108;144;180;216;252;-288;324;360];
th = deggorad*azi;
radi=[0;0.1;0.3;0.5;0.8;0.85;1;0.9;0.65;0.84;0.86];
val=[15;20;14;17;19;15;13;14;17;19;22];
% just pass in val to polarscatter, then use colormap and CLim to control the colors and limits
% note that passing in a value to jet makes the more 'discrete' looking map
figure(2)
s=polarscatter(th, radi, 100, val, 'filled');
% You can use the caxis in place of the set below in old versions
% and clim in more recent releases
set(gca,"CLim",[1 22])
colormap(jet(max(val)))
colorbar
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Colormaps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!