File Exchange

image thumbnail

spider(data,tle,rng​,lbl,leg,f)

version 1.2 (4.26 KB) by

Plots matrix column data in a spider plot.

4.625
9 Ratings

32 Downloads

Updated

View License

Function plots table data in a spider (or radar) plot form. Permits independent or global axis limit controls as well as axis labeling and data set labeling. Also allows for the plot axes to be specified. Any inputs other than the data to be plotted can be left as null ([]) which then uses the default settings. Minimum of three axes (three rows to the data) required (technical limitation to a spider plot). No maximum on number of rows (axes) or columns (data sets) but plots can get busy if rational limits are not used.
Examples are included in the help listing for usage methods.
% create a spider plot for ranking the data
% function [f, ca, o] = spider(data,tle,rng,lbl,leg,f)
%
% inputs 6 - 5 optional
% data input data (MxN) (# axes (M) x # data sets (N)) class real
% tle spider plot title class char
% rng peak range of the data (Mx1 or Mx2) class real
% lbl cell vector axes names (Mxq) in [name unit] pairs class cell
% leg data set legend identification (1xN) class cell
% f figure handle or plot handle class real
%
% outptus 3 - 3 optional
% f figure handle class integer
% x axes handle class real
% o series object handles class real
%
% michael arant - jan 30, 2008

Minor bug with automatic placement of legend (may cover the axis labels). Legend can be moved manually.

Comments and Ratings (21)

it is right , very good!

it is ritht , very good!

BonoBono

Hi Michael, I found my mistake. Your file is very helpful.
Can you give suggestion how to change the name of the "Axis"

I d like to change Axis 1, Axis 2,...
to apple, orange, grape, ...

Thanks

BonoBono

Hi Michael,

I am a beginner in Matlab.
Tried your code.
but it says:

Error using spider (line 55)
Need data to plot

Can you help?

I am using Matlab R2014b

THank you

Verry nice. Thanks!

Paul Carvalho

Daniel

Daniel (view profile)

Hi Michael,

Am currently using MATLAB 2015...I was unable to get the function to run because of two things...line 136 you had 'isint'...I'm assuming you're checking for an integer, so I changed it to 'isinteger' and it made it past there. Then on line 167 there is reference to this thing called color_index. I see it's only used in one place so I put in some dummy data and was able to get it to output a plot using some of the cases you created.

All in all, this is very cool. Thank you for the submission

-Dan

Steffen

Steffen

Hello Michael,

Thanks for quick answer.
I already tried to edit with get and set, obviously I made a mistake.
Maybe I have to change "ca" not "x"?

Steffen

michael arant

michael arant (view profile)

Hello Steffen
Yes but it is a user action. "X" in the outputs is the axes handles. From there you can edit the axes using get and set. It could have been done from the command line but I arbitrarily left that out. The complexity vs. adaptability compromise.

Thanks
Michael

Steffen

Is it possible to plot more then two positions after decimal point?

Nyeinsu

Thanks a lot... It's exactly what I am searching for.
It saves a lot of time for me.

Lars

Lars (view profile)

Well done! :)

@ Cyril: With the chop.m-file of this http://www.liv.ac.uk/pjgiblin/maths/mfiles/ side it works.

Works great! I agree with Linus, well commented and very nicely done!

Chiao

Chiao (view profile)

Bravo. Exactly what I need. Thank you

Chiao

Chiao (view profile)

michael arant

michael arant (view profile)

A few users with long legend labels have suggested replacing the location in the legend call (line 222) from ‘northeastoutside’ to ‘best’. This does improve appearance in some cases. I’ll leave it to the user to decide which placement to use.
michael

Cyril

Cyril (view profile)

very nice... Didn't work initially as the 'chop' function seems to be obsolete in R2010a.

Linus

Linus (view profile)

michael arant

michael arant (view profile)

Thank you Linus

If you have any ideas on improving the function or the calling of the function, I would like to know. The passing of the axis labels, units, data set labels, etc. is a bit clunky but I could not think of a better method. I am hoping that as others use this someone with get an inspiration.

Linus

Linus (view profile)

Brilliant, well commented and very nicely done

Updates

1.2

Thank you Daniel. Somehow two subfunctions got deleted. Do not know why / how. But fixed here.

1.1

Updated for MATLAB 2014 and newer (chop command was obsoleted)

MATLAB Release
MATLAB 7.4 (R2007a)

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

» Watch video