Why Do Some Figure Properties Not Seem to be Applied Properly when Copy/Paste to/from Clipboard?

2 次查看(过去 30 天)
I have two figures f1 and f2. f1 is created with bar() and f2 with histogram2(). For f1 I execute
set(f1,'Color','none')
set(f1,'InvertHardCopy','off')
print('-dmeta','-f1')
and I executed the same commands for f2.
When I go to PowerPoint and paste in f1 from the clipboard it comes in fine.
But when I paste in f2 from the clipboard, it comes into PowerPoint with a black background.
Is there some other figure property that might be different between f1 and f2 that could cause this difference in behavior?

采纳的回答

Richard Quist
Richard Quist 2021-11-23
My guess is that f2 is being copied to the clipboard as an embedded image which doesn't support transparency. By default the print command uses a heuristic to determine how to generate the content for vector formats like metafiles.
You can force the print command to produce "true vector" output by using the -vector option (R2021b or later). In earlier versions of MATLAB you can use the -painters option:
print(f1, '-dmeta', '-vector'); % 21b or later
print(f1, '-dmeta', '-painters'); % 21a or earlier
In R2020a or later you can use the copygraphics command instead of print, which has the added benefit of eliminating the extra whitespace that typically accompanies a plot:
copygraphics(f1, 'ContentType', 'vector')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by