フィルターのクリア

How do you indicate the order of plotted points in a polar plot?

8 ビュー (過去 30 日間)
Robert Zukowski
Robert Zukowski 2023 年 3 月 21 日
コメント済み: Star Strider 2023 年 3 月 22 日
I know that for cartesian coordinates you can use the quiver function to draw arrows to show the order of points. I was wondering if there was a similar way to do this with polar plots:
I made a polar plot from some data and then added the arrows I want in paint. It would be a lot nicer if I could just do this directly in matlab.
Thanks!
Here is an example of what I am trying to do except in cartesian:
x = rand(10,1);
y = rand(10,1);
dx = diff(x);
dy = diff(y);
plot(x,y,'ro');
hold on
quiver(x(1:end-1),y(1:end-1),dx,dy,0)

採用された回答

Star Strider
Star Strider 2023 年 3 月 22 日
Unforutnately, quiiver and polaraxes don’t work together. The only alternative is to create your own polar axes as Cartessian axes, and then tweak until you get the desired result.
This should get you started —
p = linspace(0, 1, 25); % Function To Be Plotted
r = exp(-1.5*p);
a = p*2*pi;
rg = linspace(0, 2*pi, 13); % Angle Coordinate Definition
zv = zeros(size(rg));
cg = linspace(0, 2*pi, 400); % Radial Coordinate Definition
cx = ((0:0.2:1).'*cos(cg)).';
cy = ((0:0.2:1).'*sin(cg)).';
figure
plot([zv; cos(rg)], [zv; sin(rg)],'-k') % Plot Angle Vectors
hold on
plot(cx,cy,'-k') % Plot Radial Vectors
[x,y] = pol2cart(a,r); % Plot Functioon With 'quiver'
u = gradient(x);
v = gradient(y);
quiver(x, y, u, v, '-b')
hold off
axis('equal')
Ax = gca;
Ax.Visible = 'off';
text(cos(rg(1:end-1))*1.11-0.1, sin(rg(1:end-1))*1.1, compose('%d°',0:30:330))
text(cx(1,:),cy(30,:), compose('%.1g',0:0.2:1), 'Horiz','right', 'Vert','top')
Maybe some day this will be easiier.
.
  2 件のコメント
Robert Zukowski
Robert Zukowski 2023 年 3 月 22 日
That helps. I really wish there was an easier way though.
Star Strider
Star Strider 2023 年 3 月 22 日
Thank you!
That makes (at least) two of us!
.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by