2017-05-18 37 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接受答案为有效 –

相关问题