Official transparency support for figures (savefig does not preserve transparency)

4 ビュー (過去 30 日間)
Mei Zhan
Mei Zhan 2022 年 9 月 11 日
コメント済み: Pulkit 2022 年 9 月 19 日
It appears that savefig still does not support transparency in R2022a. Is there any alternate scheme or any plan to offficially support transparency and allow figures as generated to be truly saved?
  4 件のコメント
Walter Roberson
Walter Roberson 2022 年 9 月 12 日
I see what you mean.
Pulkit
Pulkit 2022 年 9 月 19 日
The Color property is only expecting an RGB triplet, not an RGBA quadruplet .Refer the following document: https://www.mathworks.com/help/matlab/ref/plot.html#btzitot-Color.
The Line class do not support to store alpha values in its Color property even though it clearly processes them when given. You can always add in the alpha values again by manually setting the Color property of the cloned figure (f2.Children.Children.Color = [0 0 0 0.1]). Note that the Color property will have the value [0 0 0] after running that command, but the plot will be updated with the correct alpha value.
clear; close all;
x = linspace(0,2*pi);
y = sin(x);
% Original Figure
f1 = figure(1);
plot(x,y,'Color',[0 0 0 0.1],'LineStyle','-','Marker','.');
savefig( f1, 'test.fig')
f2 = openfig('test.fig');
f2.Children.Children.Color = [0 0 0 0.1];
If you have any follow-up question please feel free to reply back or contact our support team.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by