To create Polar Shaded plot

9 ビュー (過去 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 Center および File ExchangePolar Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by