Log scale for radius axis in a polar plot

조회 수: 65 (최근 30일)
btåla
btåla 2019년 1월 31일
답변: Mike D. 2020년 11월 25일
Hi everyone,
I am looking for a 'trick' to make a polar plot (polarscatter in this case) which presents my data on a log scale through the r-axis.
Has anyone been able to do that. It seems like it is not possible with 'traditional' ways like setting the RLim. The point is that I have many data that are in between 10e-6 and 10e-2. All I get is a plot with a bunch of data overlapping around 0 and some scattered data around 10e-2. I would like to have a plot where on the r-axis I have a range that goes from 10e-6 to 10e-2, as only in this way I can clearly visuallize the data close to 10e-6.
I know that since it is a polar plot, the r range starts from 0 and the log of it is infinite but surprisingly, I see very similar plots done with matlibplot in python or other softwares (licensed ones) but I would like to make use of Matlab if that is possible.
test_polar.jpg
Any help is appreciated

채택된 답변

Star Strider
Star Strider 2019년 1월 31일
Try this:
th = linspace(0, 2*pi, 9); % Create Angles
r = rand(1, numel(th)) .* 10.^(1:numel(th))-9; % Create Data
figure
polarplot(th, log10(r), 'p')
Ax = gca;
Ax.RTick = (2:2:numel(th)-1);
Ax.RTickLabel = compose('10^{%2d}',(2:2:numel(th)-1)-10);
% Ax.RTickLabel = sprintfc('10^{%2d}',(2:2:numel(th)-1)-10); % Use ‘sprintfc’ If You Do Not Have ‘compose’
Experiment to get the result you want.
  댓글 수: 4
btåla
btåla 2019년 2월 3일
Thank you Star,
following your suggestions I was able to plot the way I wanted. I just needed to fix the theta and r ticks and labels.
Thanks again,
Star Strider
Star Strider 2019년 2월 3일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Mike D.
Mike D. 2020년 11월 25일
Here is how I created a logarithmic RAxis for altitudes:
hAx2 = polaraxes(hFig,'OuterPosition',AxOutPos2,'ThetaAxisUnits','degrees', ...
'ThetaDir','clockwise','ThetaZeroLocation','top','FontSize',10', ...
'ThetaTick',0:30:360,'Color',[0 0 0],'ThetaColor',[1 1 1], ...
'ThetaTickLabel', {'N','','','E','','','S','','','W','',''}, ...
'RAxisLocation',15,'RLim',[1 5.301],'RTick',[3,4,5],'RColor',[1 1 1], ...
'RTickLabel',{'1k','10k','100k'}, 'GridAlpha',0.5);
hold(hAx2,'on');
hp = polarplot(hAx2,windDirs*pi/180,log10(altitudes),'yo','MarkerSize',2);

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by