transparency does not work

6 visualizzazioni (ultimi 30 giorni)
Mojtaba Mirakhorlo
Mojtaba Mirakhorlo il 3 Giu 2017
Modificato: musaozt il 28 Set 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 Commento
musaozt
musaozt il 28 Set 2018
Modificato: musaozt il 28 Set 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

Accedi per commentare.

Risposte (1)

John D'Errico
John D'Errico il 3 Giu 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 Commento
Mojtaba Mirakhorlo
Mojtaba Mirakhorlo il 7 Giu 2017
Modificato: Walter Roberson il 7 Giu 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);

Accedi per commentare.

Categorie

Scopri di più su Graphics Object Properties in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by