To create Polar Shaded plot

조회 수: 13 (최근 30일)
Utsav
Utsav 2016년 3월 21일
댓글: Utsav 2016년 3월 22일
X,Y,Z DATA ..all n*1 array
X is angle, with NEWS convention, Y is radius, Z is data.
I need shaded plot of data, onto a polar plot of radius information in Y angle information in X and data information in Z
Basically a rose plot sans the discreet histogram.
Sorry cant figure out any solution.
  댓글 수: 2
Joachim Schlosser
Joachim Schlosser 2016년 3월 21일
Could you please go to https://de.mathworks.com/products/matlab/plot-gallery.html and give the closest resemblance of what you need?
Utsav
Utsav 2016년 3월 22일
Sorry I could not find the exact match. However I want to reproduce something like this exactly.

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

채택된 답변

Mike Garrity
Mike Garrity 2016년 3월 22일
편집: Mike Garrity 2016년 3월 22일
If you don't see a polar plot which does what you want, you can use the pol2cart function to get to any of the Cartesian techniques, such as the ones I described in this blog post.
% Made up data
npts = 200;
theta = 2*pi*rand(npts,1);
r = rand(npts,1);
v = cos(theta) .* sin(pi*r);
% Convert to cartesian
[x,y] = pol2cart(theta,r);
% Interpolate onto grid
[xg,yg] = meshgrid(linspace(-1,1,125));
F = scatteredInterpolant(x,y,v);
% Mask out extrapolation
b = boundary(x,y);
inmask = inpolygon(xg(:),yg(:), x(b),y(b));
vg = F(xg,yg);
vg(~inmask) = nan;
% Call pcolor
polar(nan,nan)
hold on
h = pcolor(xg,yg,vg);
h.EdgeColor = 'none';
colorbar
  댓글 수: 3
Mike Garrity
Mike Garrity 2016년 3월 22일
First, I'm afraid I cut & pasted the wrong version when I saved that answer the first time, so you'll want to get the updated version. I left out the call to polar the first time!
For moving the 0 angle, you really want the new polarplot function as I talked about in this blog post. The problem is that it doesn't really work with this pol2cart trick, so I don't think that's going to work for you.
As for the grid lines being behind the pcolor, that's because I added the pcolor object last. To fix this, you need to move it down in the list. It is possible, but it's rather hacky. It look something like this:
% Made up data
npts = 200;
theta = 2*pi*rand(npts,1);
r = rand(npts,1);
v = cos(theta) .* sin(pi*r);
% Convert to cartesian
[x,y] = pol2cart(theta,r);
% Interpolate onto grid
[xg,yg] = meshgrid(linspace(-1,1,125));
F = scatteredInterpolant(x,y,v);
% Mask out extrapolation
b = boundary(x,y);
inmask = inpolygon(xg(:),yg(:), x(b),y(b));
vg = F(xg,yg);
vg(~inmask) = nan;
% Call polar & pcolor
polar(nan,nan)
hold on
h = pcolor(xg,yg,vg);
h.EdgeColor = 'none';
uistack(h,'down',29)
colorbar
That 29 in the call to uistack is a magic number involving the number of grid lines and labels, and you'd probably need to fiddle with it.
If you're really going to need a lot of customizing, you'd probably be better off looking at some of the polar functions on the file exchange. For example, this one looks like it might be a good starting point, but I've never tried it.
Utsav
Utsav 2016년 3월 22일
Thanks Sir. It was helpful a lot.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by