View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

4.7 | 70 ratings Rate this file 106 Downloads (last 30 days) File Size: 5.21 KB File ID: #17748 Version: 1.4
image thumbnail



M MA (view profile)


26 Nov 2007 (Updated )

Wind rose of direction and intensity

| Watch this File

File Information

       D Directions
       I Intensities
        -dtype, type of input directions D, standard or meteo,
             if meteo, the conversion dnew=mod(-90-D,360) is done;
             if not meteo, standard is used (default)
        -n, number of D subdivisons
        -di, intensities subdivisons, default is automatic
        -ci, percentage circles to draw, default is automatic
        -labtitle, main title
        -lablegend, legend title
        -cmap, colormap [jet]
        -colors, to use instead of colormap, for each di
        -quad, Quadrant to show percentages [1]
        -ri, empty internal radius, relative to size of higher
             percentage [1/30]
        -legtype, legend type: 1, continuous, 2, separated boxes [2]
        -bcolor, full rectangle border color ['none']
        -lcolor, line colors for axes and circles ['k']
        -percbg, percentage labels bg ['w']
        -ax, to place wind rose on pervious axes, the input for ax
             must be [theax x y width], where theax is the previous
             axes, x and y are the location and width is the wind
             rose width relative to theax width (default=1/5)
        -parent, by default a new axes is created unless parent is
                 given, ex, parent may be a subplot
        -iflip, flip the intensities as they go outward radially, ie,
                 highest values are placed nearest the origin [{0} 1]
        -inorm, normalize intensities, means all angles will have 100%
        -incout, if 0, data outside di limits will not be used [0 {1}]
       HANDLES Handles of all lines, fills, texts
       DATA Wind rose occurences per direction and intensity


This file inspired Wind Rose and Wind Rose / Energy Rose.

MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (138)
20 Oct 2016 Ankit Pramanik

I got the answer. Thanks to Eddy Barratt. :)

Comment only
20 Oct 2016 Ankit Pramanik

How can I align direction in wind rose so that North becomes 0 degree?

Comment only
06 Oct 2016 Guillermo Olvera Guerrero

Very good work, very useful!

27 Jun 2016 Parth Sarathi

Can we plot a scatter of x=wind direction and y=pollutants in the same plot. Except there should be dots on the circular wind direction and not straight bars as happens in this commands?

Comment only
23 Mar 2016 Cesar Manuel Diez Chirinos

you could try to create the pushbutton inside the wind_rose

Comment only
07 Mar 2016 Rafael Freitas Ferreira

Hi There,
how to plot datas in a specific graph?
I designed a simple gui, with one pushbutton and on axes.
However, the windrose is been made in a new layer.
How can I do to plot windrose in my gui?

04 Sep 2015 haitham

Nice work!

11 May 2015 Jian

Jian (view profile)

27 Nov 2014 Eddy Barratt

Very nice wind rose plotter, but with some bizarre behavior regarding the direction.

dtype - 'standard' uses standard mathematical plotting, i.e. 0 degrees lies on the positive x-axis, 90 degrees on the positive y axis.
dtype - 'meteo', which I assume stands for meteorological, uses geographical directions, but 180 degrees out of phase! i.e. 0 is south (when it ought to be north), 90 is west (when it ought to be east). I'm not sure why you'd want that, unless you expect to receive winds based on where they're going and wish to plot them as where they've come from, or vice-versa.

I've edited my copy to read this, at the appropriate place.
% directions conversion:
if isequal(dtype,'meteo-to-wind')
elseif isequal(dtype, 'meteo')

19 Nov 2014 foulen

foulen (view profile)

please! how to use this function? how to applicate & parameter this function to image file!!!? please help

Comment only
04 Nov 2014 Kuifeng

Amazing Job.

16 Oct 2014 Georgina Peach

Bearing labels 0-360 Deg - is there any way to put them on the plot like on a polar plot & include an axis title i.e. Coming direction (deg)?

11 Sep 2014 Claire

Claire (view profile)

I have percentage labels on the intensity circles but how do I make the white box around the text disappear as its obscuring some information?

Comment only
25 Aug 2014 Stefan

