필터 지우기
필터 지우기

Is it possible to reduce the alpha for markers in a simple plot?

조회 수: 12 (최근 30일)
Wolfgang McCormack
Wolfgang McCormack 2021년 3월 12일
댓글: ANKUR KUMAR 2021년 3월 15일
Hi all,
I am having a simple plot like
plot(X,Y, 'MarkerFaceColor','#0072BD')
Is it possible to reduce the transparency of MarkerFaceColor to 0.5?
Thanks in advance

채택된 답변

ANKUR KUMAR
ANKUR KUMAR 2021년 3월 12일
편집: ANKUR KUMAR 2021년 3월 12일
Plot function doesn't have support to tune transparency. You can use scatter to do that
scat = scatter(x,y,'MarkerFaceColor','b','MarkerEdgeColor','r');
scat.MarkerFaceAlpha = .5;
scat.MarkerEdgeAlpha = .5;
You can manipulate the color values, if you wish to use plot function.
hand = plot(X,Y,'r');
hand.LineWidth = 2;
hand.Color(4)=0.2; % this would act as your alpha value or transparency factor.
  댓글 수: 2
Wolfgang McCormack
Wolfgang McCormack 2021년 3월 13일
@ANKUR KUMAR why is the index 4? I never get indexing in plots :D
ANKUR KUMAR
ANKUR KUMAR 2021년 3월 15일
First three indices are for RGB color, and the fourth index is the transparency.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by