How to specify limit of right y axis, and add values above bar
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Adam Danz
il 28 Giu 2019
Modificato: Adam Danz
il 28 Giu 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 Commenti
Vedere anche
Categorie
Scopri di più su Axis Labels in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!