将径向轴固定在MATLAB极坐标图上 [英] Fixing the Radial Axis on MATLAB Polar Plots
问题描述
我在MATLAB中使用极坐标图(POLAR(THETA,RHO)).
I'm using polar plots (POLAR(THETA,RHO)) in MATLAB.
是否有一种简单的方法可以将径向轴的范围固定为1.5?
Is there an easy way to fix the range for the radial axis to say, 1.5?
我正在寻找类似于笛卡尔坐标轴的xlim和ylim命令.尚未在文档中找到任何内容.
I'm looking for something analogous to the xlim, ylim commands for cartesian axes. Haven't found anything in the docs yet.
推荐答案
这就是我能够做到的方式.
Here's how I was able to do it.
MATLAB极坐标图(如果您查看可用的Handle Graphics选项)没有xlim或ylim之类的东西.但是,我意识到绘制的第一件事设置了范围,因此我能够在[-1 1]绘图上绘制半径范围为[-.5 .5]的函数,如下所示:
The MATLAB polar plot (if you look at the Handle Graphics options available) does not have anything like xlim or ylim. However, I realized that the first thing plotted sets the range, so I was able to plot a function with radius range [-.5 .5] on a [-1 1] plot as follows:
theta = linspace(0,2*pi,100);
r = sin(2*theta) .* cos(2*theta);
r_max = 1;
h_fake = polar(theta,r_max*ones(size(theta)));
hold on;
h = polar(theta, r);
set(h_fake, 'Visible', 'Off');
这看起来不太好,希望有更好的方法可以做到,但是它可以工作.
That doesn't look very good and hopefully there's a better way to do it, but it works.
这篇关于将径向轴固定在MATLAB极坐标图上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!