Partial transparent surface plot

조회 수: 5 (최근 30일)
Rafael Kübler
Rafael Kübler 2017년 3월 9일
편집: Massimo Zanetti 2017년 3월 9일
Hello together,
I'm trying to plot a surface where all points with a z value between -0.5 and 0.5 are 100% transperent. I've tried to make all these values to NaN (not a number). This works, so far, that the surface looks like expected, but i can not use the data cursor. When using the data cursor matlab crashes. Is there another way of makeing areas transparent or does anyone know, why matlab crashes?
Thank you for your help.
Rafael

채택된 답변

Massimo Zanetti
Massimo Zanetti 2017년 3월 9일
편집: Massimo Zanetti 2017년 3월 9일
You can set AlphaData to 0 where you don't want to see any colour. Here is an example hiding values of a trigonometric function between 0 and 1:
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
s = surf(X,Y,Z);
s.AlphaData = (Z<=0) | (Z>=1);
s.FaceColor = 'texturemap';
s.FaceAlpha = 'texturemap';
  댓글 수: 2
Rafael Kübler
Rafael Kübler 2017년 3월 9일
편집: Rafael Kübler 2017년 3월 9일
Thank you. This somehow worked. But i'm using z-buffer as renderer and with this, it doesn't seem to make any difference in transperency. When using painters the surface looks like expected but i also get some ugly numbers all over the figure. That was the reason to choose z-buffer in the first place.
Massimo Zanetti
Massimo Zanetti 2017년 3월 9일
편집: Massimo Zanetti 2017년 3월 9일
Are you just visualizing the image or trying to print it using print? Please, post some of your code.
By the way, from the help page Figure Properties I see z-buffer is no longer supported:
Note: The 'zbuffer' option has been removed. Use 'opengl' or 'painters' instead.
What Matlab version are you using?

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

추가 답변 (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