Change opacity of Lines

조회 수: 136 (최근 30일)
Adi
Adi 2012년 7월 24일
댓글: Soheil 2022년 5월 4일
Hello everyone
I want to change the opacity of lines I plotted in a figure in MATLAB. I read somewhere about alpha and facealpha commands but couldn't figure how to use them. Could somoene please tell me how to do this?
Regards Adi

채택된 답변

Walter Roberson
Walter Roberson 2012년 7월 24일
It is not possible to set the transparency of lines.
The workaround is to use very thin patches instead of lines, as you can change the EdgeAlpha property for patch edges, or the FaceAlpha property of patch faces; see http://www.mathworks.com/help/techdoc/ref/patch_props.html

추가 답변 (1개)

Royi Avital
Royi Avital 2017년 9월 29일
In newer versions of MATLAB you can do that easily using the Color property of the line.
By default it is RGB array (1 x 3). Yet if you set it to RGBA (1 x 4) the last value is the alpha of the color.
Enjoy...
  댓글 수: 6
Greta Koumarianou
Greta Koumarianou 2021년 10월 7일
this does not work on 2021a. bit of an embarassment for matlab
Soheil
Soheil 2022년 5월 4일
The following works in R2021b (64-bit, Windows). The last value changes the transparency:
'Color',[0 0.4470 0.7410 0.1]);

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

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by