polar plots axis limits

28 ビュー (過去 30 日間)
Richard Garner
Richard Garner 2011 年 6 月 7 日
コメント済み: rhashaan omar 2020 年 9 月 9 日
How does one set the axis limits in polar plots?

採用された回答

Patrick Kalita
Patrick Kalita 2011 年 6 月 7 日
Well, unfortunately there's no direct way to do it. But you can cheat (yay! cheating!). Let's say you know you want to have the radial dimension go out to 2. You can add a line of constant radius and then make it invisible:
t = 0 : .01 : 2 * pi;
P = polar(t, 2 * ones(size(t)));
set(P, 'Visible', 'off')
Now you can add the data you actually want to plot:
hold on
polar(t, sin(2 * t) .* cos(2 * t), '--r')
  3 件のコメント
Jorge
Jorge 2015 年 12 月 18 日
編集済み: Jorge 2015 年 12 月 18 日
@Eric Agreed. The lack of coherence between MATLAB function is a shame. In this case, we have a plotting function where not only xlim or ylim just don't work, you can't also for instance use 'LineWidth' as argument as you do with plot(). But if you do p = polar(), p.LineWidth property does in fact exists! It is just that someone could't be bothered to add property pairs to polar() itself in more than a decade!
Richard Garner
Richard Garner 2017 年 1 月 1 日
Thanks for your responses. But I have to take a little exception to your criticism of Matlab. I don't know of any software that is perfect, including Python. I used Python as well as Matlab and find a lot of "issues" with it. My feeling is that alot of people migrate to Python because it's free. Of course, it obviously has ALOT of nice functionality that rivals or even supercedes Matlab. But also that doesn't match up to Matlab. Anyway, just my "2 cents" worth.

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

その他の回答 (2 件)

Steven Lord
Steven Lord 2016 年 12 月 29 日
With the introduction of the polaraxes function in release R2016a you now have access to properties like ThetaLim and RLim.
  1 件のコメント
Richard Garner
Richard Garner 2017 年 1 月 1 日
Thanks for that. I did not notice. Guess I hadn't made polar axis plots in awhile.

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


Mazin Mustafa
Mazin Mustafa 2016 年 12 月 29 日
編集済み: Mazin Mustafa 2016 年 12 月 29 日
If you want to plot something such as antenna pattern for e.g. -40 dB to 0dB you may use the following code:
data = 10*log10(abs(data)./max(abs(data))); % Normalize your data
range = -40; % Choose the minimum value in dB
data(isnan(data)) = range;
data = data - range;
data = data./max(data);
data(data < 0) = 0;
polar(theta,data,'k')
view([90 270])
set(findall(gcf, 'String', '0' ),'String', ' ');
set(findall(gcf, 'String', ' 0.2' ),'String', num2str(range-(range*0.2)) );
set(findall(gcf, 'String', ' 0.4' ),'String', num2str(range-(range*0.4)) );
set(findall(gcf, 'String', ' 0.6' ),'String', num2str(range-(range*0.6)) );
set(findall(gcf, 'String', ' 0.8' ),'String', num2str(range-(range*0.8)) );
set(findall(gcf, 'String', ' 1' ),'String', '0 dB' );
  1 件のコメント
rhashaan omar
rhashaan omar 2020 年 9 月 9 日
could you explain? I'm trying to plot a graph of antenna radiation from -30 to 10 dB. I have a table of the values I digitized using an onlne website, but I can't scale my graph to match the original graph.

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

カテゴリ

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