polarplot uses polaraxes whereas expolar creates a pseudo-polar-plot on regular Cartesian axes. The ThetaAxisUnits property is not available with Cartesian axes. Instead, the theta ticks are added as text objects. I recommend using polaraxes unless you have a very good reason not to.
To convert the theta ticks in the expolar plot to radians, you'll have to identify which text objects are the theta ticks and then convert them to radians.
This demo uses fractions to label the theta ticks.
ezpolar(@(t) 1+3/2*sin(2*t), [0, 2*pi])
ax=gca;
h = findall(ax, 'type', 'text');
existingTicks = 0:30:360;
existingTickStr = strsplit(num2str(existingTicks));
for i = 1:numel(h)
if ismember(h(i).String, existingTickStr)
[num,denom] = rat(str2double(h(i).String)/180);
if num==0 || denom==1
h(i).String = sprintf('%d\\pi', num/denom);
else
h(i).String = sprintf('^{%d}/_{%d} \\pi', num, denom);
end
end
end
For more simpler decimal labels, replace the inside of the loop with,
if ismember(h(i).String, existingTickStr)
h(i).String = sprintf('%.2f',str2double(h(i).String)*pi/180);
end
Best Answer