【发布时间】:2015-06-07 21:42:16
【问题描述】:
我在子图中使用“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....
谁能帮帮我?
提前谢谢你!
【问题讨论】:
-
如果它对您有帮助,请接受答案,如果它仍然不起作用,请发表评论,或者如果您以不同的方式解决问题,请发布您自己的解决方案作为答案。