필터 지우기
필터 지우기

Easy way to make text semitransparent?

조회 수: 39 (최근 30일)
Jared
Jared 2013년 1월 23일
댓글: Giovanni Barbarino 2023년 2월 20일
Hi all,
Is there an easy way to make text semitransparent in MATLAB? For instance, if I wanted a textbox label on a graph to be only partially transparent, is there any property to adjust, similar to 'AlphaData' for images?
Thanks!
  댓글 수: 1
Sebastian
Sebastian 2017년 11월 27일
You could change the color of the text by 'color',[0.8,0.8,0.8]
It's not transparent but assuming that you have a white background it is slightly grey to white and looks transparent.

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

채택된 답변

Walter Roberson
Walter Roberson 2013년 1월 23일
Unfortunately No. You have to convert the text to a bitmap and display it as an image (or surface) with appropriate transparency.
There are contributions in the FEX to assist with converting text to image.
  댓글 수: 3
Matthias Luh
Matthias Luh 2022년 3월 19일
It is crazy to see that this is still an issue in 2022... :(
Voss
Voss 2022년 3월 19일
Lots of things are crazy.

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

추가 답변 (1개)

Matthias Luh
Matthias Luh 2019년 5월 3일
Well, not exactly transparent I guess. But if your plot window is white, you could brighten the font up, so it looks transparent...
my_color = [0 0 1]; % [r g b] => blue
text(2, 1, 'normal text', 'Color', my_color);
opacity = 0.4; % 40 percent visible = mainly transparent
text(2, 1.5, 'kinda transparent text', 'Color', (1 - opacity * (1 - my_color)));
I'm sure someone will also find a way for non-white backgrounds...
  댓글 수: 2
Sebastian Lopez
Sebastian Lopez 2022년 5월 6일
Works great. Thank you!
Giovanni Barbarino
Giovanni Barbarino 2023년 2월 20일
for non white bachground you can just take the color of the background and do a convex combination with the text color.
probably something like
f_color = get(gcf,'Color')

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

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by