Stefan (view profile)

Essential function for wind resource analysis - much appreciated

@Matlab: Please include it in the official release ;)

19 Aug 2014 Shital

Shital (view profile)

I am trying to plot windrose using wind_rose.m (my input is wind speed and directions). However, the winds show that they come from North, when they actually should be coming from East. Is there anything that I need to change in the wind_rose.m script ?

Comment only
16 Jul 2014 Daniel Pereira

Daniel Pereira (view profile)

Thanks for this submission. It was a solution for some time, but I've finally created my own to add some customization and to make simpler the management of automatic scales and all the elements in general.

Everyone can download and freely modify it for personal use:


excellent script could anyone tell me how to how to change the direction labels to actual figures ( 360/30)

17 Feb 2014 Kimberly

Is it possible to change the colormap to grayscale? Thanks! This is very easy to use!

Comment only
11 Feb 2014 Steve

Steve (view profile)

I'm trying to make multiple wind roses all at the same scale for the 12 months of the year. I'm having trouble setting them all to the same scale. I believe I need to alter the code around 226 with the variable ncircles but can't quite figure it out any help would be appreciated as having graphs at the same scale for data comparison is key!

Those of you asking about the direction issues, the answer is in the comments below you just need to look :) I figured it out that way but can't remember the exact solution.

Comment only
02 Jan 2014 Emma

Emma (view profile)

I am also finding that 0 degrees is plotted in the East direction. Has someone used it and managed to put 0 degrees plotted in the North direction?

Thank you.

Comment only
12 Dec 2013 Karoline


thanks for sharing the file, but i believe it is erroneous.

When i plot the example given in the file (which creates trial vectors with gradually rising intesities&quantities in V and "increasing" winddirections in D) it does not start off with low intesities and quantities at North but at East and it secondly does not increase clockwise but counterclockwise. Its the same issue Bart seems to have noticed. 0 degrees coincides with East, 90 with North, 180 with West and 270 with South.

I'd love to use this tool but it seems to be incorrect.


Comment only
13 Aug 2013 Saskia

Saskia (view profile)

Great file! Thanks!
However, how would it be possible to have a "title legend » on the top of the legend (eg. m/s)?

25 Jul 2013 Bart

Bart (view profile)

I have made a test case where I had a direction vector with 0's and a random velocity vector. The wind rose for some reason showed a spike in the eastern direction. Why does 0 degree direction coincide with East?

Comment only
21 Jul 2013 hadi siswanto

I want to change the wind speed interval.
example of 0-5; 5-10, and so on, into the interval 0-3; 3-9; 9-20; accordance with my wishes. how to do it? hope your comment

Comment only
22 Jun 2013 Ben

Ben (view profile)

Great Programme, thanks.

I've been using it with MIDAS met office data, but had to make a correction to get the 'dtype' meteo argument to work.
% directions conversion:
if isequal(dtype,'meteo')

Had to be changed to;

% directions conversion:
if isequal(dtype,'meteo')

Comment only
21 May 2013 Theodoros


I am trying to run the windrose function but I get an error :'Undefined function or variable 'lon'. Moreover, it is written : inputs I,D, BUT I only see I,V in the example. what V is? And where could I find I to change it?

thank you

Comment only
20 May 2013 Theodoros

How can I get this code work?
What changes do I have to come and
which are the parameters that I should care, due to the nature of my problem?

Comment only
05 May 2013 Ali Mirzaei

very useful function but can somebody explain how to have 4 subplot with single colorbar (not 4 colorbar)

Comment only
24 Apr 2013 erik hellström

Ok i figured it out
For GUI use this:

myAx = gca;

This will use the GUIDE window you have set. It will look a bit funny though in that window but it works.

Comment only
24 Apr 2013 erik hellström

I have trouble added in the my gui. In my OpeningFnc I do:


Is this wrong? It justs draws the rose very large in the middle of the program window. I want it to be plotted in the axes called axes2. Or do i need to scale it? (can i scale the size?)

22 Mar 2013 ZZL Zhang

Very easy to use! Fantastic script!

28 Feb 2013 Cesar Manuel Diez Chirinos

