Polar plot - plot as a line joining the points rather than like a compass plot
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a polar plot that looks like a compass plot. The data that is plotted is in the attached file where the data is in columns as follows:
Direction Max Mean Count %TotalFlow.
To plot the data I use the following code:
%%Import data from spreadsheet
disp('Select the Max_mean_count_TotFlow_per24Dir data file to import');
[filename,pathname]=uigetfile('*.xlsx','Select the file');
data = xlsread(fullfile(pathname,filename));
% Allocate imported array to column variable names
Dir = data(:,1);
Max = data(:,2);
Mean = data(:,3);
Count = data(:,4);
TotFlow = data(:,5);
Depth = input(['Input the depth for ',filename,': '],'s');
ColourDepth='[0 0.400000005960464 0.800000011920929]';
%%Max
plotdata = Max;
A=sortrows([Dir,plotdata]); % sorts into ascending order
Dir=A(:,1).*pi./180; % converts to radians from degrees
plotdata=A(:,2);
%New=[];
New=[plotdata';plotdata'];
New=New(:);
% plot the data
figure1 = figure('PaperSize',[20.98404194812 29.67743169791]);
[t,r]=rose(Dir,720);
ind=find(r);
r(ind)=r(ind).*New';
p = polar(t,r);
view([90 -90])
set(p,'color',ColourDepth);
ph = allchild(gca);
set(ph(end),'FaceColor','none');
The code works and I get a plot that looks like a compass plot with a line from 0 - out to the data point for each direction (attached figure PolarMax.png).
I would like the plot to look like the figure in PolarMax_Test.zip where there is a line joining the data points for each direction.
any help to achieve this would be greatly appreciated.
Jenny
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Polar Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!