• # Genome Informatics

The research of our group is focused on the development of computational methods for the analysis of genomic and post-genomic data. more about our current research

# Using graphs from GNUPlot [1]

If you create graphs for your presentation or paper with !GNUPlot then you get high quality results. One problem is if the legend in your graph or a axis description should contain formulars or greek letters. In this case it is possible to split the work. !GNUPlot generates the graph and !LaTeX adds the missing formulars as a kind of overlay. The following describes how you can archieve this automatically using !GNUPlot.

[…]

An excellent method to render graphs is through !GNUPlot a free and versatile plotting software, that has a special output filter directly for exporting files to !LaTeX. We assume, that the data is in a CSV file (comma separated text) in the first and third column. A simple !GNUPlot script to plot the data can look like this: !GNUPlot can plot various numerical data, functions, error distribution as well as 3D graphs and surfaces

set format "$%g$"
set title "Graph 3: Dependence of $V_p$ on $R_0$"
set xlabel "Resistance $R_0$ [$\Omega$]"
set ylabel "Voltage $V_p$ [V]"
set border 3
set xtics nomirror
set ytics nomirror
set terminal epslatex
set output "graph.eps"
plot "graph.csv" using 1:3   #Plot the data
set terminal x11
unset output

Now !GNUPlot produces two files: the graph drawing in graph.eps and the text in graph.tex. The second includes the EPS image, so that we only need to include the file graph.tex in our document:

\input{graph1.tex}

When using pdfLaTeX instead of simple !LaTeX, we must convert the EPS image to PDF ( and possibly remove the file extension of the actual graph in the file graph.tex). If we are working with a Unix-like shell, it is simply done using:

eps2pdf graph.eps

If the file graph1.tex contains the line \includegraphics{graph}% then everything is alright. Depending on the version of !GNUPlot the line could be \includegraphics{graph1.eps}%. In this case remove the extension .eps by hand or with the following command:

sed -i s/\.eps//g graph1.tex

With the included tex file we can work as with an usual image.

# Scaling of figures [2]

\begin{figure}
\begin{center}
\scalebox{1.0}{\input{<filename>.tex}}
\caption{Enter caption here.}\label{Enter label here}
\end{center}
\end{figure}
\resizebox[!][.9\textwidth]{\includegraphics{<filename>.eps}}