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

3 ビュー (過去 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
Constantino Carlos Reyes-Aldasoro 2020 年 8 月 11 日
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 Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by