To create Polar Shaded plot

9 次查看(过去 30 天)
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