How do you turn off a polar grid while retaining a title?

1 view (last 30 days)
Here is a slice of my longer code:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
theta = pi/2 : 2*pi/3 : 2*pi + pi/2;
r = ones(1,length(theta));
myline = polar(theta, r); title('Triangle')
%%
set(gcf,'Color','w');
set(0,'Showhiddenhandles','on')
extrastuff = setdiff(get(gca,'children'),myline);
delete(extrastuff)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I grabbed the second portion of code online to get rid of the polar axis, but it destroyed my title as well. Please help, thanks. :)

Accepted Answer

the cyclist
the cyclist on 28 Oct 2012
If all you want is the triangle and the title, then this will work:
theta = pi/2 : 2*pi/3 : 2*pi + pi/2;
r = ones(1,length(theta));
myline = polar(theta, r); ht = title('Triangle');
set(gcf,'Color','w');
set(0,'Showhiddenhandles','on')
extrastuff = setdiff(get(gca,'children'),[myline ht]);
delete(extrastuff)
Notice that what I did was to get the handle of the title, and add that handle to the list of ones not to delete (in the second argument of your setdiff command).

More Answers (0)

Categories

Find more on Cell Arrays 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!