File Exchange

## Taylor Diagram

version 1.1.0.0 (22.4 KB) by Guillaume MAZE

### Guillaume MAZE (view profile)

Plot a Taylor Diagram

Updated 10 Feb 2010

Plot a Taylor diagram from statistics values given by STDs (standard deviations), RMSs (centered root mean square difference) and CORs (correlation)

Ref: K. Taylor
Summarizing multiple aspects of model performance in a single diagram. JGR 2001

yuhang wang

Steven Yang

Bird Doreen

Nicolas Lambert

### Nicolas Lambert (view profile)

Dear all,
I am trying to plot a Taylor diagram for four model simulations for 6 locations. I have the following statistics for four model simulations at six location.
for location 1 STD(2.08; 2.32; 2.20; 2.90; 2.81) RMS(0.41; 0.38; 0.39; 0.38) CORR(0.58; 0.61; 0.65; 0.66)
for location 2 STD(3.58; 2.25; no data; 2.59; 2.80) RMS(0.55; no data; 0.51; 0.54) CORR(0.62; no data; 0.58; 0.55)
for location 3 STD(2.65; 2.37; 1.84; 2.38; 2.83) RMS(0.47; 0.51; 0.47; 0.46) CORR(0.56; 0.54; 0.52; 0.54)
for location 4 STD(1.84; 1.96; no data; 1.42; 1.14) RMS(0.52; no data; 0.49; 0.71) CORR(0.28; no data; 0.33; 0.32)
for location 5 STD(2.51; 2.22; no data; 1.12; 1.07) RMS(0.61; no data; 0.69; 0.77) CORR(0.35; no data; 0.44; 0.42)
for location 6 STD(3.00; 2.96; 2.54; 2.68; 2.73) RMS(0.30; 0.31; 0.28; 0.28) CORR(0.79; 0.77; 0.81; 0.81)
In STD the first value is for the measurements.
Could you please guide me ?

Jahetbe

### Jahetbe (view profile)

Dear Guillaume,
Thank you for your very useful function.
I have an issue with this, How can change the minimum value of the Standard Deviation (SD) axis? The SD values in my problem are very high and the difference of they are low, I want to plot this using a limit different between the minimum and maximum values of the SD.
For example:
The SD is as:
[178.35,
185,344,
178,24]

When I plot the Taylor diagram, the SD is plotted from zero. I want to change it to higher values such as 170 in my problem.

Many thanks.

Tanmoyee Bhattacharya

### Tanmoyee Bhattacharya (view profile)

Dear Guillaume,
According ti gino I have run a script STD_A=[1.69 1.2771; 2.7889 2.393;2.5981 2.1398; 1.5963 0.97035];

RMS_A = [0 1.1754; 0 1.8935;0 1.9204;0 1.1649];

CORR_A=[1 0.71945;1 0.74311;1 0.68721;1 0.68843];

% Main code for Taylor Diagram

% Plotting 1st Station

[pp tt axl]=taylordiag(STD_A(1,:),RMS_A(1,:),CORR_A(1,:),...
'tickRMS',[0:.5:2.5],'titleRMS',0,'showlabelsRMS',1,...
'widthRMS',1,'colRMS','r',...
'tickSTD',[0:.25:2],'limSTD',2,'styleSTD','-',...
'tickCOR',[.1:.1:.9 .95 .99],'showlabelsCOR',1,'titleCOR',1);
but The std,rms and corr is for two stations.If I add 5 columns it is giving error Error using taylordiag (line 110) taylordiag.m : Something's wrong with data indice(s): 2? You must have: RMSs - sqrt(STDs.2 + STDs(1)2 - 2*STDs*STDs(1).CORs) = 0 !taylordiag.m : Something's wrong with data indice(s): 3? You must have: RMSs - sqrt(STDs.2 + STDs(1)2 - 2*STDs*STDs(1).CORs) = 0 !taylordiag.m : Something's wrong with data indice(s): 4? You must have: RMSs - sqrt(STDs.2 + STDs(1)2 - 2*STDs*STDs(1).CORs) = 0 !

Joana Mendes

### Joana Mendes (view profile)

Hello, does anyone know how to increase space between RMS values?

Amol Patil

