2

I would like to change font size of general graph generated by gnuplottex, I've got this code

\documentclass[8pt,a4paper,dvipsnames]{article}
\usepackage[utf8]{inputenc}
\usepackage[left=2cm,right=2cm,top=1.5cm,bottom=1.5cm]{geometry}

\usepackage{gnuplottex}
\begin{document}

\begin{figure}[htp]
    \centering
    \begin{gnuplot}[scale=1.3, terminal=epslatex, terminaloptions={color dashed font ",3"}]
        set samples 50000
        set grid
        set key box
        set xrange [-3:1]
        set yrange [-5:30]

        p x**2
    \end{gnuplot}
    \caption{parabolic curve} \label{fig:Parab}
\end{figure}


\end{document}

But font is not scaled, instead of I get the following enter image description here

  • 2
    have a look at my pgfplots solution to your previous question, perhaps it might help? :) – cmhughes Nov 25 '16 at 15:57
  • 1
    pgfplots seems so helpful, however, I like work with gnuplot, and I would prefer a solution based on it, but thank you so much. :D – JFernan Nov 25 '16 at 16:20
3

I had another solution here first, but I worked out a more proper one.

The font size you pass to Gnuplot only controls how much space Gnuplot uses for each label. The actual characters are typeset by Latex. So, you have to specify the font size both for Gnuplot and for Latex. Gnuplot may base its calculation on a different font than is actually used by Latex. To compensate for that, the point sizes you pass to each may have to be different (as they are in the below example). In order not to complicate things further, I would stick with scale=1 for including the generated plot. You can always tell Gnuplot to draw a smaller or larger plot using set size.

\documentclass[8pt,a4paper,dvipsnames]{article}
\usepackage[utf8]{inputenc}
\usepackage[left=2cm,right=2cm,top=1.5cm,bottom=1.5cm]{geometry}

\usepackage{gnuplottex}
\begin{document}

\begin{figure}[htp]
    \centering
    \fontsize{13}{16}\selectfont
    \begin{gnuplot}[scale=1, terminal=epslatex, terminaloptions={color dashed font ",16"}]
        set samples 50000
        set grid
        set key box
        set xrange [-3:1]
        set yrange [-5:30]
        set size 1.2, 1.2

        p x**2
    \end{gnuplot}
    \caption{parabolic curve} \label{fig:Parab}
\end{figure}

\end{document}

enter image description here

  • But in this case is not being resized the axis tics and that would be the interesting point! :) – JFernan Nov 26 '16 at 23:10
  • You can set the axis tics and line widths in Gnuplot. It's a case of RTFM, really. But whatever works for you. – Michael Palmer Nov 26 '16 at 23:30

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.