plotting 2 lines and one bar with 2 y-axes

5 次查看(过去 30 天)
Hello,
I'm trying to make a plot with two y-axes but three variables. So, on the first y-axis I want a line and a bar, and for the second y-axis just a line. I can't seem to figure this out with plotyy or plotyyy.
For a bar and line with plotyy I can use this code:
[ax,h1,h2] = plotyy(x1,y1,x2,y2,@bar,@line);
But this does not work with plotyyy:
[ax,hlines] = plotyyy(x1,y1,x2,y2,x3,y3,@bar,@line,@line);
Any suggestions would be greatly appreciated.
Thanks, Dan

采纳的回答

Walter Roberson
Walter Roberson 2013-3-12
[ax,h1,h2] = plotyy(x1,y1,x3,y3,@bar,@line); %note x3 y3
hold(ax(1), 'on');
plot(ax(1), x2, y2); %on first axis

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Two y-axis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by