Why Do Some Figure Properties Not Seem to be Applied Properly when Copy/Paste to/from Clipboard?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponse acceptée
Richard Quist
le 23 Nov 2021
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')
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Environment and Settings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!