是否可以更改子图的高度? [英] is it possible to change the height of a subplot?

查看:79
本文介绍了是否可以更改子图的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总共有4个子图.第1和第3个是实际信号,第2个和第4个是它们各自的时钟信号,即它们是0或1.子图的问题是所有图都具有相同的高度.但我希望时钟信号的高度与实际信号相比要小.并且各自的时钟信号应略低于其实际信号.我会总结一下我的要求:

I have a total of 4 subplots. 1st and 3rd are the actual Signals and 2nd and 4th are their respective clock signals i.e. they are either 0 or 1. The Problem with subplots is that all the plots are of same height. But i want the height of the clock signals to be small compared to the actual signals. and the respective clock signals should be just below their actual signals. I would summarise my requirements:

  1. 减小时钟信号子图(即第二和第四子图)的高度.
  2. 缩小前两个子图与后两个子图之间的距离.

有人可以帮助我解决这个问题吗? 预先感谢.

Anyone who could help me out with this ? Thanks in advance.

推荐答案

您应该对gca及其属性"有所了解.一个非常简单的示例如下:

You should play a little bit with gca and its 'properties'. A very simple example is as:

clc, clear, close all
x = -2*pi:0.01:2*pi;
y=sin(x);

subplot(2,1,1);plot(x,y);         % plot the first subplot
subplot(2,1,2);plot(x,y,'r');     % plot the second one

A = get(gca,'position');          % gca points at the second one
A(1,4) = A(1,4) / 2;              % reduce the height by half
A(1,2) = A(1,2) + A(1,4);         % change the vertical position
set(gca,'position',A);            % set the values you just changed

这篇关于是否可以更改子图的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