Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to put my Plot output into an MS Word document without having to edit it in Corel first, so I want to export it ready for Word in vector format complete with legends, expressions, axes, and frames. Is it possible to do that in Mathematica 9? After getting Plot output, what procedure should I follow to put it into Word?

I want the best quality figures in my Word document with thin colored lines. Here is example of what I to do when I have many curves on one plot, using dashed and dotdashed combination.

  Plot[{Sin[x], Sin[2 x], Sin[3 x], Sin[4 x], 1/x}, {x, 0, 2 Pi}, 
    PlotLegends -> "Expressions"]

I look forward to seeing your examples of multi-curve plots that are Word export-ready.

share|improve this question
    
Try exporting as SVG, Export[filename, plot, "SVG"] –  ssch Jan 13 '13 at 13:09
    
@ssch do you have answer with more details, figure should be ready and clear for word, similar with figures from origin or excel. –  Pipe Jan 13 '13 at 15:08
    
If you use Export["file.pdf", plot], doesn't inserting the PDF in Word work? (You can also select the output cell and use the menu command "Save Selection as...".) –  Michael E2 Jan 13 '13 at 15:11
    
@ Michael I need full quality to put first in word doc to set positions of several figures and then export with text. More detail and professional answer is required. –  Pipe Jan 13 '13 at 15:16
1  

2 Answers 2

up vote 4 down vote accepted

The built-in Legend package is really bad. A good alternative is legendMaker and is fully documented here. Assuming you loaded this package, you can use this code, from your example:

plot = Plot[{Sin[x], Sin[2 x], Sin[3 x], Sin[4 x], 1/x}, {x, 0, 2 Pi},
   Frame -> True, FrameLabel -> (Style[#, 16] & /@ {"x", "f(x)"})]
labels = {Sin[x], Sin[2 x], Sin[3 x], Sin[4 x], Superscript[x, -1]};
opts = Sequence[Background -> LightOrange, RoundingRadius -> 10];
newPlot = 
 Overlay[{plot, legendMaker[labels, opts]}, Alignment -> {0.8, 0.9}]

The result is: enter image description here

Having plotted everything you need, saving as PDF is easy - just use

Export["foo.pdf",plot]

The result is vector graphics with full quality and is scalable. You can then include the PDF file in your Word document, or better yet, in $\LaTeX$.

share|improve this answer
    
something is wrong in the code? isn't it? I got something not very well. –  Pipe Jan 13 '13 at 16:12
    
thank you very much, but what I should do. First to run which code? Final in another post are f and g and when I want to apply mine, doesn't work? –  Pipe Jan 13 '13 at 16:24
    
How did you get last figure? –  Pipe Jan 13 '13 at 16:32
    
Glad to see that the legendMaker solution is still of use. Just when I was being asked to update it, version 9 came out with new Legends so I didn't improve it further. Another way to do it with the code in my answer is just one line: autoLegend[plot, {Sin[x],Sin[2 x],Sin[3 x],Sin[4 x],Superscript[x,-1]}, Alignment -> {.5, .6}] (the Alignment scales from -1 to 1 in both directions). I can'te really post another answer because I don't have that thing called "word". –  Jens Jan 13 '13 at 18:25
    
Word does not support importing vector graphics in PDF format. EMF should be used instead. –  Oleksandr R. Jan 14 '13 at 1:29

Until now I have been unable to import vector graphics into a distributable Word file. The first thing I do is decide on a specific style I use throughout a notebook, e.g.

opts = BaseStyle -> {20, FontFamily -> "Times", Italic};

Then I simply save the plots with code such as

image = Show[graph, ImageSize -> 1024]; Export[name, image, "JPEG"]

and insert the JPG-image into the Word file. You would have to make sure that the size of your PlotLegends etc. fit the image size. The results are usually more than reasonably good. However, I usually go through several rounds of adaptations until I am satisfied.

share|improve this answer
    
@Stelzer Thank you for your answer, can you share your experience with steps until the figure is ready for word and then further for pdf file? –  Pipe Jan 13 '13 at 15:02
    
Are you using origin, corel or excel for adaptations? –  Pipe Jan 13 '13 at 15:09
4  
+1 But you should PNG not JPG. JPG is for photographs. (JPEG stands for joint photographic experts group). See this Wiki link for quality comparison: en.wikipedia.org/wiki/… –  Chris Degnen Jan 13 '13 at 16:16
    
@ChrisDegnen I agree about PNG - but I recall ten years ago (the last time I used "word") there was also WMF which looked promising. If this still exists it may be closer to PDF... –  Jens Jan 13 '13 at 18:29
3  
@Jens WMF is obsolete format. It is replaced by EMF which gives much better results especially when dealing with non-ASCII characters. The EMF export is supported by Mathematica. This format is the native vector graphics format of Microsoft Office. –  Alexey Popkov Jan 14 '13 at 0:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.