0

How to use a Mathematica plot saved as a pdf in TexMaker?

enter image description here

When I use:

\includegraphics[width=0.4\textwidth, angle=0]{Graphs.pdf} 

EDIT:

The image is really small, how do I fix that?

This is what I get(after stretched) :

enter image description here

Math
  • 765
  • This doesn't really seem to be about Mathematica nor TeXMaker, and more about "how do I include a pdf graphic in my document". Have you searched along those lines? – Teepeemm Jun 16 '21 at 11:49
  • I'd say it is to do with LaTex! – Math Jun 16 '21 at 11:50
  • @Math LaTeX yes, TexMaker no. But at the moment we don't know that you've saved it with that exact name (including case) in a folder LaTeX can see. See for example Images on latex not appearing – Chris H Jun 16 '21 at 12:00
  • Your code snippet is a bit more helpful (even better would be if you completed it so that it went from \documentclass to \end{document} and was only 5 lines of code). And the error actually gives us something to work with. Is Graphs.pdf in the same directory as your tex file? – Teepeemm Jun 16 '21 at 12:00
  • @ChrisH ok, I have a picture, but its very small, how do I fix that? – Math Jun 16 '21 at 12:02
  • Probably the optional [width=] argument to includegraphics – Chris H Jun 16 '21 at 12:02
  • @Teepeemm yes, I forgot to save it in the same directory, so that issue is resolved. however, the image is really small – Math Jun 16 '21 at 12:03
  • @ChrisH the quality of the image isn't good, is there a better method? – Math Jun 16 '21 at 12:10
  • 1
    Yes, you need to sort out your export from Mathematica, which I haven't used for 20+ years. If the image quality is poor, that's to do with the source image and not the typesetting. It sounds like raster graphics in the pdf rather than vector. Mathematica should be smarter than that but it may need reconfiguring – Chris H Jun 16 '21 at 12:14
  • it is the size you specified, if you want it bigger than 40% of the text width don't do width=0.4\textwidth – David Carlisle Jun 16 '21 at 13:01

1 Answers1

1

Your code for the Mathematica plot should include the LabelStyle like

Plot[{Log[ x], 1*(x - 1), 1.5*(x - 1), 2*(x - 1), 2.5*(x - 1), 
        3*(x - 1)}, {x, 0, 1}, ImageSize -> 750, 
    PlotStyle -> {{Blue, Thick, Dashing[None]}, {Red, 
            Dashing[None]}, {Black, Dashing[None]}, {Black, 
            Dashing[None]}, {Black, Dashing[None]}, {Black, Dashing[None]}}, 
    Frame -> {{True, False}, {False, True}}, 
    FrameLabel -> {{"y", None}, {None, "Fraction susceptible"}}, 
     LabelStyle -> {FontFamily -> "Arial", FontSize -> 24, Black},
    FrameTicks -> All, AxesOrigin -> {0, -4}]

Your script for Mathematica should have looked something like this:

myplot= Plot[<code>];
Export["FracS.pdf", myplot]

to generate a vector pdf file.

If the output was exported as a file FracS.pdf and you include in your LaTeX file

\begin{figure}
    \centering
        \includegraphics[width=\textwidth]{FracS.pdf}
        \caption{Plot of the Fraction susceptible}
        \centering
\end{figure}    

you will get

ww

Simon Dispa
  • 39,141