フィルターのクリア

Easy way to make text semitransparent?

40 ビュー (過去 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 Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by