MATLAB Answers

# Plotting radar plot in matlab like the one in excel

41 ビュー (過去 30 日間)
Sharah 2015 年 5 月 13 日

hello, i have been looking around for ages about this. there's a function in excel where i can plot data in circle.
for example i have i have an arra y of time and force. in excel, i can put the time (x axis in circle and the force will goes in circle.
i tried polar function, compass but it does not turn out like i want to. here's the picture i got from excel.
if you can see from the picture attached, time is written at the outer circle and the force value at each time internal will follow.
anyone?
##### 4 件のコメント表示非表示 3 件の古いコメント
Rohit Jain 2015 年 5 月 15 日
There are similar plots available in MATLAB. You can try these and see if it matches your requirement. The plots which are similar to radar are 'polar','compass','rose'. See the documentation page to know more details about these plots. http://www.mathworks.com/help/matlab/ref/polar.html http://www.mathworks.com/help/matlab/ref/rose.html http://www.mathworks.com/help/matlab/ref/compass.html

サインインしてコメントする。

### 回答 (2 件)

Star Strider 2015 年 5 月 14 日
I don’t know what data you’re plotting. See if this code can be adapted to do what you want:
th_x = [0 56
10 30
20 11
30 11
40 5
50 3
60 6
70 8
80 14
90 16
100 15
110 7
120 6
130 9
140 7
150 10
160 21
170 39
180 56
190 30
200 11
210 11
220 5
230 3
240 6
250 8
260 14
270 16
280 15
290 7
300 6
310 9
320 7
330 10
340 21
350 39];
xr = [repmat(th_x(:,2)', 10, 1); zeros(1,36)];
xr = [0 reshape(xr, 1, [])];
th = linspace(0, 359, length(xr));
I originally wrote this to be a ‘polar’ version of ‘bar’. The data ‘th_x’ has degrees in the first column and the values to be plotted in the second. It expands the data to span the 10-degree increments to produce the ‘rose’ plot effect.
##### 3 件のコメント表示非表示 2 件の古いコメント
Joseph Cheng 2015 年 5 月 14 日
so to add onto this you can adjust your x and y to be something like
t = 0 : .01 : 2 * pi;
P = polar(t, 15 * ones(size(t)));
set(P, 'Visible', 'off')
hold on
y = [1 1 1 1 1 1 1 10 10 10 10 10]
y = repmat(y,1,10);
x = 1:numel(y);
x = (360/numel(y)*x+90)*pi/180;
polar(x,y)
where the first one is just to "cheat" and scale the axis. The real issue right now is to change the axis labeling to be what x is actually. it's a difficult task as these are inserted text field and not adjustable using xlim and ylim. one would have to write something like
set(findall(gcf, 'String', '90') ,'String', num2str(0));
set(findall(gcf, 'String', '180') ,'String', num2str(round(numel(y)/4)));
which would then re-label polar label to what it would be in that slice. It would be feasible to wipe out all text labels and then write a loop to create and position txt labels in a circle around the polar plot area but i don't have the time to write it out. Maybe the file exchange has something to relabel polar plots and set tick spacing.

サインインしてコメントする。

Rohit Jain 2015 年 5 月 15 日
There are similar plots available in MATLAB. You can try these and see if it matches your requirement. The plots which are similar to radar are 'polar','compass','rose'. See the documentation page to know more details about these plots. http://www.mathworks.com/help/matlab/ref/polar.html http://www.mathworks.com/help/matlab/ref/rose.html http://www.mathworks.com/help/matlab/ref/compass.html

サインインしてコメントする。

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!