Hi all,
Thank you for the help in advance. I wanted to plot the data usin' polar plot as the exmple shows https://matplotlib.org/examples/api/radar_chart.html
the vectors are attached as: theta=TSP rho=DNA trajectories= the direction of the wind
any help would be truly appreciated.

 채택된 답변

Steven Lord
Steven Lord 2018년 4월 3일

0 개 추천

If you want to create a polar plot, use the polarplot function introduced in release R2016a. It doesn't look exactly like the spider plot in the link Honglei posted, but it can look close, and it looks like some of the results in a Google Images search for "radar plot".
% Generate sample data
r = rand(1, 16);
th = linspace(0, 2*pi, length(r));
% Create the polar plot and get the handle to the axes
h = polarplot(th, r);
ax = ancestor(h, 'polaraxes');
% Use the axes handle to manipulate the ticks and tick labels
ax.ThetaTick = rad2deg(th);
ax.ThetaTickLabel = arrayfun(@(x) char(x+'A'), 0:15, 'UniformOutput', false);
I chose to use 'A' through 'O' as the tick labels because it was easy, but you could use a cell array containing your own names.

댓글 수: 3

Lilya
Lilya 2018년 4월 4일
Thank you so much for the help. But there is a small problem with the compass direction. it should follow the correct one, which is not like what i get (attached).
I'm not completely sure what you mean by "should follow the correct one". Do you want 0 to be at the top rather than on the right? Change the ThetaZeroLocation property of the polaraxes.
ax = polaraxes;
ax.ThetaZeroLocation = 'top';
There are many other properties you can change to modify the appearance of the polaraxes.
For example, if you want a clock face, you can do so using four properties:
ax = polaraxes;
ax.ThetaZeroLocation = 'top';
ax.ThetaDir = 'clockwise';
ax.ThetaTickLabel = {'12'; '1'; '2'; '3'; '4'; '5'; ...
'6'; '7'; '8'; '9'; '10'; '11'};
ax.RTickLabel = {};
Technically you don't need to set ThetaZeroLocation and ThetaDir if you just reorder the ThetaTickLabel, but being able to start the clock labels with 12 (midnight) at the top of the clock face and have the clock labels occur in clockwise order just makes more sense to me.
Lilya
Lilya 2018년 4월 5일
Great!! Thank you so much. it works.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Honglei Chen
Honglei Chen 2018년 4월 3일

0 개 추천

There is an entry on File Exchange for radar plot
HTH

댓글 수: 1

Lilya
Lilya 2018년 4월 4일
Thank you. Honglei!, your help is appreciated.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Polar Plots에 대해 자세히 알아보기

태그

질문:

2018년 4월 3일

댓글:

2018년 4월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by