transparency does not work

4 ビュー (過去 30 日間)
Mojtaba Mirakhorlo
Mojtaba Mirakhorlo 2017 年 6 月 3 日
編集済み: musaozt 2018 年 9 月 28 日
Hi everybody, I want to change transparency of facecolor of a saved figure. But It does not work and when I decrease the facealpha in GUI , it just changes the color of surface. I use matlab 2017a .
Mojtaba
  1 件のコメント
musaozt
musaozt 2018 年 9 月 28 日
編集済み: musaozt 2018 年 9 月 28 日
I am having a similar problem which might be related to this. I can successfully get transparency and save the figure programatically. Yet when I open the figure again, the transparency is gone! The reason you are losing it might be due to re-opening the figures.
Note:I use R2018b

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

回答 (1 件)

John D'Errico
John D'Errico 2017 年 6 月 3 日
But transparency does work. So it would seem you must be doing something wrong. Show an example where it fails.
For example:
surf(rand(3))
As you can see, fully opaque for now. I saved save the figure, then I open it as:
open untitled.fig
H = get(gca,'Children');
set(H,'FaceAlpha',.3)
Now transparent. No problem. Of course, I cannot guess what you did wrong.
  1 件のコメント
Mojtaba Mirakhorlo
Mojtaba Mirakhorlo 2017 年 6 月 7 日
編集済み: Walter Roberson 2017 年 6 月 7 日
Thanks for the answer. The " set(xx,'FaceAlpha', y)" does not work because the figure also has some line. I try to change it manually in GUI after I create the new figure merging two existing figures. I merge two figures with the following code. I also attached the original figures and the created figure. I try to the change the transparency of created figure "FigYO" so I can see all surfaces but it just changes the color.
close all
h = openfig('figY1.fig','reuse'); % open figure
for i=1:4
h1=subplot(1,4,i);
axY{i} = gca;
end
% ax = get(h1,'CurrentAxes'); % ax1 = gca; % get handle to axes of figure g1 = openfig('figO.fig','reuse'); % open figure
for i=1:4 g2=subplot(1,4,i); axO{i} = gca;
end
h3 = figure; %create new figure s1 = subplot(1,1,1); %create and get handle to the subplot axes % s2 = subplot(2,1,2); % set(axY{1},'FaceColor',[0.8 0.8 0.8]);
fig1 = get(axY{1},'children'); %get handle to all the children in the figure
fig2 = get(axO{1},'children');
% set(fig1,'FaceAlpha',.3)
% set(fig2,'FaceAlpha',.3)
% ph = findobj(fig1,'Type','FaceColor'); copyobj(fig1,s1); copyobj(fig2,s1);

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

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by