how to control the BackgroundAlpha of the text box

조회 수: 4 (최근 30일)
lang
lang 2025년 8월 20일
댓글: Les Beckham 2025년 8월 22일
Is there a way to create a text box with BackgroundAlpha (such as 0.5)? I can't find the alpha option for text box background in Text Properties.

채택된 답변

Les Beckham
Les Beckham 2025년 8월 20일
You can use the undocumented feature of a 4-element color spec (the fourth element is the alpha). For example:
plot([0 1], [0 1]);
ht = text(0.45 ,0.5, 'This is a test');
set(ht, 'EdgeColor', [0 0 0], 'BackgroundColor', [1 0 0 0.4]);
  댓글 수: 2
lang
lang 2025년 8월 22일
It works, thanks!
Les Beckham
Les Beckham 2025년 8월 22일

You are quite welcome.

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by