Getting LaTeX commands to work in Gnuplot(tex)

Posted in LaTeX by Julian Kessel - Aug 31, 2011

This time I was writing a gnuplot script for embedding the graphic in a latex document, with the help of gnuplottex package, no problem I thought.

But unfortunately my script names an axis like 

set xlabel "Temperatur an $R_1$ [$^{\degree}C$]"

You'll notice that degree is displayed as a string and not executed to produce" as intended.

You have to escape the backslash so it will not be processed by gnuplot but rather by latex, success :)

set xlabel "Temperatur an $R_1$ [$^{\\degree}C$]";

A second failure I made writing log(1/3), while gnuplot, like C does, implicitly uses integer operations for an expression without a fp value, this leads to a silent error. (gnuplot skips dat file with no valid points)

For the protocol:

f(r) = (((log(1.0/3.0)*r*(47e-6))*-1)*1000)

is the right way to do it

Tags: COMMENTS

Leave a Reply