How to include a vertical scale besides of a polar plot ?

조회 수: 1 (최근 30일)
I want to draw a vertical bar besides of a polar plot like in the picture attached. Also the legend in the same position as shown in figure.
Edit: This issue got solved but the i want to allocate ticks and ticklabels by using somecode as shown below. It is not working properly.
a=0:0.1:2*pi;
b=rand(size(a));
c=0.5*rand(size(a));
figure
hold off
polar(a,b,'g-')
hold on
polar(a,c,'r-')
tick = ceil(min(b))-1:0.5:ceil(max(b));
hBar.Ticks = [tick];
hBar.TickLabels = tick;

채택된 답변

Constantino Carlos Reyes-Aldasoro
This is easy, but you need to use handles if you want the figure to look like the one you show. And also, you have to think of the bar, as the polar plot will have the values on the concentric circles of the polar plot. Anyway, here is the code:
First, some data
% the data
a=0:0.1:2*pi;
b=rand(size(a));
c=0.5*rand(size(a));
Now display it in a figure with polar plot
% create the plots
figure
hold off
polar(a,b,'g-')
hold on
polar(a,c,'r-')
Now add the legend, grab the handle and reposition:
hLegend = legend('a','b','Location','NE');
hLegend.Position = [0.7830 0.8806 0.1036 0.0869];
I would say that the figure looks good so far, but if you want the bar, add it and grab the handles, change the position, the ticks and the labels of the ticks:
% Add the bar, grab handles
hBar = colorbar;
hBar.Position = [ 0.1112 0.1024 0.001 0.8167];
hBar.Ticks = [0.05:0.1:1 ];
hBar.TickLabels = [10 0 -10 -20 -30 -30 -20 -10 0 10 ];
  댓글 수: 11
Mahesh Babu Dhanekula
Mahesh Babu Dhanekula 2020년 8월 13일
I didn't get your can you explain it in a detailed manner

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by