ax(1) = axes('position', [0.2 0.1 0.7 0.8]);
ax(2) = axes('position', ax(1).Position);
ax(3) = axes('position', ax(1).Position);
ax(4) = axes('position', ax(1).Position);
bar(ax(1), n, hist(data,n));
hold(ax(2), 'on');
plot(ax(2), 1:length(w), w,'g-','LineWidth',1.5);
plot(ax(2), 1:length(r), r,'c-','LineWidth',1.5);
plot(ax(2), 1:length(g), g,'m-','LineWidth',1.5);
plot(ax(3), x,v,'r--','LineWidth',1.5);
plot(ax(4), x,P,'b', 'LineWidth',1.5);
set(ax, 'xlim', [0 26], 'color', 'none');
set(ax(2:end), 'xcolor', 'none', 'ycolor', 'none');
set(ax, 'ycolor', 'k');
set(ax, 'box', 'off');
set(ax(2), 'yaxisloc', 'right');
axo(1) = offsetaxis(ax(3), 'y', 0.1);
axo(2) = offsetaxis(ax(4), 'y', 0.2);
set(axo(1), 'ycolor', 'r');
set(axo(2), 'ycolor', 'b');
3 Comments
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/508593-plotting-with-four-y-axes-in-the-same-figure-with-multiple-datasets-against-one-of-the-y-axes#comment_804590
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/508593-plotting-with-four-y-axes-in-the-same-figure-with-multiple-datasets-against-one-of-the-y-axes#comment_804590
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/508593-plotting-with-four-y-axes-in-the-same-figure-with-multiple-datasets-against-one-of-the-y-axes#comment_804606
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/508593-plotting-with-four-y-axes-in-the-same-figure-with-multiple-datasets-against-one-of-the-y-axes#comment_804606
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/508593-plotting-with-four-y-axes-in-the-same-figure-with-multiple-datasets-against-one-of-the-y-axes#comment_804609
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/508593-plotting-with-four-y-axes-in-the-same-figure-with-multiple-datasets-against-one-of-the-y-axes#comment_804609
Sign in to comment.