How to include a vertical scale besides of a polar plot ?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Mahesh Babu Dhanekula
le 11 Août 2020
Commenté : Constantino Carlos Reyes-Aldasoro
le 13 Août 2020
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 commentaires
Réponse acceptée
Constantino Carlos Reyes-Aldasoro
le 11 Août 2020
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 commentaires
Constantino Carlos Reyes-Aldasoro
le 13 Août 2020
This requires some knowlegde of handles, try the following:
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Polar Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!