How to include a vertical scale besides of a polar plot ?
4 views (last 30 days)
Mahesh Babu Dhanekula on 11 Aug 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.
tick = ceil(min(b))-1:0.5:ceil(max(b));
hBar.Ticks = [tick];
hBar.TickLabels = tick;
Constantino Carlos Reyes-Aldasoro on 11 Aug 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
Now display it in a figure with polar plot
% create the plots
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 ];