How to include a vertical scale besides of a polar plot ?
1 次查看(过去 30 天)
显示 更早的评论
Mahesh Babu Dhanekula
2020-8-11
评论: Constantino Carlos Reyes-Aldasoro
2020-8-13
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;
0 个评论
采纳的回答
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 个评论
Constantino Carlos Reyes-Aldasoro
2020-8-13
This requires some knowlegde of handles, try the following:
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!