Multiple Y-axis labels in a MATLAB figure -


ok example numeric value of 1 of data large , numeric value of 1 of data small.

a = [130000 310000 200000 400000]'; b = [16 32 5 10]'; 

i doing following.

figure; bar(1:4,[a b],0.5,'stack'); 

since value of a lot high b, want secondary y-axis. otherwise values of b cannot seen on stacked bar chart.

you can use plotyy plot 2 bar charts on different y-axes in same figure.

x = [1,2,3]; y1 = [1000,2000,3000]; y2 = [0.5,0.3,0.1]; [ax,h1,h2] = plotyy(x, y1, x, y2, 'bar', 'bar'); set(h1, 'facecolor', [1 0 0], 'barwidth', 1) 

this isn't stacked bar chart had before (one set of data vertically on top of other) doesn't make sense include data on different scales in stacked bar chart.


Comments