3

I am generating some figures with gnuplot epslatex terminal in standalone mode. There is no problem in generating the figures and the quality.

However, while using the elsevier article class in two column mode, I have to scale the figures to fit into the column width and then, as expected the font sizes are shrinking. I tried to scale the fonts or figure size in gnuplot. But I am running into the same problem.

I am thinking that I should be able to unify the caption, key, etc. fontsizes in Latex and make them the same as the text of the document.

Any pointers on solving this issue without going into other software?

P.S. I would like to solve this issue inside Latex and gnuplot if possible first.

  • use the cairolatex terminal in Gnuplot. You'll get .tex code for the contents (text, labels, etc.), and an .eps (or PDF, don't remember right now) of the graphics. – Holene Dec 22 '13 at 21:59
  • this does not change the output, as you scale the figure, the problem persists, the fonts also shrink, so that does not differ from the epslatex terminal. – Umut Tabak Dec 22 '13 at 23:29
1

I don't think that it would be possible to do this easily using the current set of tools (gnuplot and epslatex). The reason is that depending on the dimensions and font size of the final LaTeX document, you would need to calculate manually the dimensions and the font size of the figures.

What you require can be easily accomplished using pgfplots, which is a LaTeX package so that all the code for drawing graphics can be included into your .tex file. See example below where the figure naturally fills up the column width of the document and uses the same font size.

The process which I use to generate graphs is the following:

  1. Run experiments using program of choice, output text file
  2. Use pgfplots to write LaTeX code in main .tex file to plot graph

See the section "Reading coordinates from tables" of the pgfplots manual for more information.

\documentclass[5p]{elsarticle}

\usepackage{lipsum}
\usepackage{pgfplots}

\begin{document}

\begin{figure}[h!]
\centering
\begin{tikzpicture}
\begin{axis}[
    width=\columnwidth,
    xlabel=$x$,
    ylabel=$y$,
    legend pos=north west]
  \addplot {x^3};
  \addlegendentry{$y = x^3$};
\end{axis}
\end{tikzpicture}
\end{figure}

\lipsum[1-2]

\end{document}

enter image description here

\documentclass[3p]{elsarticle}

\usepackage{lipsum}
\usepackage{pgfplots}

\begin{document}

\begin{figure}[h!]
\centering
\begin{tikzpicture}
\begin{axis}[
    width=\columnwidth,
    xlabel=$x$,
    ylabel=$y$,
    legend pos=north west]
  \addplot {x^3};
  \addlegendentry{$y = x^3$};
\end{axis}
\end{tikzpicture}
\end{figure}

\lipsum[1-2]

\end{document}

enter image description here

1

As far as I can understand, you have two options:

  1. Using \resizebox to scale the entire contents of the .tex file produced with the epslatex terminal, i.e. \resizebox{\linewidth}{!}{\input{epslatex-file.tex}}. Note that your fonts will also be scaled.

  2. Specifying the size of the plots in your gnuplot code, set terminal epslatex size a b where a and b may have units (i.e. cm). Gnuplot doesn't seem to accept some more dynamic size, as \linewidth – which would be suitable for your purpose I believe.

Alternatively using PGFplots might be your best option - assuming you don't need 3D plots. PGFplots have quite the hunger for LaTeX memory when going 3D.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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