Polar Scatter Plot using 3 Data Set

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Polar Plots 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by