polar/plot incompatibility

83 次查看(过去 30 天)
Bjorn Gustavsson
Bjorn Gustavsson 2025-10-28,9:05
评论: Adam Danz 2025-11-3,15:12
Can any one explain the design choise that causes this:
polarscatter(linspace(0,pi*2/3,100).^2,...
linspace(0,pi*2/3,100),...
32,...
linspace(0,pi*2/3,100),'filled')
hold on
plot([-1 1],[1 -1],'m')
Error using newplot
Adding Cartesian plot to polaraxes is not supported.
Error in matlab.graphics.internal.newplotwrapper (line 11)
axReturn = newplot(varargin{:});
From my perspective picking polar/cartesian representation of my grid is just that - a choise of either cartesian grid-lines of polar grid-lines. Why should it not be possible to add objects with cartesian coordinates to a region with polar grid-lines or the other way around?
  2 个评论
Cris LaPierre
Cris LaPierre 2025-10-28,12:51
What version of MATLAB are you using?
Bjorn Gustavsson
Bjorn Gustavsson 2025-10-29,9:47
Chris: for this it was 2023a

请先登录,再进行评论。

回答(1 个)

Star Strider
Star Strider 2025-10-28,13:37
The original coordinate system predominates, and the subsequent plot call respects that.. You are plotting two points, and .
If you want to plot them as and , you need to transform them --
polarscatter(linspace(0,pi*2/3,100).^2,...
linspace(0,pi*2/3,100),...
32,...
linspace(0,pi*2/3,100),'filled')
hold on
% plot([-1 1],[1 -1],'m')
[r,a] = cart2pol([-1 1],[1 -1]) % Transform To Polar Coordinates
r = 1×2
2.3562 -0.7854
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
a = 1×2
1.4142 1.4142
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
plot(r,a)
figure
plot([-1 1],[1 -1])
axis('equal')
grid
.
  13 个评论
Bjorn Gustavsson
Bjorn Gustavsson 2025-10-30,20:58
That still doesn't make it exactly the same as points in a cartesian plane, and that part is something I have to insist makes it fundamentally different, to bend lines to adhere to a map-projection...
Adam Danz
Adam Danz 2025-11-3,15:12
This chat is an interesting read. I want to make sure I understand the idea: @Bjorn Gustavsson is your curiously about why plot(x,y) interprets the arguments as polar values (theta, radius) when plotting to polar axes rather than sticking to a Cartesian interpretation?
I can see that argument.
plot() is like a swiss army knife. It can take datetime, duration, categorical, and various types of numeric data (e.g. geographical, polar, Cartesian). Plot interprets the inputs based on the axis/ruler type. For example, the first line below creates a datetime ruler for the x-axis. The x-values of the 3rd line are therefore interpreted as durations (number of days).
plot(datetime(2000,1,1:5), 1:5, '-bo')
hold on
plot(1:5, 3:7, '-rd')
Or, is the question about why Euclidean lines are used to connect points in polar space? I've also wondered this. We recently showed how to get around this in a recent article in the Graphics and App Building blog.
I, personally, would like to see an option to connect points in polar space using arch interpolation. I also mentioned this in the following thread:

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Polar Plots 的更多信息

标签

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by