Can't somebody explain how to make the rose, I have the percentages, but how can I plot them in the wind, the method here I can't understand very clear. Thanks

23 Feb 2013 Rina

Rina (view profile)

15 Feb 2013 Davide

Davide (view profile)

Great function, anyway a little correction (as already stated in comments below) should be made. In case of meteo data, usually the convention has winds coming FROM the selected direction, and not going TO it.
So, D=mod(-90-D,360);
should be replaced with D=mod(90-D,360);

07 Feb 2013 Davide

Davide (view profile)

26 Nov 2012 M Sohrabinia

M Sohrabinia (view profile)

22 Nov 2012 Alexandre Livernoche

Awesome plot! Exactly what I needed. Just a bit of thinking to do with the direction, but it's always a problem considering all the different conventions.

I had the background problem when I save my plot in .png, but solved it with a simple code given by Marcos Cesar Ruggeri.
« In order to fix it, write at the end of the code:

set(gca,'color','w'); »

Would be nice to have the option to make the concentric rings be associated with the intensity and the color be probability. I know it isn't the conventional way to plot a windrose, but I'd be interested to have something like that.

Is there a simple way to do that?

Thanks a lot.

19 Nov 2012 david sebastian

hi, thanks for this powerfull tool, i have a problem when i print the wind rose because the backgroud turns black an i cant see the scale of the rose, berfore printing i dont have this problem, plis someone can help me. Thanks bye.

13 Nov 2012 Hogendijk

Hi everyone. I've been using de wind_rose function for a few days and first of all, I must say it's awesome. But there is still one point that I can't fixe, maybe it cannot be fixed.

With the 'n' parameter, it's possible to change the number of directions subdivision. For example, 'n',8 will divided the 360 degrees into 8 similar parts (45 grads each time). But now, if I want it to be divided into 8 parts, but with different start and end points such as: 25:70,70:115,115:160, etc... How should I proceed?

Can you get my question ? Hope so ;)

I'd be really thankful if you could help me with this problem. Thanks a lot.

13 Nov 2012 Hogendijk

29 Aug 2012 Katha

Katha (view profile)

Thank you for that wonderful plotting tool!!!
But can somebody help me to save the figure in . png?
If i do this:
saveas(gcf,'name.fig'); it works, but
with saveas(gcf,'name.png'); I get a black picture.

31 Jul 2012 Jennifer Dean

Nevermind, I solved my print problem. Excellent plot. Thank you very much!

31 Jul 2012 Jennifer Dean

I'm fairly new to Matlab and am having a problem figuring out where the "print" command should go within the wind_rose function. I've tried a number of locations and continue to get errors. Can someone please help with the line location and syntax of the command? Thanks.

Comment only
10 Jul 2012 Monica He

nice, like Loubna above :)

29 Jun 2012 Raul

Raul (view profile)

Have you ever tried to use wind rose with a 3x3 subplot? It is like the ninth subplot mess everything up. I have tried to figure out what is going on but I do not get it.

Comment only
09 Jun 2012 Addisu

Addisu (view profile)

Thanks. It is very important file.

Comment only
29 May 2012 Albin

Albin (view profile)

solved - sry

Comment only
29 May 2012 Albin

Albin (view profile)

Thanks for that wonderful routine.
How can I change the figure to be displayed not on white but on a transparant background (also the patch the figure is drawn on)?


Comment only
23 May 2012 Loubna Benyahya

Thanks for this routine, it's very useful. However, to have have 0º in the north, we have to change D=mod(-270-D,360). Thanks again.

12 May 2012 Víctor

Thank you very much, it's a very useful routine. However, I had to change the conversion from meteo to cartesian to "mod(90-test_dir,360)" as g l pointed out. At university, we also use the convention of wind direction FROM. For instance, a wind direction of 0º should be plotted as wind coming from north, not going to south.
Thanks again.

22 Dec 2011 Poul Reitzel

Thanks for a functional, easy to use program, M Ma.

I have one question:

