【发布时间】:2016-08-03 20:30:10
【问题描述】:
情况:用 imagesc 改变单个子图的位置
%% Matlab recommends this structure if axes(); in loop
a1 = subplot(1,2,1);
a2 = subplot(1,2,2);
while 1
plot(a1, rand(3))
plot(a2, rand(3))
drawnow
end
%% Test code
unitsPerInches=[0 0 15 15];
figure('Units', 'inches');
a1 = subplot(1,2,1);
a2 = subplot(1,2,2);
while 1
set(a1, 'Position', unitsPerInches); % TODO how to affect a1's Position here only?
imagesc(a1, rand(3))
imagesc(a2, rand(3))
drawnow
end
打开
-
imagesc与plot(a1,rand(3))对应的结构是什么? - 如何在循环内更改
Position或figure?
在第一季度向前推进 - 几乎完成
%% Extension to imagesc
figure
a1=subplot(1,2,1);
a2=subplot(1,2,2);
for counter=1:2;
imagesc(a1,rand(3))
imagesc(a2,rand(3))
drawnow
end
图。 1 Docs 示例的输出,图 2 Imagesc 的输出,图 3 关于 Q2,其中位置影响两个子图
Q1 快完成了;我刚刚忘记了如何在imagesc中获得相应的情节; x 值应该放在那里,但伪代码 imagesc(a1,XDATA,rand(3)) 不成功。
第二季度倒退
代码
%% Extension to imagesc
unitsPerInches=[0 0 15 15];
figure
a1=subplot(1,2,1);
a2=subplot(1,2,2);
for counter=1:2;
set(a1, 'Position', unitsPerInches); % TODO how to affect a1's Position here only?
imagesc(a1,rand(3))
imagesc(a1,rand(3))
drawnow
end
输出:位置影响图 3 中的两个图像。
我想我在这里误解了 Position 的含义,因为输出太奇怪了。
在第二季度测试 EBH 的 proposal
当有两个子图的数字时,隐式分配会导致问题
unitsPerInches=[0 0 15 15];
aFig=figure();
a1=subplot(1,2,1);
a2=subplot(1,2,2);
bFig=figure();
b1=subplot(1,2,1);
b2=subplot(1,2,2);
for counter=1:2;
if counter==1
set(a1, 'Position', unitsPerInches); % affect only position of a1
end
subplot(1,2,counter);
imagesc(rand(3));
drawnow
subplot(1,2,counter);
imagesc(rand(3));
drawnow
end
输出:子图的第二个数字失败。
系统:Linux Ubuntu 16.04 64 位
Linux 内核 4.6
Matlab:2016a
相关话题:Matlab7 'bug' when using "subplot" + "imagesc"?
【问题讨论】:
标签: matlab image-processing matlab-figure subplot