How to enable the colorbar to only show the vertical scale with values ?
Ältere Kommentare anzeigen
I am using a colorbar command to have a vertical scale besides my polarplot. When its position property is used it is working fine, but i want it to appear as the same size of the polarplot. I have used the location propert to make it appear so. But now the problem is it was showing colormap with colors. I have attached the pictures and link to my previous answered question. All this mess occurs because i want my legend to be displayed under the plot so i have used outside position argument of legend.
4 Kommentare
jonas
am 13 Aug. 2020
Why are you using a colorbar and not a separate axis? Also, what do you mean by the last sentence, i.e what is the problem with outside?
Adam Danz
am 13 Aug. 2020
Are you using polar() or polarplot()? The link to your previous questions shows both, so which one are you using? The correct answer should be polarplot unless you're using a release of matlab prior to r2016a.
Also, it would be easier to help if you provide a working example that we can copy and run. The inputs could be attached as a mat file or they could be fake data created within the code that you share.
Mahesh Babu Dhanekula
am 13 Aug. 2020
Bearbeitet: Mahesh Babu Dhanekula
am 13 Aug. 2020
Mahesh Babu Dhanekula
am 13 Aug. 2020
Akzeptierte Antwort
Weitere Antworten (1)
Not sure if this answers your question, but it's an alternative to using a colorbar for scale. Also did not use the "outside" argument of legend as you mentioned it being problematic.
a=0:0.1:2*pi;
b=rand(size(a));
c=0.5*rand(size(a));
% create the plots
figure
hold off
ax(1) = gca;
polar(a,b,'g-')
hold on
polar(a,c,'r-')
%add legend and change position
hLegend = legend('a','b','orientation','vertical','location','south');
hLegend.Position(1:2) = [0.8 0.8]
%make new axis and align with first one
ax(2) = axes('color','none');
ax(2).XAxis.Visible = 'off';
ax(2).Position([2,4]) = ax(1).Position([2,4]);
Kategorien
Mehr zu Polar Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