I am plotting a "damage rose" (damage calculated using the Palmgren-Miner damage summation rule), in which i want to plot the damage caused by waves with different wave height from 4 different incident directions on a structure. I want to plot the rose with wave heights on the legend but damage (a number between 0 and 1 for each wave) on the rose. So all in all i have three vectors: One for incident directions, one for wave heights for each direction and a final containing the damage caused by each wave height. All vectors have the same length of course. Is there a way to solve my problem using your algorithm, or does it require modifications from my side?

- Best regards

19 Dec 2011 Fredrik

Great! Just a question, how can I get the length of each bar to be determined by the sum of values inside limits instead of number of values inside limits? (So that I can create an energy rose instead of just a wind rose)

15 Dec 2011 Michael Pikridas

There are handles available that include the labels of the legend too.

The problem is that the handles change by plot. So if in one plot the legend title handle is h(20) in another one is h(22) so you have to change them in each plot which is cumbersome.

This is what I am trying to figure out actually.

Comment only
14 Dec 2011 Bryan Kappa

I need more functionality on labeling the polar axis. I need to label the axis in degrees, and I can't submit the images in my report unless they have labels.

I tried messing with the code to get it to work, but haven't been able to figure it out yet. Any ideas?

Comment only
10 Dec 2011 Michael Pikridas

It took me a while but I got it. Great function. Now I am trying to figure out the handles order.

02 Dec 2011 Bryan Kappa

A unit vargin would be good, so that the units would show up next to the intensities in the legend (m/s, ft/s, mi/hr, etc).

Thanks for making this.

06 Oct 2011 Boma Kresning

could anybody help me with a full example using this function? i am new to matlab, i've tried to fill in the input but error occured.

pls send it to , it will help me a lot. thx

06 Oct 2011 Boma Kresning

pls send it to

12 Sep 2011 Stu G

Stu G (view profile)

Solved, for example:
Wind_rose_2006 = wind_rose(Directions_2006,Velocities_2006,'ci',[10 20 30],'di',[0:1:10],'lablegend',' (ms^{-1})','dtype','meteo');

Comment only
12 Sep 2011 Stu G

Stu G (view profile)

A great function after the modification of D=mod(-270-D,360);. How can I force the intensity and direction percentage scales so all wind roses have the same axes and be compared easily?

Comment only
05 Sep 2011 qi

qi (view profile)

Very good ! Thank you!

05 Aug 2011 Aurélien BERTIN

04 Aug 2011 Felix

Felix (view profile)

Nice, handy piece of m-code. After D-mod-adjustment it worked fine for my purpose.
Thx a lot

01 Aug 2011 Antriksh

Very Handy! Thank you very much for your good work.

12 Jul 2011 D

D (view profile)

How can I fix the intensity scale to compare different wind roses?

Comment only
11 Jul 2011 D

D (view profile)

Great function!
I agree with Dan. For meteorological uses
works well

Comment only
26 Jun 2011 Cesar Manuel Diez Chirinos

Hi Hydroman S, if you visit my web page, you'll find some works related, just take a look and have someway to represent the speed and direction subdivision,
I called vectorial decomposition to some kind of graphics, just have a look,

24 Jun 2011 Cesar Manuel Diez Chirinos

24 Jun 2011 Sander

Sander (view profile)


Thanks for this function. Has proven to be very useful in Bsc thesis project (designing Dutch airport of the future). A great way to visualise large wind datasets.

24 Jun 2011 Hydroman S

Great function.
Can you call out the speed corresponding to each direction subdivision?

30 Apr 2011 Henrik Grythe

Very nice

28 Apr 2011 Cesar Manuel Diez Chirinos

Try this code, to make the concentric rings associated with intensity:
good luck

Comment only
25 Apr 2011 Jeff Hansen

Would be nice to have the option to make the concentric rings be associated with the intensity and the color be probability?

13 Apr 2011 Dan

Dan (view profile)

Awesome code! I initially had trouble with wind direction being off as well. I was able to correct this problem by changing the 'dtype' 'meteo' conversion to:


I didn't read all of the previous comments so not sure if this fix has already been provided or not...

Comment only
23 Mar 2011 Cesar Manuel Diez Chirinos

