How do I remove the border of a polarplot?
Show older comments
Hi, I have an exercise in which i need to evaluate some graphic handles of MATLAB (I use R2014b)
I have created the following plot.

How do I remove the thin circular boundary from this plot?
That is the thin grey boundary, So it is not about the rectangular box.
I've used the following code to create my graph
clc; close all
figure(1);
theta = linspace(0,2*pi,201);
r = sqrt(abs(2*sin(5*theta)));
h = polar(theta,r);
patch( get(h,'XData'), get(h,'YData'), 'k')
delete(findall(gcf,'type','line','-or','type','text'));
box on
ax = gca;
ax.Title.String = 'Flower Power';
ax.Title.FontWeight = 'normal';
ax.Visible = 'on';
ax.XGrid = 'off';
ax.XTick = [];
ax.YTick = [];
ax.XTickLabel = [];
ax.YTickLabel = [];
ax.LineWidth = 2;
1 Comment
I too have this problem, and I need to use polarplot.
It seems to be pot luck which properties, when changed, also change the circular border.
ax = gca; % PolarAxis from preexisting polarplot()
ax.ThetaAxis.LineWidth = 20
% Just changes the border, but can't be set to 0
ax.ThetaAxis.Visible = 'off'
% Removes both the border AND the angle labels.
% other ThetaAxis props eg. Color also change labels
ax.LineWidth = 20
% Changes both the border AND all gridlines,
% but not data lines, and again cannot be 0
At least with the old polar() I could findall lines and delete manually*. But now findall lines on a PolarAxis just returns handles to the data lines! What a mess.
*and note that given the old polar drew to Cartesian axes, Star Strider's answer essentially resorts to reproducing this by hand!
Accepted Answer
More Answers (2)
Morteza Amini
on 13 Oct 2020
0 votes
Simply use the following:
set(gca,'visible','off');
1 Comment
That does not get rid of the gray circle. That only removes the black rectangular frame in the depreciated polar() function.
In the newer polarplot|polaraxes you just need,
axis off
Demo (patch is still not supported in polaraxes):
figure('color','w');
theta = linspace(0,2*pi,201);
r = sqrt(abs(2*sin(5*theta)));
h = polarplot(theta,r);
axis off
Christian Hofmann
on 18 Feb 2021
In case someone else tries to get rid of the gray circle, setting the PolarAxes property "GridAlpha" to 0 might help:
gca.GridAlpha = 0.0
1 Comment
This does remove the grid and surrounding polar axis line but maintains the ticks which may be desirable for some usecases. However, gca.<property> is not supported unless gca is no longer a function but a variable name which is not recommended.
figure('color','w');
theta = linspace(0,2*pi,201);
r = sqrt(abs(2*sin(5*theta)));
h = polarplot(theta,r);
set(gca, 'GridAlpha', 0.0)
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!

