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