compass plot

7 views (last 30 days)
muhammad tariq
muhammad tariq on 21 Aug 2011
Answered: Abby Skofield on 7 Oct 2024
Hi,
How do I make Compass Plot to display the zero degrees (North) up, instead of 90 (zero to the right)?
% script file plotharmonic
% introduzir M2 S2 K1 O1 K2
amp = [1.0448,0.365,0.0712,0.0622,0.1027];
pha = [77.16,105.75,61.67,320.84,101.95];
rdir = pha * pi/180;
[x,y] = pol2cart(rdir,amp);
compass(x,y)

Accepted Answer

Abby Skofield
Abby Skofield on 7 Oct 2024
Starting in R2024b, the compassplot function can be used in place of compass to create arrows eminating from the origin of a polar axes. The PolarAxes class has many properties and several functions you can use to customize its appearance, like the location of theta==0. Note that compassplot can be combined in a PolarAxes with other plots like polarhistogram, polarplot, polarscatter, etc.
t = linspace(0,3*pi/2,10);
pax = polaraxes;
cp = compassplot(t,10:-1:1); % new in R2024b
pax.ThetaZeroLocation = "top";

More Answers (1)

Paulo Silva
Paulo Silva on 21 Aug 2011
amp = [1.0448,0.365,0.0712,0.0622,0.1027];
pha = [77.16,105.75,61.67,320.84,101.95];
rdir = pha * pi/180;
[x,y] = pol2cart(rdir,amp);
compass(x,y)
view([-90 90])
  1 Comment
muhammad tariq
muhammad tariq on 21 Aug 2011
thanks paulo for ur kind help

Sign in to comment.

Categories

Find more on Polar Plots 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!