transparency does not work

6 Ansichten (letzte 30 Tage)
Mojtaba Mirakhorlo
Mojtaba Mirakhorlo am 3 Jun. 2017
Bearbeitet: musaozt am 28 Sep. 2018
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 Kommentar
musaozt
musaozt am 28 Sep. 2018
Bearbeitet: musaozt am 28 Sep. 2018
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

Melden Sie sich an, um zu kommentieren.

Antworten (1)

John D'Errico
John D'Errico am 3 Jun. 2017
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 Kommentar
Mojtaba Mirakhorlo
Mojtaba Mirakhorlo am 7 Jun. 2017
Bearbeitet: Walter Roberson am 7 Jun. 2017
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);

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Graphics Object Properties finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by