請,創建兩個函數能夠重現我的意思:調整大小軸
第一功能:
function testPlot1()
pointData = rand(20000,3);
figure;
%hold on; % <- if commented out, does not work
plot3(pointData(:,1), pointData(:,2), pointData(:,3),'Marker', '.', 'MarkerEdgeColor', 'b','MarkerSize', 5, 'LineStyle', 'none');
axis equal;
xh = xlabel('X');
yh = ylabel('Y');
zh = zlabel('Z');
set([xh,yh, zh],...
'fontweight','bold',...
'fontsize',14,...
'color',[0,0,0]);
view(0,20);
end
二級功能:
function testPlot2(fighandle)
axes(fighandle);
hold on;
plot3([0 3],[0 3],[0 3], 'r', 'LineWidth', 10);
end
如果您現在致電
testPlot1();testPlot2(gca)
你會得到如下:
不過,若你取消對「堅持」在testPlot1(線),並再次撥打上面的語句,你會得到:
對我來說這行爲不明。在第一種情況下,testPlot1()創建一個圖形,繪製點雲並修改軸屬性。然後調用testPlot2(gca)將該行添加到圖中,但該行被剪切。 然而,在第二種情況下,該行不再被剪切。爲什麼現在不剪裁,以前它是?
它似乎與我在testPlot1()中的軸屬性中所做的更改有關。有人可以向我解釋這種行爲嗎? (爲什麼它與保持一致,我對軸屬性所做的更改有什麼影響)
這是一個錯字:「(爲什麼它與保持,...」**它不**工作與持有,是不是你要求的? – Unapiedra 2014-10-08 09:01:30
不,不是我會做一個編輯,因爲它有點混亂,我第一次調用testPlot1(); testPlot2(gca)是當「hold on」被註釋掉時。我也會嘗試澄清我的困惑 – user1809923 2014-10-08 09:04:23