2017-05-18 67 views
1

在下面的代碼片段中,我嘗試將trisurf圖繪製在背景中,因此plot(x,y,':','color','k')的黑線不再隱藏。我試過uistack(熱圖,'底部'),但trisurf情節似乎並不感冒。任何人都可以提供一個提示,如何解決這個問題?謝謝你,祝你有美好的一天! :)如何將trisurf圖繪製到「底部」和其他繪圖到「頂部」?

close all; 
figure; 
hold; 

x = [0.1567 0.2334 0.3098 0.3846 0.4138 0.4585 0.5183 0.1605 0.2398 0.3182 0.3952 0.4718 0.5487 0.5789 0.1629 0.2434 0.3236 0.4024 0.4814 0.5595]; 
x = x.'; 
y = [78.2114 85.3144 91.3028 95.9450 97.4787 99.4758 101.3201 88.1143 96.4935 103.4136 108.4151 112.5280 115.3430 116.3878 96.3760 105.0047 112.7581 119.3596 124.1293 128.1137]; 
y = y.'; 
z = [0.4250 0.5307 0.5916 0.6210 0.6285 0.6276 0.6251 0.4155 0.5185 0.5978 0.6350 0.6510 0.6596 0.6529 0.4024 0.5072 0.5823 0.6274 0.6415 0.6423]; 
z = z.'; 

f = @(X,Y) X; 
dt = delaunayTriangulation(x,y); 
P = dt.Points; 
heatmap = trisurf(dt.ConnectivityList, ... 
    P(:,1), P(:,2), f(P(:,1),P(:,2)), ... 
    'EdgeColor', 'none', ... 
    'FaceColor', 'interp', ... 
    'FaceLighting', 'phong'); 

for i=1:10:100 
    x = 0.15:0.01:0.6; 
    y = i*x+80; 
    plot(x,y,'--','color','k') % <- these plots should not be hidden by trisurf plot 
end 

Example for hidden black plot lins with 'FaceAlpha' = 1.0 of trisurf plot

Example for visible black plot lines, because 'FaceAlpha' of trisurf plot was reduced to 0.5.

+0

是什麼意思 「在後臺」? –

+0

感謝您的回覆。我上傳了一張圖片,顯示了我想要的圖片。唯一的問題是,'FaceAlpha'值被降低以獲得這個數字。正如你所看到的,黑線不會被trisurf陰謀所掩蓋。那就是,我的意思是「在後臺」。 – Lausbert

+0

您可以使用'peaks'函數顯示一個類似的例子嗎?那張圖片顯示的只是一些線條和顏色,我不知道你的意思!你想要繪製邊緣?因爲你正通過'edgecolor,none'在'trisurf'中刪除它們。 –

回答

2

據我瞭解,你可能只是使用plot3功能,而不是情節:

plot3(x,y,ones(size(x)),'--','color','k') % <- these plots should not be hidden by trisurf plot 
+0

謝謝! :)完美的作品。 – Lausbert

+0

@Lausbert接受答案爲有效 –

相關問題