필터 지우기
필터 지우기

How to make contourf image semitransparent?

조회 수: 22 (최근 30일)
JZ
JZ 2022년 8월 2일
댓글: DGM 2024년 7월 12일 15:24
I am using contourf to plot a 2D image in jet like below. Now I plan to make it semitransparent, therefore I may add some more lines. I tried all solutions searched online. Seems not working. Would anyone help me out?

채택된 답변

Bhanu Prakash
Bhanu Prakash 2024년 7월 11일 17:47
편집: Adam Danz 2024년 7월 12일 14:57
Hi,
Starting in R2022b, to control the transparency of a 'contourf' plot, you can use the 'FaceAlpha' property in MATLAB. Here is an sample code for the same:
Z = peaks;
[M,c] = contourf(Z);
The range of 'FaceAlpha' is [0,1] with the deafult value being '1':
>> c.FaceAlpha
ans =
1
If you want to reduce the transparency, you can decrease the value of 'FaceAlpha' as follows:
c.FaceAlpha=0.3
Hope this helps!
  댓글 수: 3
Adam Danz
Adam Danz 2024년 7월 12일 14:58
Thanks @Bhanu Prakash & @DGM, I added the release info to the answer.
DGM
DGM 2024년 7월 12일 15:24
Thanks Adam. Idk what happened there, but this is a good outcome.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Purple에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by