plotting 2 lines and one bar with 2 y-axes
2 次查看(过去 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
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Two y-axis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!