help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Showing angle values on a polar plot


From: Andreas Weber
Subject: Re: Showing angle values on a polar plot
Date: Tue, 22 Apr 2014 20:13:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10

Am 20.04.2014 18:18, schrieb patchwerkadams:
> I can't seem to get the angle value to show up on a polar plot, does anyone
> know how to do this?

I think you have to do it yourself. Try something like

theta = 0:0.01:2*pi;
rho = sin(2*theta).*cos(2*theta);

polar(theta,rho,'--r')
set(gca, "visible", "off")

circle_angular_steps = 50;
num_circles = 5;
# guess the radial spacing
max_r = 0.5;

t = linspace(0,2*pi,circle_angular_steps);
s = sin(t);
c = cos(t);

## create radial vector
cs = linspace(0, max_r, num_circles+1);
cs(1) = [];

## plot circles
y = kron(s', cs);
x = kron(c', cs);
line(x(:,1:end-1), y(:,1:end-1), "linestyle", ":")
# last circle solid linestyle
line(x(:,end), y(:,end), "linestyle", "-")

## add radial labels
[x, y] = pol2cart (0.4 * pi, cs);
text(x, y, num2cell(cs), "verticalalignment", "bottom")

## add text 0..30.330°
t = 0:30:330;
l = num2cell(t);
s = max_r * sin(t*pi/180);
c = max_r * cos(t*pi/180);
tm = 1.1;
text(tm * c, tm * s, l, "horizontalalignment", "center")

## plot radial lines
xt = vertcat(zeros(1,numel(t)), c);
yt = vertcat(zeros(1,numel(t)), s);
line(xt, yt, "linestyle", ":")

-- Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]