### Amol Patil (view profile)

Dear Guillaume MAZE
I appreciate the efforts by you to give such an nice function when it is not a part of matlab inbuilt functions.
I have same doubt as everyone else. Everybody is getting a error with the provided example and it is, Line number 77 "Index exceeds matrix dimensions".

I could not understand that why do you used statm(:,2) at line number 7 when it is an structured array of size 5x1 and it is not even having correlation and RMSD calculated in that. I feel that you have used some different 'allstat.m' function than provided here. I would like if you give a 2-3 line example using only statistics values.

Amol Patil

sunil kumar

### sunil kumar (view profile)

Hello I tried to run taylordig_test.m but i got error as mentioned below. please somebody help.

Line number 77 "Index exceeds matrix dimensions".

Briana Phillips

### Briana Phillips (view profile)

I am trying use this function but I keep getting the error "Index exceeds matrix dimensions" in line 78. These values that are being put into the function if I am reading this right are the max mean and std from the statm structure. This is not the STD, RMSE and Correlation values as the function calls for. Can someone explain this to me

Jack Long

### Jack Long (view profile)

Giovanni Esposito

### Giovanni Esposito (view profile)

Hi,
how can I change the RMSD values in the Taylor diagram?The greater range of 2 gives me not exact values

novvria sagita

### novvria sagita (view profile)

HI , how to set range standar deviation from 0 until reference ?

Meriem Deli

### Meriem Deli (view profile)

Hello,

I tried to plot with the taylordiag_test.m but I get this error

Undefined function 'taylordiag' for input arguments of type 'double'.

