function polarstr(theta,rho,line_style)
%
% polarstr(theta,rho,line_style)
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% This is a modified version of MATLAB's
% standard plotting routine. This version
% has been tailored for this specific problem
% and is not for general polar plotting.
%
% theta - the angle vector (radians)
% rho - the radius vector
% line_style - one of MATLAB's linestyles
%
% User m functions called: none
%----------------------------------------------
% get hold state
hold_state = ishold;
%...Only do grids if hold is off
if ~hold_state
%...Make a radial grid
hold on;
hhh=plot([0 max(theta(:))], ...
[0 max(abs(rho(:)))],'y:');
v=[get(gca,'xlim') get(gca,'ylim')];
ticks=length(get(gca,'ytick'));
delete(hhh);
%...Check radial limits and ticks
rmin=0; rmax=v(4); rticks=ticks-1;
if rticks > 5
%...Can we reduce the number
if rem(rticks,2) == 0
rticks=rticks/2;
elseif rem(rticks,3) == 0
rticks=rticks/3;
end
end
%...Define a circle
th=0:pi/50:2*pi;
xunit=cos(th); yunit=sin(th);
%...Force points to lie on x/y axes
inds=[1:(length(th)-1)/4:length(th)];
xunits(inds(2:2:4))=zeros(2,1);
yunits(inds(1:2:5))=zeros(3,1);
rinc=(rmax-rmin)/rticks;
for i=(rmin+rinc):rinc:rmax
plot(xunit*i,yunit*i,'y:','linewidth',0.5);
if (i ~= rmin+rinc) & (i ~= rmax)
text(0,i+rinc/20,[' ' num2str(i)], ...
'verticalalignment','bottom' );
end
end
%...Plot spokes
th=(1:6)*2*pi/12;
cst=cos(th); snt=sin(th);
cs=[-cst; cst]; sn=[-snt; snt];
plot(rmax*cs,rmax*sn,'y:','linewidth',0.5);
%...Annotate spokes in degrees
rt=1.1*rmax;
for i = 1:max(size(th))
text(rt*cst(i),rt*snt(i), ...
int2str(i*30), ...
'horizontalalignment','center' );
if i == max(size(th))
loc=int2str(0);
else
loc=int2str(180+i*30);
end
text(-rt*cst(i),-rt*snt(i),loc, ...
'horizontalalignment','center' );
end
%...Set axis limits
axis(rmax*[-1 1 -1.1 1.1]);
end
%...Transform data to Cartesian coordinates.
xx=rho.*cos(theta); yy=rho.*sin(theta);
plot(xx,yy,line_style);