如何在所有子图上调整轴?

时间:2013-11-21 01:48:10

标签: matlab

所以我有两个具有不同caxis值的子图。有没有办法使用caxis([ - 2 2]),以便它可以重新调整所有子图的caxis?有一个函数可以生成每个图,我希望所有图都具有相同的caxis以便于比较。

enter image description here

2 个答案:

答案 0 :(得分:3)

假设您有包含子图的图形的句柄,您可以执行以下操作:

subplots = get(fig_handle,'Children'); % Get each subplot in the figure
for i=1:length(subplots) % for each subplot
    caxis(subplots(i),[-2,2]); % set the clim
end

如果您没有图中的句柄,请改用gcf

答案 1 :(得分:0)

您可以使用以下方法将图中所有子图的颜色限制设置为其现有颜色限制的范围

set(findobj(gcf,'Type','Axes'),'CLim',max(cell2mat(get(findobj(gcf,'Type','Axes'),'Clim'))*diag([-1 1]))*diag([-1 1]))

或者只有一条令人震惊的路线:

DVTAssertions: ASSERTION FAILURE in /SourceCache/IDEInterfaceBuilderPepperIntegration/IDEInterfaceBuilderPepperIntegration-7518/InterfaceBuilder/Asset Catalog/IBICWatchSchemaProvider.m:98
Details: Required component for identifier "full-screen" is missing.
Object: <IBICWatchSchemaProvider: 0x7fda9f400480>
Required component for identifier "full-screen" is missing.