To add more axis play with:
h(1)=text(g+2*ri, 0,'E', 'VerticalAlignment','top', 'HorizontalAlignment','left', args{:},'FontSize',18);

Comment only
01 Mar 2011 Anna Larsen

I'm not a matlab expert. How can I use the script to generate a wind rose when I only have wind directions in a vektor D,
the probabilities of wind in directions in a vektor F
and mean wind speeds U?
I only want to generate a wind rose showing mean wind speeds in the different directions.

D = [0 30 60 90 120 150 180 210 240 270 300 330],
F= [5.8 4.1 3.7 4.3 7.1 13.3 12.3 10.6 9.5 11.9 9.5 8.0]
U = [7.6 6.6 5.9 6.0 6.8 8.0 8.7 8.5 8.1 7.8 8.4 8.2].

Comment only
18 Nov 2010 Ben Williams

Great file. HOWEVER: I have found that there is an issue with the way directions are plotted when appraoching between 90deg N and 180deg N. The data is plotted 180degrees out of 'true' - i/e/ something appraching from say 120deg is plotted as approaching from 330deg.

Comment only
11 Nov 2010 Alexandre

First of all obrigado

The script works fine for me but...

I want to add wind roses without adding the data because would be extremely slow and I want to use the bin extraction you already have script.
That is: windrose(A1,B1)*n1+windrose(A2,B2)*n2
n1,n2 are sufficient high to do it like A=[A1,....,A1_n1;A2,....,A2_n2] so I have to find another solution
I do not know which variables I should manipulate

Grazas again

Comment only
02 Nov 2010 Cesar Manuel Diez Chirinos

