[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Showing angle values on a polar plot
From: |
Pantxo |
Subject: |
Re: Showing angle values on a polar plot |
Date: |
Tue, 22 Apr 2014 12:07:35 -0700 (PDT) |
Andreas Weber-3 wrote
> 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
>
> _______________________________________________
> Help-octave mailing list
> Help-octave@
> https://lists.gnu.org/mailman/listinfo/help-octave
Andy's snippet could make a very good start for solving bug #39495 [1].
Pantxo
[1] https://savannah.gnu.org/bugs/index.php?39495
--
View this message in context:
http://octave.1599824.n4.nabble.com/Showing-angle-values-on-a-polar-plot-tp4663669p4663695.html
Sent from the Octave - General mailing list archive at Nabble.com.