Removing values from surf?

조회 수: 13 (최근 30일)
waqas
waqas 2021년 2월 3일
답변: Matt J 2021년 2월 3일
I am plotting surf plot from the data (.mat file attached), but, there is data where Z values are zero which is ruining the plot. This results in "walls" around important features in surf. Following is the code that I am using:
ax = surf(X,Y,Z,temp); colormap((hot(30))); colorbar;
caxis([mean(temp,'all','omitnan')-2.5*std(temp,[],'all','omitnan') mean(temp,'all','omitnan')+2.5*std(temp,[],'all','omitnan')]);
ax.LineStyle = 'none';ax.EdgeColor = 'flat';ax.FaceColor = 'flat';
xlim([-70 70])
ylim([-70 70])
zlim([-30 30])
I want to keep the limits same. Resulting plot looks like this:
Any suggestions on how I can get rid of these "walls"?

채택된 답변

Matt J
Matt J 2021년 2월 3일
load(websave('data.mat','https://www.mathworks.com/matlabcentral/answers/uploaded_files/508797/data.mat'))
Z(Z==0)=nan;
ax = surf(X,Y,Z,temp); colormap((hot(30))); colorbar;
caxis([mean(temp,'all','omitnan')-2.5*std(temp,[],'all','omitnan') mean(temp,'all','omitnan')+2.5*std(temp,[],'all','omitnan')]);
ax.LineStyle = 'none';ax.EdgeColor = 'flat';ax.FaceColor = 'flat';
xlim([-70 70])
ylim([-70 70])
zlim([-30 30])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by