polar plot multiple legend
16 views (last 30 days)
Show older comments
How do I name each line in polar plot differently
This doesnt work
angle = 0:0.1745:2*pi;
Spl49 = [81.97499084 81.65412903 81.59463501 81.40548706 81.53025818 81.44108582 81.33396149 81.41963959 81.23446655 81.60978699 81.15054321 81.46079254 81.90848541 81.74275208 82.02006531 82.06681824 82.30259705 82.13386536 82.34589386 82.50636292 82.38869476 82.81261444 82.83797455 82.99743652 82.84294891 82.85511017 82.91734314 82.53729248 82.9249649 82.59764862 82.8104248 82.43968201 82.31278229 82.16514587 82.13431549 82.08069611 81.97499084];
% %
% %
polarplot(angle,Spl49)
legend("49Hz");
Spl62 = [91.52827454 91.47628784 91.43096924 91.42974091 91.3208847 91.30194092 91.30247498 91.15945435 91.1446228 91.38106537 91.40661621 91.44705963 91.58049011 91.79633331 91.98416901 91.71070099 92.13634491 92.19589233 92.22749329 92.21495819 91.81008148 92.4243927 92.36664581 92.25910187 92.19790649 92.33818817 91.96325684 92.35584259 92.3081665 92.11762238 92.07684326 91.89001465 92.00238037 91.83770752 91.83586121 91.72506714 91.52827454];
hold on
polarplot(angle,Spl62)
legend("62.5Hz");
% theta = 0:0.01:2*pi;
% rho = sin(2*theta).*cos(2*theta);
% polarplot(theta,rho)
I just get this
0 Comments
Answers (1)
Adam Danz
on 16 Jan 2023
Edited: Adam Danz
on 19 Jan 2023
Call legend once after both lines are added and include a name for each line.
legend(["49Hz","62.5Hz"]);
Alternatively, assign a DisplayName to each object when the object is created and then call legend without the object names,
polarplot(__,'DisplayName', '49Hz')
hold on
polarplot(__,'DisplayName', '62.5Hz')
legend()
0 Comments
See Also
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!