【问题标题】:same unit in the direction of y-axis in two plots两个图中 y 轴方向上的相同单位
【发布时间】:2014-08-14 09:23:06
【问题描述】:

假设:

x=1:10;
y=x.^2;

h(1)=subplot(3,1,1:2);
plot(x,y);

h(2)=subplot(3,1,3);
plot(x,y);

我想知道是否有任何方法可以使两个图的 y 轴方向具有相同的数据单元(例如,缩短上图的 y 轴,使其等于底部的 y 轴一)?

提前非常感谢您, 维尔纳

【问题讨论】:

标签: matlab equals axes


【解决方案1】:

正如 Dev-iL 已经指出的那样。示例代码可以是

x=1:10;
y=x.^2;%First Output
z=x.^1.5;%Another output

figure
h(1)=subplot(2,1,1);
plot(x,y);
grid 'on'

h(2)=subplot(2,1,2);
plot(x,z);
grid 'on'

linkaxes([h(2) h(1)],'y');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-04-04
    • 2015-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多