필터 지우기
필터 지우기

Add grid lines onto the 3D mesh plot

조회 수: 54 (최근 30일)
Mingze Yin
Mingze Yin 2022년 3월 15일
댓글: KSSV 2022년 3월 17일
Hi,
I have two different mesh plots for comparison below:
As you may have observed, the plot on top has the concrete black grid lines(forgive me if I used the wrong term), while the bottom plot only has blocks of colors. My goal is to make the plot on the bottom also have the grid lines like the top plot. I've tried to look up the document on mesh plot, but I couldn't find out how to do it. Could someone help me out on this problem, or point me to the right document / tutorial? Thanks so much!
  댓글 수: 2
KSSV
KSSV 2022년 3월 15일
When you plot using Surf, default edgecolors will be on. How did you plot this, show us your code.
Mingze Yin
Mingze Yin 2022년 3월 16일
Sorry for the late reply, I just tried surf and it helps, I was using mesh to plot all along.
However, may I also ask if there is any way to reduce the number of lines to any specific number? (For example, to display 100 lines instead of 1000) I realised that I have too many lines to be displayed so the whole plot looks black...
Thanks again!

댓글을 달려면 로그인하십시오.

답변 (2개)

KSSV
KSSV 2022년 3월 16일
[X,Y,Z] = peaks(1000) ; % data for demo
surf(X,Y,Z) % this will be black
shading interp % this will remove black lines
hold on
idx = 1:20:1000 ; % will draw grid with reduced resolution
plot3(X(idx,idx),Y(idx,idx),Z(idx,idx),'k')
plot3(X(idx,idx)',Y(idx,idx)',Z(idx,idx)','k')
  댓글 수: 2
Mingze Yin
Mingze Yin 2022년 3월 17일
what does the plot3 do?
KSSV
KSSV 2022년 3월 17일
As you said you want to display grid lines, plot3 draws the sparse gridlines.

댓글을 달려면 로그인하십시오.


Star Strider
Star Strider 2022년 3월 16일
Use the Surface Properties MeshStyle property —
[X,Y,Z] = peaks(50);
figure
hs = surf(X,Y,Z);
hs.MeshStyle = 'column';
.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by