更改子区域

时间:2016-02-18 12:36:11

标签: matlab figure subplot

我打开了一个包含2个子图([1,2])的图形。在第一个子图上,我绘制了一个点云对象,其大小小于子图,如下所示(忽略子图2中的图): my sitoation 请注意,该图的背景填充了子图1未使用的空间。

我正在寻找一种方法来控制子图未使用的空间的背景颜色。例如,对于红色背景: The desired situation

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

你无法轻易做到你想做的事。可能最简单的方法是将你的情节放在uipanel内,然后设置它

f = figure()
panel1 = uipanel('Parent', f, ...
                 'Units', 'norm', ...
                 'Position', [0 0 0.5 1], ...
                 'BorderType', 'none');

panel2 = uipanel('Parent', f, ...
                 'Units', 'norm', ...
                 'Position', [0.5 0 0.5 1], ...
                 'BorderType', 'none');

ax1 = axes('Parent', panel1);
ax2 = axes('Parent', panel2);

set(panel1, 'BackgroundColor', 'r')
set(panel2, 'BackgroundColor', 'g')

enter image description here