How do I remove the background color from the drawn graphic? When I insert the Mathematica-derived plot image (.emf) into the Word, I always find a white background color. How do you make these background colors transparent?
1 Answer
It is as simple as that for PNG files:
p = Plot[Sin[x], {x, 0, 1}];
Export["~/tmp/bgissue.png", p, Background -> None]
It works the same way for PDF. When I import the exported PDF graphics into Inkscape and put a colored background behind the object, one can clearly see this
If it indeed doesn't work for EMF (which I cannot try on Linux), one choice might be to use PDF.
-
-
$\begingroup$ However, the pdf file does not seem to be inserted into the word, and the png file is not in vector format and will be distorted when zoomed in. $\endgroup$– King.MaxJul 20, 2019 at 12:40
-
$\begingroup$ @King.Max Long live Microsoft Word. Can't you convert the PDF into an EMF somehow? $\endgroup$– halirutan ♦Jul 20, 2019 at 15:43
Background -> None
in theGraphic
itself, or in the export statement? I'm on macOS, so I can't use the .emf format, but I do get a transparent background with a PNG if I add theBackground -> None
to the actual export statement. Adding it to the graphic itself resulted in a white background. $\endgroup$