Polar Scatter Plot using 3 Data Set

5 ビュー (過去 30 日間)
Alexi
Alexi 2023 年 10 月 4 日
編集済み: Star Strider 2023 年 10 月 4 日
Hello, I am trying to draw a polar chart using 3 data sets. The first data set is the set value, the second data set indicates at which azimuth this value set will be found. Finally, color changes need to be made in the value ranges in the primary value setting. How do I do this?
  3 件のコメント
Alexi
Alexi 2023 年 10 月 4 日
But how to add third value ? is this correct ? I added the 3rd value set as an example. How do I adjust the color scale according to the size of the values of the elements of the 3rd value set?
clc;
clear;
th = linspace(0,2*pi,20);
r = rand(1,20);
a=[1:1:20];
sz = 75;
polarscatter(th,r,sz,a,'filled')
Dyuman Joshi
Dyuman Joshi 2023 年 10 月 4 日
編集済み: Dyuman Joshi 2023 年 10 月 4 日
From what I understood - The 4th input to polarscatter() corresponds to the colors of the markers. So you should provide the values (variable a in your case) accordingly.
Check out the Marker Colors sub-section in the Input Arguments section of the documentaion for more info.

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

採用された回答

Star Strider
Star Strider 2023 年 10 月 4 日
編集済み: Star Strider 2023 年 10 月 4 日
Try this —
th = linspace(0,2*pi,20);
r = rand(1,20);
a=[1:1:20];
sz = 75;
% polarscatter(th,r,sz,a,'filled')
[x,y,z] = pol2cart(th, r, a);
tv = linspace(0, 360, 13);
tv2 = linspace(0, 359, 360);
rc = 1;
figure
scatter3(x,y,z,50,z,'filled')
hold on
plot3((rc*[1;1]*cosd(tv)), (rc*[1;1]*sind(tv)), ([0;20]+rc*ones(size(tv))), ':k')
plot3((rc*[0;1]*cosd(tv)), (rc*[0;1]*sind(tv)), (rc*[1;1]*ones(size(tv))), ':k')
plot3((rc*[0;1]*cosd(tv)), (rc*[0;1]*sind(tv)), (20+rc*[1;1]*ones(size(tv))), ':k')
plot3((rc*cosd(tv2)), (rc*sind(tv2)), (20+rc*[1;1]*ones(size(tv2))), ':k')
plot3((rc*cosd(tv2)), (rc*sind(tv2)), (0+rc*[1;1]*ones(size(tv2))), ':k')
hold off
text((1.15*rc*cosd(tv(1:end-1))), (1.15*rc*sind(tv(1:end-1))), (0+rc*ones(size(tv(1:end-1)))), compose('%3d°',tv(1:end-1)), 'Horiz','center', 'Vert','middle')
set(gca,'Visible',0)
EDIT — (4 Oct 2023 at 15:23)
Tweaked plot grid & tick labels.
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by