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 CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by