How to plot two plotyy plots in the same plot

6 次查看(过去 30 天)
I am trying to plot four plots in the same figure. First i plot using plotyy. Then two graphs are created, each with a yaxis.
Now I want to plot another two plots. One using yaxis-1 and one using yaxis-2. How do i do this?
If I do
[ax,h1,h2] = plotyy(...)
hold on
plot(ax(1),...)
plot(ax(2),...)
i don't get all four plots.
Thanks :)
Ben

采纳的回答

Paulo Silva
Paulo Silva 2011-8-15
[ax,h1,h2] = plotyy(...)
hold(ax(1))
plot(ax(1),...)
hold(ax(2))
plot(ax(2),...)
The problem was simple, hold on just holds the current axes and your plotyy makes two axes so only one is the current.

更多回答(2 个)

the cyclist
the cyclist 2011-8-15
figure
[hax12 line1 hline2] = plotyy(1:10,1:10,1:10,2:11)
set(hax12,'NextPlot','add')
plot(hax12(1),1:10,3:12)
plot(hax12(2),1:10,4:13)
  5 个评论

请先登录,再进行评论。


Nir Dahan
Nir Dahan 2015-8-25
try this one where all vectors are column, of size (N,1)
[ax,h1,h2]=plotyy([x,x,x,...],[y1,y2,y3,...],[X,X,X,...],[Y1,Y2,Y3,...])

类别

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