How to make contourf image semitransparent?
조회 수: 22 (최근 30일)
이전 댓글 표시
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?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1085710/image.png)
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Purple에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!