if you want to indicate only the points of the axis, you could play with the positions of ri and g, on the lines of the axis (you'll find North, South,etc at the end of the line), but if you want to line them I'll check it

Comment only
26 Oct 2010 Kevin Tang

I got a problem: I want to add more axes eg. every 30 degrees instead of only north, south, east and west.
Then how should i do it?

Comment only
14 Oct 2010 Camille Couzi

Hi again I have solved my previous problem using the follofwing command:
Now I get a pbm with the 'di':
I write:

and I get:
??? Attempted to access Ag(2); index out of bounds because numel(Ag)=1.

Error in ==> wind_rose at 207
... any idea about how to solve that?

Question about meteo correction, my data has 0º of direction when the current go to the north. What meteo correction should I apply? D=mod(90-D,360); or D=mod(-90-D,360);

thanks again for your help

Comment only
30 Jul 2010 YJ LEE

YJ LEE (view profile)

% Input data SHOULD be meteological wind data coming from
% ie. 0 deg=North, 90 deg=East, 180 deg=South, & 270 deg=West
% if 'dtype' is 'ocean'; to do coversion mod(-90-D,360) and
% to plot wind direction from meteolocal convention
% (coming from) to oceanographci convention (going to)
% if 'dtype' is 'meteo'; to do coversion mod(90-D,360) and
% to plot wind direction in meteolocal convention
% In case, input data are in oceanographic convention. Without 'dtype'
% option, wind_rose will plot wind going to. It is same results when
% 'dtype' is 'ocean' using wind data coming from (meteological convention)

23 Jul 2010 Andras

Andras (view profile)

Dear M MA,

I think the angles are still wrong.

Take this very simple example:

wind_rose(180,1,'dtype','meteo') will generate a plot pointing to the north, while wind_rose(180,1,'dtype','standard') will point to the west. If this is wind data, you would want it pointing to the south, but neither setting gives you that.

Best wishes,

Comment only
23 Jul 2010 Guillaume

Thank for your script.

I juste change the definition of meteo flag.
For an imputed wind in math mod (positive=anti-clockwise, defined from the horizontal axis) and for representation in meteorological convention (wind blowing FROM and angle since North conted positively in clockwise) I change
D=180+D and it's look to work find with the example in the script.


Comment only
01 Jul 2010 M MA

M MA (view profile)

Dear Seb

The option 'ax' is used to place the wind rose over an existing axes. But a new axes is created and placed over the other.

What you should do is to use the option 'parent' which let you choose the wind rose axes.

do this:
wind_rose(d, v, 'parent',ax)

In your first example,
ax = axes('Parent', fig)
wind_rose(d, v, 'ax', [ax .5 .5 1])

a new axes was created ... if there was something ploted in ax you wouldn't see it since wou chose to use the full ax width (1).

However I noticed that there is a missing line of code for the option 'parent' to work properly:
add axes(parent) after the line 252 (of the latest version). I will update this soon...

Comment only
29 Jun 2010 Seb Biass

... with an obvious ax = gca in between...

Comment only
29 Jun 2010 Seb Biass


Thanks a lot for this super cool script. I have a question about how to plot a wind rose in the axes within a GUI.

If I do:
fig = figure
ax = axes('Parent', fig)
wind_rose(d, v, 'ax', [ax .5 .5 1])
the wind rose plots nicely in the middle of the axes, perfect, everyone is happy.

Now, I have a GUI with axes (let's say called plot1). What I am trying to do is:
axes(handles.plot1) % get the focus
ax = gca % get current aces
wind_rose(d, v, 'ax', [ax .5 .5 1])

nothing is plotted, or plotted somewhere not visible. I tried changing all x and y, or the ratio, but nothing. I don't know if I am not calling the good axes (can you use gca in a GUI?!?!).

Did anyone have the same problem? Does anyone have an idea on how to fix it?

Cheers guys!


Comment only
27 Jun 2010 TideMan

If you're printing the wind rose, you need to do this:
otherwise the background will be black.

20 Jun 2010 pink

pink (view profile)

how to use wind rose

Comment only
18 Jun 2010 Brian

Brian (view profile)

17 Jun 2010 M MA

M MA (view profile)

Dear Li Liao.
Yes you are right. I already fixed a small bug I found and uploaded the new version.
The percentages where wrong only when using intensities equal to the lower value of the highest intensity subdivision, basically an academic case.
Thank you

Comment only
14 Jun 2010 Li Liao

I simply test the code, and seems there was something wrong in it, here is the test:
a = [90 3;90 4;90 5;90 6;90 7;90 8;90 9; 180 3; 180 4; 180 5]
the percentage shown in the figure was not correct.

23 Jan 2010 Andrea

Andrea (view profile)

Thanks Marcos Cesar Ruggeri for the tip with the white background for the printing. That really helped :-)

Anyways, have another question now. I printed the windrose as a subplot with to otherplots. But when I do this, the windrose appears very tiny and not really readable. Does somebody know how I can resize the plot an make it bigger? Did somebody encounter the same problem?

Thanks for your help!

08 Jan 2010 Øyvind

Great function!
But how about adding the option to have the angle following a normal compass?

line 159-162
% directions conversion:
if isequal(dtype,'meteo')
D=mod(-90-D,360); % For wind coming FROM an angle
elseif isequal(dtype,'compass')
D=mod(90-D,360); % For something going toward an angle of a % compass, ie. 0 deg = North, 90 deg = East, 270 deg = West

And a simple explanation in the help-section.

Comment only
18 Nov 2009 Eleanor

Hi there,
I would like to specify my own colour choices for 'di'. Does anyone know what format 'color' should be specified in.
Many thanks,

08 Oct 2009 Cegeon

Cegeon (view profile)

14 Sep 2009 Marcos Cesar Ruggeri


Please read my comment above. I had the same problem, but finally I could solve it!


Marcos Cesar Ruggeri

Comment only
25 Jun 2009 Victoria


Everything is working great but when I print the plot (either to paper or to a jpeg file), the background turns black. Do you know how to fix this?

Thanks! Victoria

17 Jun 2009 Victoria

To plot in a subplot, find "parent=0" and replace "0" with whichever grid cell you want it in your subplot. eg. to place it in the lower left corner of a 2X2 plot of subplots, type "parent=subplot(2,2,4)"

Comment only
17 Jun 2009 Victoria

It's beautiful, but I would also like to know how to plot the wind rose on a subplot.

Comment only
13 May 2009 Juan C

Juan C (view profile)

Really nice work, but I have a question, How can I plot the wind rose on a subplot?

02 May 2009 malak voinis

please what kind of data is the argument F needed by the function WIND_ROSE(D,F,VARAGIN) ?

Comment only
30 Apr 2009 M K

M K (view profile)

The 'ci' option to force the percentage intervals appears to not work. If you change from one interval to another the length of the colored blocks stays the same, while the scale changes.

Comment only
25 Apr 2009 Marcos Cesar Ruggeri

Wind directions are inverted.
If the vector D represents all values of wind directions COMING FROM (BLOWING FROM), rewrite line #147 as follows:




Comment only
25 Apr 2009 Marcos Cesar Ruggeri

There is a problem when you want to print the graphic. The
background color (facecolor) is set in black and cannot be changed.

In order to fix it, write at the end of the code:


Thanks and good job.


Comment only
25 Apr 2009 Marcos Cesar Ruggeri

16 Jan 2009 b vs

b vs (view profile)

Hello MMA,
Great m-file. However I am not a matlab expert and cannot get the legend right in my figure. Do you maybe have the example input of the figure that is shown on the top of this file, so that I can make slight changes towards my own case?

Comment only
16 Jan 2009 b vs

b vs (view profile)

11 Nov 2008 Carlos Adrian Vargas Aguilera

Dear D S: you should write this kind of quenstions on the Newsreader (where many people will be glad to help you) or write directly to the author. Look at 5 statements here below. Carlos

Comment only
10 Nov 2008 D S

D S (view profile)

I am a new user to MatLab, so this may be a ridiculously obvious question, but I have got my inputs in the D and I format and ran the following syntax:

HANDLES = wind_rose(D,I,varargin,'meteo');

I then got this error message:

??? Attempt to execute SCRIPT varargin as a function:
C:\Program Files\MATLAB\R2007b\toolbox\matlab\lang\varargin.m

Can someone help me please?


Comment only
08 Nov 2008 Zheng i

Very Good! But I don't know how to use 'di', who can help me please? Thanks!

Comment only
08 Nov 2008 Zheng i


27 Oct 2008 FJ Way

FJ Way (view profile)

Good, however it seems that the northern bin may have a bug. If I want 22.5 degree bins (nAngles=16), then the first bin is -11.25 to +11.25 (which is good). But the Ay breakdown and input data is from 0 to 360 (i.e., nothing from -11.25 to 0). So the northern bin is usually about half the size it should be.

01 Sep 2008 romain blot

Hello, I would like to know if you have noticed a maximum size for wind and direction data input? I try to plot 1 month data with 10min time scale...and it doesn't work...
Thank you...

14 Aug 2008 Just Jess

Is there a way to show when there is no wind? Calm times should be included in the percentages, but it looks like there is no way to do this with the current code. Any suggestions?

Comment only
11 Aug 2008 Lee Linda

I do not know the reason. But I tried 90-D for wind direction. It looks it is right. Could MMA explain it more detail? Thanks.

06 Aug 2008 junsang cho

very good job!!!

28 May 2008 yanqing feng

very good!

20 May 2008 g l


You are correct that the meteo conversion for wind or waves is USUALLY mod(-90-D,360). However the test wind_rose(270,1,'dtype','meteo') also proves that this routine does not work the way it should FOR WIND. I think your comments make it clear that the routine should be renamed just rose.m and drop the "meteo" direction conversion option because the "meteo" convention is different for wind, waves, and currents.

I regret that this ongoing discussion of conventions has obviously caused you trouble, and thank you again for contributing a useful routine to the Matlab community.

Comment only
20 May 2008 M MA

G L. You are not right, the convertion is mod(-90-D,360). But anyway this utility has nothing to do about wind!! Or conventions !! The convertions to meteo convention was introduced because some people asked it!. Believe me, there are others conventions on directions of other fields. This is an Intensity/Frequency/Direction Plot! It has NOTHING to do about wind. So anybody can convert any direction to any other direction and and use wind_rose with standard direction.

Comment only
19 May 2008 worachat wannawong

How to plot wind rose? Somebody help me plz... Plz give the example code in Matlab and data test case for me.
Thank you Prof.

Comment only
18 May 2008 g l

Many thanks. Nice routine, but I must add my voice to others here. The conversion from meteo to cartesian should be new_dir = mod(90-test_dir,360) as meteo convention is wind direction FROM and cartesian is vector directed TO. I would have thought that the simple test
should result in a single bar COMING FROM the west. In the present routine it does not. It is a simple fix to correct this behaviour, as previously pointed out.

Thanks again.

12 May 2008 M MA

I suggest you to read the help of this function. Notice the dtype varargin option:

"-dtype, type of input directions D, standard or meteo, if meteo, the conversion dnew=mod(-90-D,360) is done; if not meteo, standard is used (default)"

Comment only
09 May 2008 Jadran Jur

Comments is same like From: C Dillard(

Comments: "I was thrilled when I found this plot, it is exactly what I needed until..... " Beware: This plot does not place wind directions (in degrees) into a normal compass heading where north (0) is facing up, east (90) is facing right, south (180) is facing down, and west (270) is facing left. I admit that I may be using the script wrong (I am not a matlab expert) but a simple test of one compass heading at a time proved that I am correct. "
:just try with
D=[180 350];
V=[2 4];
result is wind_rose that has direction east2west

29 Apr 2008 min liu


Comment only
25 Apr 2008 G H

The plots look great.

I originally had trouble getting the wind angles to turn out correctly - my inputs have 0 = wind from North, 90 = wind from East, etc.

I did some testing and found that if I did new_dir = mod(90-test_dir,360) (NOT -90!) and then did the standard wind rose, it came out right.

22 Apr 2008 idris mandang

wind rose

Comment only
31 Mar 2008 worachat wannawong

help me plz.

26 Mar 2008 Isabella Osetinsky

you were right,
math angle = -90 - meteo angle.

Comment only
13 Mar 2008 Isabella Osetinsky

Meteo to math angle is
not -90-meteo_angle as in your .m code

Comment only
05 Mar 2008 LJM MJ

26 Feb 2008 JUAN R.A


22 Feb 2008 M MA

the meteo2polar is simpler than that:

Many people have been asking for this, so I added a new varargin option in wind_rose: 'dtype' as 'meteo' or 'standard' (polar).
thanks for the comments

Comment only
20 Feb 2008 Sebastian D.

Same comment than C Dillard,

Exact routine that I needed and very nice graphic output.

But the plot is given using polar -or math- system (that is the Matlab default output) while most of the wind data are generally given with the Meteorologic system. Not a huge deal 'per se' (I quickly wrote a 'met2polar' routine to convert my data; basically: D = 360-(metangle-90) & D(D>360) = D(D>360)-360) but it would have been nice if it has been incorporated into the routine directly (or commented in the header).

If not really, it's a good work and this routine is perfect for my day2day work.

07 Feb 2008 Jacopo Chiggiato

23 Jan 2008 C Dillard

I was thrilled when I found this plot, it is exactly what I needed until.....

Beware: This plot does not place wind directions (in degrees) into a normal compass heading where north (0) is facing up, east (90) is facing right, south (180) is facing down, and west (270) is facing left.

I admit that I may be using the script wrong (I am not a matlab expert) but a simple test of one compass heading at a time proved that I am correct.

Comment only
07 Jan 2008 Stefano de' Rossi

Really good work

28 Nov 2007 olas herees

10 Dec 2007

added user option ci, values of the percentage circles

22 Feb 2008

added option to use meteo convention directions.
added a couple of other options in varargin (place over another plot, choose colors to use in colorbar directly)

12 May 2008

Bug fix (bar at dir=0 could be incorrect in some cases)

04 Jun 2009 1.1

-Added varargin option parent, to select the axes/subplot where to place the wind rose
- bug fix: when di, was not provided the auto mode could, in some cases, merge the data of the two smallest subdivisions

10 Jun 2009 1.2

Added incout option: if 0, data outside di limits will not be considered. By default is 1.

17 Jun 2010 1.3

Small Bug fix. The percentages where wrong when using intensities equal to the lower value of the highest intensity subdivision, basically an academic case.

17 Jun 2010 1.4

Small Bug fix. The percentages where wrong when using intensities equal to the lower value of the highest intensity subdivision, basically an academic case.

Contact us