removing zero data from Scatter3 figure

조회 수: 5 (최근 30일)
Ahmad Alzahrani
Ahmad Alzahrani 2017년 12월 10일
댓글: Ahmad Alzahrani 2017년 12월 10일
I want to remove the zeros from the P matrix so the that they have transparent color on Scatter3 plot. I tried P(P==0)=NaN but the data still has a blue color. How do I set zero data (blue) to transparent color.
[x,y,z] = meshgrid(1:50,1:200,1:200); scatter3(y(:),z(:),x(:),5, P(:) ,'marker','.')

채택된 답변

Jan
Jan 2017년 12월 10일
편집: Jan 2017년 12월 10일
What is "transparent color"? Do you want the points to vanish? Then:
[x,y,z] = meshgrid(1:50,1:200,1:200);
keep = (P(:) ~= 0);
x = x(keep);
y = y(keep);
z = z(keep);
scatter3(y(:), z(:), x(:), 5, P(:) ,'marker', '.')
  댓글 수: 1
Ahmad Alzahrani
Ahmad Alzahrani 2017년 12월 10일
yes, that what I was looking for. Thank you, I appreciate your time.

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

추가 답변 (0개)

카테고리

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