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 commentaire

musaozt
musaozt le 28 Sep 2018
Modifié(e) : musaozt le 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

Connectez-vous pour commenter.

Réponses (1)

John D'Errico
John D'Errico le 3 Juin 2017

0 votes

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 commentaire

Mojtaba Mirakhorlo
Mojtaba Mirakhorlo le 7 Juin 2017
Modifié(e) : Walter Roberson le 7 Juin 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);

Connectez-vous pour commenter.

Catégories

En savoir plus sur Graphics Object Properties dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by