Code covered by the BSD License  

Highlights from
Advanced Polar Plots v2

5.0 | 3 ratings Rate this file 43 Downloads (last 30 days) File Size: 14.9 KB File ID: #22859

Advanced Polar Plots v2


Daniel Armyr (view profile)


02 Feb 2009 (Updated )

An improved version of the MATLAB function 'polar'.

| Watch this File

File Information

 An improved version of the MATLAB function 'polar'. Supports negative numbers and other plotting features. David Ireland's original completed with Dr. Thomas Patzelt's bugfix.


Advanced Polar Plots inspired this file.

This file inspired Polar 2.

MATLAB release MATLAB 7.7 (R2008b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (24)
07 Nov 2014 Daniel Armyr

Daniel Armyr (view profile)

Sorry, but doing anything with polar plots is very complicated since they are not first-class plots, hut basically drawn up using lines and circles. As such, any modification has to be done inside the logic of the code.

But, by changing your angular data to get the plot to draw itself using the right direction for 0° and CW you can get the data in the right Place. Then you just go in to the code and remove the drawing of the lines you do not want, then you should get the results you need. The only challenge would be to get the tick labels right, but you could hack that as well.

Comment only
06 Nov 2014 Bill

Bill (view profile)


I am attempting to plot multiple series of theta (phase) and magnitude data on the same polar plot.
I have used the 'polar', 'pp', 'polar2', and 'polar2' advanced m files. Each has a different limitation. I would like to plot each series on the same polar plot, then reorient the polar plot so that 0° at top and degrees rotate CW, using the command with 'view(90°,-90°)', . Then use the 'polarticks.m' function to clean up the plot by removing radial and angular gridline except for the main 4 quadrants. so have gridlines only at every 90°. Maybe not all in this order.

Not too terribly complicated.
I thought that I just about have what I want, but have not been able to duplicate it.----- So now I cannot for the life of me contort or rearrange the coding or revise the gca or children to make this a usable tool that we can use again and again for lots of data.

Any help that you could provide would be much appreciated.
Thank you,

Comment only
30 Jun 2014 Fernando Bergami  
24 May 2013 Daniel Armyr

Daniel Armyr (view profile)

Hello everyone.
Don't use this file. Go here instead and get the much better version:

Comment only
03 May 2012 Daniel Armyr

Daniel Armyr (view profile)

LORENA: This file uses a very bad method of drawing and can therefore not be used to draw inside existing plots or subplots. However, that is completely possible with my other submission, polar2. Now, if there is a feature in this file that you need and cannot find in polar2, just let me know with a comment to that file, and I will check if I can implement it.

Comment only
02 May 2012 LORENA

LORENA (view profile)

I have loaded pp.m. I would like to show my graphics in axes_handles,is this possible? (I have a GUI), because I have been looking the code and I don't know how change this option. Thank you, Lorena.

Comment only
23 May 2011 Daniel Armyr

Daniel Armyr (view profile)

As mentioned, use instead.

Comment only
21 Jul 2009 Mohamad

I'm plotting normalized power radiation pattern in dB scale 0 to [-inf]. Your code does not seem to work at all when 0 is defined as the maximum value. When I try with other data with 0 as the least value, your code works awesome.

Comment only
02 May 2009 Daniel Armyr

Daniel Armyr (view profile)

To be clear, I have given upp support of this function in favour of "polar 2" which can be found here.

Polar 2 has less features, but has relatively cleaner code and is less prone to bugs.

If someone else wants to maintain this file, feel free. Just do the bugfixes and upload it under your own name,

Comment only
01 May 2009 Brian

Brian (view profile)

There is a typographical error in line 180.

should be


Comment only
20 Apr 2009 Jonas

Jonas (view profile)

There is an error at least on OS X - the variables TraceMax and TraceMin are initialized as empty stings, which leads to strange behavior when catenating with doubles.
This leads to the error 'Centre value is same as maximum input value' being thrown erroneously.

I suggest changing lines 1326 and 1313 to
TraceMax = [];
TraceMin = [];

Comment only
09 Apr 2009 Noelia Oses

Hi all,

I am using pp to plot polar plots and it's great!
However, even though I'm using style 'or' it still plots the lines linking the markers.
Does anyone know what to do so that it doesn't plot the lines?

Thank you very much!!

Comment only
08 Apr 2009 Daniel Armyr

Daniel Armyr (view profile)

Sorry, the new file is called 'polar 2' and nothing else.

Comment only
07 Apr 2009 Daniel Armyr

Daniel Armyr (view profile)

That is correct. This function has very many limitations. My suggestion is to rewrite the function with a bit less functionality and fewer ugly hacks, or pester your local Mathworks representative to improve the functionality of the built-in polar function.

Comment only
07 Apr 2009 sls

sls (view profile)

It doesn't seem to work with the function subplot. Any tips? I want to plot multiple polar plots in one figure.

Comment only
03 Apr 2009 Jeffrey Hall

Is there anyway that someone could please send me a MATLAB code snippet showing pp.m in all of its glory?

I am evaluating multiple software packages for creating polar plots and am on a tight schedule.


Comment only
03 Apr 2009 Daniel Armyr

Daniel Armyr (view profile)

Specifically, pp can plot negativ radii. If you type help pp and read through the first few paragraphs, it will tell you.

Comment only
02 Apr 2009 Jeffrey Hall

Could someone please post an example showing some or all of the advanced features that Advanced Polar Plots v2 offers over the regular MATLAB polar() command?


Comment only
31 Mar 2009 Noelia Oses

Please ignore my last entry. I didn't realise I was still using the old version. Now it works perfectly. This is fantastic!!!!

31 Mar 2009 Noelia Oses

Hi Daniel,

Thanks a lot for this!!
I came across your function looking for how to make a polar plot look like a compass from 0 to 360 deg clock wise
and that the center to 0 axis is vertical pointing up.

Now I get what I wanted but unfortunately I get some error messages and pp.m doesn't plot my data.

Any help you might provide is very much appreciated.

The error messages are the following:

??? For colon operator with char operands, first and last operands must be char.

Error in ==> pp>PlotTrace at 1262
x = norm_r(PlotStartFlag(i):PlotBreakFlag(i)).*cos(theta(PlotStartFlag(i):PlotBreakFlag(i)));

Error in ==> pp at 287
PlotTrace(ThetaPlot, RPlot, PlotProperties, Traces{i+1});

Error in ==> PlotGaitData at 23


Comment only
24 Mar 2009 Daniel Armyr

Daniel Armyr (view profile)

OK, new version uploaded for review with Vincents fix and a fix for the missing return argument bug.

Comment only
23 Mar 2009 Vincent Blandeau

I am using Matlab R2008b and the routine was bugging because the variables PlotStartFlag and PlotBreakFlag were defined as "char" on lines 1027-1028, instead of arrays.

The bug was fixed by modifying lines 1027-1028 as :

PlotStartFlag = [ ];
PlotBreakFlag = [ ];

Thank you by the way for this very nice function :-)

11 Feb 2009 Daniel Armyr

Daniel Armyr (view profile)

Unfortunately not. The function will plot into the entire current figure, overwriting all its settings with a "clf reset" before starting.

Comment only
10 Feb 2009 tstmwind

Are you able to specify the axis handle for this function as you can for polar.m? EX: polar(axish,theta,rho)

Comment only
24 Mar 2009

Removed the return argument as it isn't defined anywhere in the function.

Contact us