How to specify limit of right y axis, and add values above bar
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi All,
I am kindly asking for help to specify limits in the right y-axis (I have been trying to use a lot of commands but not working , mine is 2016a ) as well as I'd like to intrdouce the values above bars.
figure1=figure;
E = [31 15.5 72.2 36 71.6 700 590 610;zeros(1,8)]'
sigma = [zeros(1,8);940 2020 3550 99.8 2413 54000 21000 27000]'
[hAx,H1,H2] =plotyy([1:8],sigma, [1:8],E, 'bar', 'bar');
set(H1,'FaceColor','r') %
set(H2,'FaceColor','b') %
x_axisname={'x','y','z','notshown','xx','yy','zz','K'};
set(gca,'xticklabel',x_axisname)
mul_axes=legend([H1(1) H2(1)],'E','strength','FontSize',31); % name for multiple axes
lgd.FontSize = 31;
%ylim([0 10])
set(hAx,'FontSize',31)
set(gca,'FontSize',31);
hold off
0 Kommentare
Antworten (1)
Adam Danz
am 28 Jun. 2019
Bearbeitet: Adam Danz
am 28 Jun. 2019
figure1=figure;
E = [31 15.5 72.2 36 71.6 700 590 610;zeros(1,8)]';
sigma = [zeros(1,8);940 2020 3550 99.8 2413 54000 21000 27000]';
yyaxis left
H1 = bar(1:size(sigma,1), sigma, 'FaceColor', 'r');
text(H1(2).XData,H1(2).YData, strsplit(num2str(H1(2).YData)),'VerticalAlignment','bottom','HorizontalAlignment','Left')
set(gca,'YColor', 'r')
ylabel('Sigma')
yyaxis right
H2 = bar(1:size(E,1), E, 'FaceColor', 'b');
ylim([0,800])
text(H2(1).XData,H2(1).YData, strsplit(num2str(H2(1).YData)),'VerticalAlignment','bottom','HorizontalAlignment','Right')
set(gca,'YColor', 'b')
ylabel('E')
x_axisname={'x','y','z','notshown','xx','yy','zz','K'};
set(gca,'xticklabel',x_axisname)
mul_axes=legend([H1(1) H2(1)],'strength','E','FontSize',31); % name for multiple axes
lgd.FontSize = 31;
set(gca,'FontSize',31);
hold off
6 Kommentare
Siehe auch
Kategorien
Mehr zu Axis Labels finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!