6

I am trying to use an .eps figure for my paper, but the problem comes when I got weird output.

I use this command:

\begin{figure}[!ht]
\centering
  \includegraphics[scale=0.2]{A.eps}
\end{figure}  

But on the output, the figure is rotated by itself. A.eps is a landscape figure, but it came out as a portrait figure.

I tried to rotate it so it might be come out as I want, but it did not work.

Can anybody help me, please?

2
  • try pspdf -dAutoRotatePages=/None myfile.dvi and if this dows not help, then provide your eps file
    – user2478
    Feb 8, 2011 at 16:21
  • Thank you for your reply..So, did you mean that the figure in dvi file will still rotated, then when you make that command line, the figure in pdf file will come out as I want? But I've tried it, it still doesn't work.
    – user3437
    Feb 8, 2011 at 17:55

4 Answers 4

4

From comments to a different answer, I gather that you want to include plots generated with gnuplot.

Gnuplot comes with many different "terminals", which are output filters that generate different file formats. A common one is postscript (which generates postscript files), or png for generating PNG raster images. If you build your plots interactively from a gnuplot command line, you are probably using the wxt terminal, which outputs the plots to your screen.

For including gnuplot plots in LaTeX documents, there are other terminals that are better suited than the terminals which generate standalone image files, because they let LaTeX take care of typesetting the text:

  • The epslatex terminal generates two files: One .tex file that includes all of the text and numbers, and one .eps file that includes the graphics.
    To use it, do the following: After setting up your plot as usual (by using a sequence of setup commands or by loading a gnuplot file) issue the command set terminal epslatex color at the gnuplot> prompt; then set out "filename.tex"; replot (or just plot followed by the function, if that is all you need); and finally set out without a file name, which closes the files. You have now generated the .tex and .eps files.
    In your LaTeX document, you just include the graph using \input{filename}, the .eps file will be included automatically. If you want a bigger font size, just use \large{\input{filename}} instead.

  • The tikz terminal generates a .tex file that contains TikZ code to generate the graph directly in LaTeX.
    To use it, you use set terminal tikz, after that the procedure is identical to that for the epslatex terminal. In your LaTeX document you must also load the gnuplot-lua-tikz package.

Here's a complete example using the epslatex terminal:
In gnuplot:

gnuplot> set terminal epslatex color
Terminal type set to 'epslatex'
Options are '   leveldefault color blacktext        dashed dashlength 1.0 linewidth 1.0 butt noclip        palfuncparam 2000,0.003        noheader "" 11 '
gnuplot> set out "epslatexfile.tex"
gnuplot> set samples 400, 400
gnuplot> plot [-10:10] real(sin(x)**besj0(x))
gnuplot> set out

A minimal LaTeX document to include the output from gnuplot could look like this:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\centering
\input{epslatexfile}
\end{document}

Yielding this output:

gnuplot plot with epslatex terminal

4
  • thank you a lot! it solved the rotating problem! But I have another problem now. The x-y-axis have no value written. I tried to set the xtics and ytics, but it does not work. Can you help me again?
    – user3437
    Feb 9, 2011 at 0:06
  • actually, there is nothing in line title too. I tried the \large{\input{filename}}, then the line's title is out. Not with the xy-axis. Also the figure is also large. It is not only the font.
    – user3437
    Feb 9, 2011 at 0:13
  • @sora: The fontsize commands (\large, \Large, and so on) can not influence the size of the picture, because that is in an .eps file. Try including the picture into the same document with and without \large, and you will see that the size of the graph itself does not change. If you want to change the size of the graph, use terminal epslatex color size 7cm,5cm to set the canvas size to 7cm x 5cm. About the problems with the missing tick marks and the missing line title, maybe it's easier if you open a new question for that where you include your gnuplot code.
    – Jake
    Feb 9, 2011 at 7:14
  • thank you. I will try it, and if it is not work, I will open new question. Since I tried to include another eps file which I converted from png, and there is no problem with it. So it really is the problem with gnuplot. Thank you very much!
    – user3437
    Feb 9, 2011 at 7:38
1

Just a general comment from someone who doesn't use LaTeX often:

graphicx with its \includegraphics is generally preferable to epsfig and PDF is generally to be preferred over EPS.

\includegraphics allows you to leave the image format open in the LaTeX source code, and to pick PDF instead of EPS by using pdflatex instead of latex (once you've converted your images to PDF). This has saved me a few headaches in the past.

5
  • thank you for your reply. I also have tried to convert the eps file to pdf. But the figure itself change. I need a bigger font for my figure (so I use enhanced command on gnuplot, which not used for png file, only eps file). But when I convert it to pdf, the font is even became smaller than the png file. So I think I really need to use esp figure.
    – user3437
    Feb 8, 2011 at 16:19
  • It depends. The conversion problems will recur if you need to convert the resulting document to PDF. You really don't want to see problems that late. This is one reason I prefer using pdflatex nowadays. The underlying problem is that EPS is quite an undisciplined format. Feb 8, 2011 at 16:35
  • @sora: If you're using gnuplot, why not use the epslatex terminal? That way, you can control the font size using normal LaTeX commands (in your main document), and it looks neater too, as the text will be typeset the same way as the rest of the document. For example, you could just include the .tex file generated with the gnuplot epslatex terminal using "\Large{\input{<filename>}}".
    – Jake
    Feb 8, 2011 at 16:41
  • I never use epslatex terminal before. Is it similar with gnuplot?(the language or else)
    – user3437
    Feb 8, 2011 at 17:53
  • @sora: the epslatex terminal is a part of gnuplot. I've added an answer explaining how to use it. Also, if you want me to be notified of one your comments, write @Jake in your comment.
    – Jake
    Feb 8, 2011 at 19:24
1

I just had similar issues with rotating eps figures. Check out this thread: On Ubuntu 10.10 with texlive-full installed, xelatex is rotating my figures 90 degrees counterclockwise

2
0

If you are using dvipdf then try making your command line

dvipdf -dAutoRotatePages=/None myfile.dvi
1
  • Thank you for your reply..So, did you mean that the figure in dvi file will still rotated, then when you make that command line, the figure in pdf file will come out as I want? But I've tried it, it still doesn't work.
    – user3437
    Feb 8, 2011 at 15:56

You must log in to answer this question.