Transparent figures from 2014b are not transparent when pasted to outside programs

2 ビュー (過去 30 日間)
Cal
Cal 2014 年 12 月 5 日
回答済み: Jose Sosa Lopez 2020 年 7 月 8 日
Recently started using 2014b and
set(gca, 'color', 'none')
does not seem to work in 2014b. I created a figure, opened it in both of my versions on this machine and 2013a produces transparent axes while 2014b does not.
What I mean by transparent is that when I Copy Figure from the figure Edit menu and paste the figure somewhere else (tried a few places to paste but Power Point is where I need it to go) that the pasted image will have no background, will let whatever else is below it show through. (When I copy, ctrl^C, from one figure to another the pasted axes are transparent but that is not all I need. I need to paste to other programs.)
I have set the "Figure background color preference" in Preferences/Figure copy Template/Copy Options/ to be "Transparent background". Also the Clipboard format setting is set to save as "Preserve information (metafile if possible)".
All of the settings that I am using are the same as I've used in all previous version of MatLAB.
Is there something that someone knows of that I am missing? Is this worthy of a bug report that I should be sending to technical support as some have suggested?
Thanks, Cal
  2 件のコメント
Timothy Gorman
Timothy Gorman 2015 年 6 月 4 日
I am having the exact same problem with 2014b and haven't been able to figure anything out so it is not just you, I think.
Vittorio
Vittorio 2015 年 12 月 2 日
Same problem here!

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

採用された回答

Vittorio
Vittorio 2015 年 12 月 3 日
Atfer contacting MathWorks support, I was told that this is a known bug in 2014b. The problem has been fixed in 2015a. If you cannot upgrade to a newer release, this is a workaround:
fig = figure();
line;
set(gca,'Color',[0 1 0]);
% save the original background color for later use
background = get(gcf, 'color');
% specify transparent background
set(gcf,'color',[0.8 0.8 0.8]);
% create output file
set(gcf,'InvertHardCopy','off');
print('-dpng', 'notTransparent.png');
% read image data back in
cdata = imread('notTransparent.png');
% write it back out - setting transparency info
imwrite(cdata, 'transparent.png', 'png', 'BitDepth', 16, 'transparency', [0.8 0.8 0.8])%background)
Hope this helps

その他の回答 (2 件)

kclamb
kclamb 2015 年 12 月 2 日
編集済み: kclamb 2015 年 12 月 2 日
My plot transparency seems to paste to word when I edit>Copy Figure. Below is how I edited the transparency of the plot.
myplot = plot(data);
myplot.Color=[myplot.Color, transparency]; %transparency between 0 and 1.
Maybe ctrl-alt-printscreen would be an acceptable alternative?

Jose Sosa Lopez
Jose Sosa Lopez 2020 年 7 月 8 日
if yor graph is in figure 1, you can put:
figure (1)
set(gcf, 'color', 'none');
set(gca, 'color', 'none');

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by