Error in taylordiag_test (line 77)
[pp tt axl] =
taylordiag(squeeze(statm(:,2)),squeeze(statm(:,3)),squeeze(statm(:,4)),...

>>
many thanks

Guillaume MAZE

invain

Kishore Grandhi

### Kishore Grandhi (view profile)

The sub functions are missing

Bian

### Bian (view profile)

Hi, could you please guide me to the location where you have saved ptable.m and allstat.m? Thank you very much!

Simon Lind

Kavina Dayal

### Kavina Dayal (view profile)

Hi, could you please guide me to the location where you have saved ptable.m and allstat.m. I tried this link http://code.guillaumemaze.org/matlab
but the files are no longer there.

Annu Panwar

### Annu Panwar (view profile)

How to create a semicircle taylor's diagram in which Vertical radius is RMSE, The horizontal diameter of semicircle is BIAS which is positive and negative both. Correlation is positive.

Robert Waters

### Robert Waters (view profile)

hello,
anyone can help me

Pierluca D'Agnese

### Pierluca D'Agnese (view profile)

Hello.
When I run the test I got this error
"Undefined function 'ptable' for input arguments of type 'double'."

Do you know how I can solve this problem?

Carlos

### Carlos (view profile)

Hello

I am a new user of Matlab, however I want to do a Taylor diagram. I already have the figures of the three variables (STD,RMS and Coorrelation factor)

Joel

Rita

Thanks I got it.

Rita

### Rita (view profile)

Thanks a lot for sharing!
When I run your test I got this error
"Undefined function 'ptable' for input arguments of type 'double'."

Hazel

### Hazel (view profile)

Hi, thanks for the code.

I've had to normalize my statistics to the observations as I'm looking at various models with different time periods. Is there a way to edit the axis labels so that I can get it to say 'Standard deviation (normalized)' like in http://www-pcmdi.llnl.gov/about/staff/Taylor/CV/Taylor_diagram_examples.pdf? I found the warning in draw_blank_TaylorDiag.m which says do not touch!

Many thanks

Shruti

### Shruti (view profile)

I am getting the following error when I run the function. Can someone suggest any solutio for this?

Error using text
Invalid parameter/value pair arguments

Error in taylordiag (line 281)
text((i+rincRMS/20)*c82+dx,(i+rincRMS/20)*s82, ...

pioneer

### pioneer (view profile)

At last i got it! thanks to Guillaume,for the scripts.Glory to God!

pioneer

### pioneer (view profile)

please i have tried to make Taylor diagrams for a whole week ! can some one help me.Moving from mat lab to R program.So desperate!

Jamie Wilson

Sagar

### Sagar (view profile)

Hi,
I am using the function 'taylordiag' as follows:
[ hp, ht, axl ] = taylordiag ( stn { 1 } (2, : ), stn { 1 } ( 3, : ), stn { 1 } ( 4, : ) );

where stn is a 1*23 cell. I need to execute the function 'taylordiag' in each cells i.e. in stn { 1 }, stn { 2 } .... stn { 23 }, so that I can plot all the points that I need in the same plot obtained by executing 'taylordiag'.

Could you please suggest how to do this?

Thank you,

-Sagar

Xingwang

Kelly Kearney

### Kelly Kearney (view profile)

Very helpful function. My only issue is that the font sizes are difficult to alter. The axis labels inherit from the original axis, but the tick labels themselves are hardcoded and their handles are hidden on creation, so one can't alter that later.

Gino

### Gino (view profile)

Dear Guillaume,

Thanks for your function, it is indeed very useful. I have a little issue for plotting multiple stations in 1 graph. Let say, I have the following matrices:

STD_A =

1.69 1.2771
2.7889 2.393
2.5981 2.1398
1.5963 0.97035

RMS_A =

0 1.1754
0 1.8935
0 1.9204
0 1.1649

CORR_A =

1 0.71945
1 0.74311
1 0.68721
1 0.68843

With the Standard Deviation (STD_A), RMS (RMS_A), correlations (CORR_A) for four stations. The statistics where obtained using allstats, so:

STD_A(1,:) correspond to the standard deviations obtained via allstats for station # 1,

STD_A(2,:) correspond to the standard deviations obtained via allstats for station # 2, and so on. The same is for RMS_A and CORR_A.

When I try to plot the stations on the same plot, using different colors and markers, the axes after the first plot do not coincide, so the RMS lines and position of the points in the plot are off. I try to play with the axes but it did not work. I know a little bit of MATLAB, but I don't consider myself an expert.

I will really appreciate if you could help me out with this and suggest a way that I could plot all the stations in one plot, so when I plot them the axes from all the plots coincide. I understand that I will have 4 'Obs' point in the X axis, that's what I was trying to do and I would differentiate them by changing colors.

This is a little bit different from the example you have on your short tutorial and on taylordiag_test , because I have 4 different stations in which on each of them I'm comparing observations with model data, and not comparing just one 'Obs' time series with different reanalysis data.

Here's the code that I've being using:

STD_A=[1.69 1.2771; 2.7889 2.393;2.5981 2.1398; 1.5963 0.97035];

RMS_A = [0 1.1754; 0 1.8935;0 1.9204;0 1.1649];

CORR_A=[1 0.71945;1 0.74311;1 0.68721;1 0.68843];

% Main code for Taylor Diagram

% Plotting 1st Station

[pp tt axl]=taylordiag(STD_A(1,:),RMS_A(1,:),CORR_A(1,:),...
'tickRMS',[0:.5:2.5],'titleRMS',0,'showlabelsRMS',1,...
'widthRMS',1,'colRMS','r',...
'tickSTD',[0:.25:2],'limSTD',2,'styleSTD','-',...
'tickCOR',[.1:.1:.9 .95 .99],'showlabelsCOR',1,'titleCOR',1);

% Deals with names, colors and size of markers for 1st Station

for ii = 1 : length(tt)
set(tt(ii),'fontsize',9,'fontweight','bold','color','g')
set(pp(ii),'markersize',12,'MarkerEdgeColor','g','MarkerFaceColor','g')
if ii == 1
set(tt(ii),'String','Obs');
else
set(tt(ii),'String',alphab(ii-1));
end
end

title(sprintf('Buoy vs WRF: Temperature at 2m'),'fontweight','bold',...
'fontsize',12);

% Deals with Axes of Taylor Diagram

tt = axl(2).handle;
for ii = 1 : length(tt)
set(tt(ii),'fontsize',10,'fontweight','bold');
end

set(axl(1).handle,'fontweight','bold','fontsize',10);

% Get info about the current axes to use on all the other axes

nPos = get( gca, 'position' );
nAx = axis();

% Create all the other overlapping Taylor diagrams

[rr,jj]=size(STD_A);

for kk=2:rr

% Create the new axes
axes( 'position', nPos );

[pp tt axl]=taylordiag(squeeze(STD_A(kk,:)),squeeze(RMS_A(kk,:)),squeeze(CORR_A(kk,:)),...
'tickRMS',[0:.5:2.5],'titleRMS',0,'showlabelsRMS',1,'widthRMS',1,'colRMS','r',...
'tickSTD',[0:.25:2],'limSTD',2,'styleSTD','-',...
'tickCOR',[.1:.1:.9 .95 .99],'showlabelsCOR',1,'titleCOR',1);

% Deals with names, colors and size of markers CMPCH

for ii = 1 : length(tt)
set(tt(ii),'fontsize',9,'fontweight','bold')
set(pp(ii),'markersize',12)
if ii == 1
set(tt(ii),'String','Obs');
else
set(tt(ii),'String',alphab(ii-1));
end

end

% Deals with names, colors and size of markers CMPCH

for ii = 1 : length(tt)
set(tt(ii),'fontsize',9,'fontweight','bold','color','m')
set(pp(ii),'markersize',12,'MarkerEdgeColor','k','MarkerFaceColor','k')
if ii == 1
set(tt(ii),'String','Obs');
else
set(tt(ii),'String',alphab(ii-1));
end
end

% set the first axes show through & line up the axis limits
set( gca, 'visible', 'off' );
axis( gca, nAx );

end

Thank you very much and any suggestion will be greatly appreciate.

Best Regards,

Gino

Sarah

### Sarah (view profile)

I have the same problem as what ulas im described in May.
Thank you.

kouekk

### kouekk (view profile)

Hi, I want to know to do a Taylor diagram

Am a new user of matlab

ulas im

### ulas im (view profile)

Hello

I am trying to use your code to plot a taylor diagram for the below matrix that contains the observations on the first row and 2 sets of models in the other rows:

63.6218 18.6781 0 1.0000
68.3743 19.1750 18.2357 0.5283 50.4187 17.7198 16.2621 0.8528 33.6676 12.4900 32.3996 0.7256
However i am getting the following error:

Error using taylordiag (line 110) taylordiag.m : Something's wrong with data indice(s): 2? You must have: RMSs - sqrt(STDs.2 + STDs(1)2 - 2*STDs*STDs(1).CORs) = 0 !taylordiag.m : Something's wrong with data indice(s): 3? You must have: RMSs - sqrt(STDs.2 + STDs(1)2 - 2*STDs*STDs(1).CORs) = 0 !taylordiag.m : Something's wrong with data indice(s): 4? You must have: RMSs - sqrt(STDs.2 + STDs(1)2 - 2*STDs*STDs(1).CORs) = 0 !

can you help me on this please

thank you

Josh

### Josh (view profile)

This is a great function. However I am experiencing the same issue as Lang (above). I can get the function to work with my model output, but it seems to only plot the std and corr. The RMSE lines appear on the diagram, but does not relate...Does anyone else agree and perhaps have an answer?

Aisling

### Aisling (view profile)

This is a brilliant function. However, I am struggling to get the correlation lines eminating from the origin to plot when the correlation is negative (the points plot perfectly). Is there a way of doing this? Thanks.

Ming Chen

### Ming Chen (view profile)

Hi all, I can plot the diagram with only positive correlations. However, when I tried to plot both positive and negative correlations (Npan=2) with the same data, I got this error message:
??? Error using ==> set
Value must be numeric.

Error in ==> xlabel at 43
set(h, 'FontAngle', get(ax, 'FontAngle'), ...

Error in ==> xlabel at 22
h = xlabel(gca,varargin{:});

Error in ==> taylordiag at 399
ax(ix).handle =xlabel('Standard deviation','fontweight',axlabweight,...

Error in ==> All_3_years at 601
[hp ht axl] = taylordiag(STD_G21_08,RMS_G21_08,COR_G21_08,'Npan',2,'tickSTD',(0:0.25:1.5));

Is there anybody who has the same problem?

Lang

### Lang (view profile)

I could plot using example data sets. But there is no information of rmsd on plot other than some green lines. Whether the rmsd intervals label on the plot?

Ming Chen

### Ming Chen (view profile)

This is very handy! Thanks to Guillaume MAZE!

ww

### ww (view profile)

I cant get the example to even work.. I have the latest allstats..

>> statm(:,2)
??? Index exceeds matrix dimensions.

ww

Benrique

### Benrique (view profile)

aMAZEing. Thanks heaps.

museum

### museum (view profile)

It succeed now, thanks MAZE!

Guillaume MAZE

museum

### museum (view profile)

Sorry, MAZE, I meet the same problem with jenny, and I found the generated 'Statm' matrix is 5x1, not 5x4....The matlab version I used is 7.0

Q.

### Q. (view profile)

So, you move to another places? why not put the test data here?

Thanks.

Guillaume MAZE

### Guillaume MAZE (view profile)

To Jenny and others having the same problem,
If you get the error message about: "Something's wrong with the datas", this is because the statistics are wrong and trigonometric relations are wrong as well, see my comment from Jul.28th.
If you also have an error message running the test script, I can't figure out why it would be. The 'statm' matrix should be 5x4. I tried this test on many different platforms, removing all my custom path, etc. and it always works fine. The only reason why you would have an error and I can think about is that somewhere in your path a function overwrites something done in the script which makes it to behave not as expected.
So, please be sure you have the correct test datas and routines. To run the test you'll also need these two functions:

PRASHANT SRIVASTAVA

### PRASHANT SRIVASTAVA (view profile)

i am getting the same problem as jenny????
Any one know how to solve this?????

Prashant

Georgina

Guillaume MAZE

### Guillaume MAZE (view profile)

The whole idea of a Taylor diagram is the triangulation of a point given statistical properties it represents in a trigonometric context. A point needs only 2 parameters to be placed in the 2D diagram but we have 3 parameters which can be used. RMSd is therefore not used to plot the point but statistics/trigonometry requirements are checked and require RMSd.

Carlos

### Carlos (view profile)

Hi, I noted that the script doesn't use the RMSd value for drawing the lines or placing the dots. What's wrong with it?

Roberto Venegas

### Roberto Venegas (view profile)

Hi, Can anybody let me know where I can get the subroutine allstats, I tried to get this from here: http://code.google.com/p/guillaumemaze/source/browse/#svn/trunk/matlab/routines

but doesnt work.
Thanks.
Robert.

Mariac Valverde Brambila

### Mariac Valverde Brambila (view profile)

I agree with Jenny

Jenny

### Jenny (view profile)

Hi Ben!

You can get the ptable script here:

However, I still can't get the script to work. not with my own data and not with the example.

With my own data I get something like this:
??? Error using ==> taylordiag at 85
taylordiag.m : Something's wrong with the datas

With the example the error message is:
??? Index exceeds matrix dimensions.

Error in ==> taylordiag_test at 77
[pp tt axl] =
taylordiag(squeeze(statm(:,2)),squeeze(statm(:,3)),squeeze(statm(:,4)),...

Does anyone know what is wrong?
I think I've misunderstood something about what input to give the script...

Cheers!

Ben

### Ben (view profile)

Thank you for the nice script and the examples.
I just have one question. What kind of function is the 'ptable' in the example: ax = ptable([2 3],[2 2;4 6]);
Thanks
Cheers Ben

Guillaume MAZE

### Guillaume MAZE (view profile)

You'll find bellow links to .mat file with datas you can use to test the routine, and with the scripts I used myself to plot these datas (they are daily time series of sea surface net heat flux at a mooring in the North Atlantic, and results from numerical models to compare with)

cheers
guillaume

ps: I use the subroutine allstats in this peace of code to make things easier, you can get it here:

I agree with Georgina!

Georgina

### Georgina (view profile)

Does anyone have an example of the inputs required for this script. I am having trouble with it.
I get "Something''s wrong with the datas"
I think it is because I don't understand what is supposed to be in the 1st row of of each of the arrays.

C Schwalm

I had started to code this up myself, now I don't have to... These plots are wonderful for diagnostics and comparing numerous models. Well done.

Pierre Hubertin Andrianirina

 10 Feb 2010 1.1.0.0 I made the help, well, more helpful regarding all the comments ! I also added a complete example in the zip file.
##### MATLAB Release Compatibility
Created with R2007b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux