Lausbert
Lausbert

Reputation: 1590

How to bring trisurf plot to 'bottom' and other plots to 'top'?

In the following snippet, I try to bring the trisurf plot in the background, so the black lines of plot(x,y,':','color','k') are not hidden anymore. I tried uistack(heatmap,'bottom'), but the trisurf plot seemed unimpressed. May anybody provide a hint, how to solve this problem? Thank you and have a nice day! :)

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.

Upvotes: 1

Views: 183

Answers (1)

Andrei Davydov
Andrei Davydov

Reputation: 315

As I understand you may just use plot3 function instead of plot:

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

Upvotes: 2

Related Questions