我在子剧情中使用'plotyy'时遇到了一些问题。
我想要一个带有4个数字的子图,并在每个图中使用'plotyy'。由于轴的缩放,我遇到了一些问题,现在我已经为第一个图解决了这个问题,但是当我试图从子图中使用相同结构的第二个图时,这个第二个图是完美的但是第一个一个图形只有一个图形而不是前两个图形(因此,第一个“plotyy”停止工作)。 为了更好地理解我的问题,我使用的代码是:
AXInv = subplot(2,2,1); % Auto-fitted to the figure.
PInv = get(AXInv,'pos'); % Get the position.
delete(AXInv)
[AXInv,H1,H2] = plotyy(h,Inv,h,prod_Inv,'plot');
set(AXInv,'pos',PInv) % Recover the position.
line([0 24],[0 1],'parent',AXInv(1),'Color',[1 1 1]) % Axis is not scaled
axis auto % Numbers on axes are crushing.
set(AXInv(1),'ytickmode','auto') % This is new....
line([0 24],[0 1500],'parent',AXInv(2),'Color',[1 1 1]) % Axis is not scaled
axis auto % Numbers on axes are crushing.
set(AXInv(2),'ytickmode','auto') % This is new....
AXPrim = subplot(2,2,2); % Auto-fitted to the figure.
PPrim = get(AXPrim,'pos'); % Get the position.
delete(AXPrim)
[AXPrim,H1,H2] = plotyy(h,Prim,h,prod_Prim,'plot');
set(AXPrim,'pos',PPrim) % Recover the position.
line([0 24],[0 1],'parent',AXPrim(1),'Color',[1 1 1]) % Axis is not scaled
axis auto % Numbers on axes are crushing.
set(AXPrim(1),'ytickmode','auto') % This is new....
line([0 24],[0 1500],'parent',AXPrim(2),'Color',[1 1 1]) % Axis is not scaled
axis auto % Numbers on axes are crushing.
set(AXPrim(2),'ytickmode','auto') % This is new....
有人可以帮助我吗?
提前谢谢你!
答案 0 :(得分:0)
我无法告诉你为什么你的线路消失了,我正在运行R2012b版本,它也发生在我身上,所以它可能只是一个奇怪的错误。
但是,为了解决这个问题,你可以删除你的两个delete
语句,因为它们在这里没有任何实际用途。如果没有这些,你会获得正确的plotyy
- 情节(带有虚拟值):
如果右轴上的双刻度打扰你,你可能想看看File Exchange's plt来解决这个问题。
下次的一些建议:尝试包含代码的最小工作示例,以便人们不必自己用数据填充变量。你可能会早点得到答案。 ;)