File Exchange

image thumbnail

pcolor in polar coordinates

version (673 KB) by E. Cheynet
polarPcolor draws a pseudocolor plot in polar coordinates with a polar grid.


Updated 03 Mar 2019

View License

polarPcolor is a function that aims to represent a pseudocolour plot in polar coordinates, with a radial grid to allow an easy lecture of the data. It is well suited for Plan Position Indicator (PPI) scan for radar or lidar for example [1]. A similar function is available in ref. [2], which propose a visualization in 3D.


[1] Cheynet, E., Jakobsen, J. B., Snæbjörnsson, J., Reuder, J., Kumer, V., & Svardal, B. (2017). Assessing the potential of a commercial pulsed lidar for wind characterisation at a bridge site. Journal of Wind Engineering and Industrial Aerodynamics, 161, 17-26.


Cite As

E. Cheynet (2019). pcolor in polar coordinates (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (38)

Dan Midgett

I noticed one small (possibly intentional?) issue with this function. The function assumes the theta values you give are the start point for each drawn sector, not the center. I would have defined the given theta values as the center of each sector, but it was easy enough to fix by giving an offset to my data before passing it to the program. However, if you do this the spokes are also off (requiring a similar offset to be passed to the program to fix). It might be nice to have an option to set whether to plot centered on the theta data or the current default. Anyway, great work!

E. Cheynet

Hei James, sorry for the late answer. I have updated the function and included an option to change the radial tick label as you asked. You can see an example where I change the radial label in the live script file.


@E. Cheynet, thanks. Is there a simple way to add labels, i.e. one for each "circle"?

E. Cheynet

@James, yes it is possible to change the colormap. If you want to use the colormap 'autumn' for example, just write colormap('autumn'). If you want to reverse it, use: colormap(flipud(colormap('autumn')))


Great function. Is it possible to change the color mapping? I am being asked to use a map similar to a temperature weather map where the high temperatures are red.

Gil Greco

Hi Etienne,
Now the tool is working flawlessly!!! Many thanks for all help ! The new improved tool is now very complete, easy to use and professional.
All the best,

Gil Greco

I uploaded a simple code and the data in the following link:

E. Cheynet

Hi Gil,
Is it possible that you send me in PM (using the link in my FileExchange profile) a simple example where polarPcolor fails ? Thank!

Gil Greco

Hi Etienne,
I still got the same problem. I think there is still an issue on the rNorm definition.

E. Cheynet

Hi Gil,
I have seen I had written unproperly the normalization of the R axis when the radial axis is written in a logarithmic format. Now it should work better. Thank again for the feedback!

Gil Greco

Hello Etienne,
Many thanks for such a quick reply. What if the RData do not start from values close to 0? what's happening here is that my Rdata starts from 0.13, so the grid it's being drawn shifted upwards and the pcolor is being drawn from the origin.

E. Cheynet

Hi Gil,
I have updated the function with an option to transform the radial direction from a linear scale to a logarithmic one (See Example.mlx). So far it seems it is working. Do not hesitate to contact me if you find any bug.

Gil Greco

Do you have any thoughts on how to draw the circles in a semilog fashion ? I really appreciate any help on this issue.
Thanks !

Gil Greco

Many thanks for the reply, Cheynet ! Your tool is really nice and has been very useful for me :)

I have solved the first problem using log10(R), as you said.Then I convert the values back to linear scale in Lines 182 and 196 so it shows the original input labelR values (and not in log values) when plotted. I guess this solves the second problem as I don't need to change the ticks anymore.

Now, the semilog-plot like grid issue has been a nightmare that I could not solve so far. It would be very nice to add a functionality to plot the data like a semilog-plot, specially if we could change the ticks and values to be showed on the grid.

Many thanks

E. Cheynet

Hi Gil,

Thank for the feedback!

Regarding your first question, you can have the radial axis in semilog if you use log(R) instead of R. However, the grid is not displayed as for a semilog-plot, so that is something to improve in this function. Regarding your second question, I had not implemented the possibility to change the Ticks for the different circles. It can be done by adding a new option in the inputParser object that is at the beginning of the function. I will try to update the function in a near future.

Gil Greco

Very usefull tool !!! Is it possible to change the Ticks showed by 'circles' using command lines ? many thanks

Gil Greco

Is it possible to have the RAxis in log scale ? like in a semilogx plot ?

Works like a charm, thank you very much.
It's strange that this is not a standard function inside matlab.

E. Cheynet

Hi Pritesh,

To create your NxN matrix for the variable Z, you can use the Matlab function "griddata":

Alternatively, you can try to use a scatter plot instead of a pseudo-color plot, as shown below:

hey, really nice piece of work. I have a question particular to my query for your code. I have a 1xN matrice for R and theta. and corresponding 1xN for the Z values. And the cell values in R and theta are not repeating, so I cant really make the Z as NxN matrice with the R and theta having the common values. It was difficult figuring how I could modify your code to suit my requirement. Could you help me out?
This link has an excel sheet with my data points. It would help you understand my question if you just have a look at it. Thanks!

Yuki Kita

Very useful! Thanks very much for the great work.

Peng Wang

I tested on R2013b that works great and your example save my time and your code is understandable

Thank you E. Ch3yn3t !!!
It was just what I was looking for.
It is also well explained from your examples.
It works properly on R2013b.

Chi Qiao



Thank you again for your patience!

E. Cheynet

If only a small area is of interest, just "crop" your data around this area. That should also speed up the computation since you would have a matrix with a smaller size.


The matter is:
I use you function to plot a figure, for my data is too large(1126*1000), and the quantities of the nonzero data is small, which lead the figure could not display the spot unless you zoom in it.

E. Cheynet

Since the data are presented in polar coordinates, "axis(xmin,xmax,ymin,ymax)" is unlikely to be directly useful. Here, the limit of the axis are automatically calculated from R and theta. If you want to modify the axis, just change the extrema of R and theta (cf. last 2 paragraph of the html example).



Thank you for your reply!
I mean I want to know whether their is a function like axis(xmin,xmax,ymin,ymax) to control the display of the figure.


It's very kind of you that solve my problem!

E. Cheynet

hi McChaucey,
Thanks for the suggestion, that is a good idea !
Are you referring to the colorbar axis ? If yes, I use the function "caxis". I have implemented today a new version where the axis is automatically scaled. In the example file, I also illustrate the role of caxis.


It's pretty good,there are 2 questions.
1st,How to adjust the axis.
2nd,Could u share the version that can adjust the axis adaptively, like image to imagesc.


Added project website


Updated the screenshot

Update the example file and added an option to change the radial tick label ('Rticklabel')

The bug related to the option "Rscale" has been correct (hopefully). A new option "Origin" has been added to let the user choose between a polar plot centred around 0 or min(R). The circles and spokes are now drawn as solid lines instead of dots.

Correction of a bug for the "Rscale" option

The html example is removed as the LiveScript file fulfils the same role


Added HTML example

Added LiveScript example

Added the possibility to include a log scale on the radial axis (see Example.m) + correction of a minor bug when theta and R have the same size.


Description updated with an illustration of the method applied to wind data

correction of a bug when Nspokes is lower than Ncircles/2

- automatic scaling of colorbar + new example + multiple options are added

- typo



- updated for 2014b
- code updated
- examples updated



added html example

- picture updated
- specification updated
-label 'distance' updated

- example updated
- axes improved

example corrected


tags modification

More accurate description added

MATLAB Release Compatibility
Created with R2018a
Compatible with R2014b to R2018a
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor