“If your only tool is a hammer, then every problem becomes like a nail.”
Abraham Maslow
Introduction
Scientific work itself is not a trivial process, requiring some removal from the outside world. And it’s nonlinear in terms of intensity distribution over time - sometimes you’ll spill the time for half a year, so that later, within a month and a half, you can resolve most of the issues that concern you.
And so, you used 100% of the opportunities of the “euryka” who visited you, finished the main work and it was time to publish your results in a journal, report them at a conference, and just please your supervisor / consultant with a beautiful report. And you start the painful phase of the article / report / report. And how painful this phase will be depends on what tools you decide to use for this work.
')
I remember the times when, as a young and stupid graduate student, I wrote the first version of the candidate “brick”, designed for a thorough “reading” by me and my supervisor. Then I didn’t know about the EPS format, and therefore I exported graphs that were built in Maple to a * .bmp raster and manually ... drew them in MS Visio for later insertion into Word. There were other, no less clumsy nonsense. It is not surprising that then I cursed everything, and gave myself the word to write the following dissertation in a completely different way.
Through successive iterations, today I came to this decision:

And it is time to give the experience to people. Interested, welcome under cat.
1. Gnuplot: what is and what to eat
I think I will not discover America, and the reader is familiar with this utility. In order not to talk about it for a long time, I will cite a number of links, first of all to
the project’s official website , lowering the threshold for entering
Debian’s Notes , as well as a
very useful resource with numerous examples , and a very well-designed
FAQ in Russian . This will help to quickly get up to date, those who have not tried this tool at work.
In short,
Gnuplot is a powerful utility for plotting graphs defined by analytic dependencies, tabularly (experimental data and numerical simulation data) that supports command mode and script writing. Linux users simply install the package from the repository of their distribution, Windows and OS X users can also install this utility, following the instructions on the official website. I will explain, everything planned for the presentation, on the example of Linux.
We type in the command line:
$ gnuplot GNUPLOT Version 4.6 patchlevel 6 last modified September 2014 Build System: Linux x86_64 Copyright (C) 1986-1993, 1998, 2004, 2007-2014 Thomas Williams, Colin Kelley and many others gnuplot home: http://www.gnuplot.info faq, bugs, etc: type "help FAQ" immediate help: type "help" (plot window: hit 'h') Terminal type set to 'qt' gnuplot>
Receiving an invitation to enter commands. Enter, well, for example:
plot x**3 title ' y = x^3'
And we get:

When I saw it for the first time, I also said, “Fuuu ...!” This is the result obtained by default, and it looks somehow not solid. So no one bothers to modify it. First of all, change the color and thickness of the line graph.
gnuplot> set style line 1 lt 1 lw 3 lc rgb '#4682b4' pt -1 plot x**3 title ' y = x^3' ls 1
Let's make “school” axes, with the intersection point at the origin of coordinates, drawn with solid lines
gnuplot> set xzeroaxis lt -1 gnuplot> set yzeroaxis lt -1 gnuplot> replot
Add a grid - dashed gray lines:
gnuplot> set grid xtics lc rgb '#555555' lw 1 lt 0 gnuplot> set grid ytics lc rgb '#555555' lw 1 lt 0
Move the axis labels to the axles themselves closer:
gnuplot> set xtics axis gnuplot> set ytics axis
Change the range of the argument:
gnuplot> set xrange [-3:3]
And ultimately we get this:

Which is much better than the original version. The possibilities for customizing graphs are simply awesome, more details on this can be found in the links above. All the text above is intended for seeding, and it will be about
2. Gnuplottex: Integrating Graphs into LaTeX Documents
Gnuplottex is a package included in the TeXlive distribution that allows you to enter Gnuplot commands directly in the layout document. Without being distracted by theorizing, let’s proceed directly to the practice. Create a new document
\documentclass[12pt]{article} % -, , \usepackage[OT1,T2A]{fontenc} \usepackage[utf8]{inputenc} \usepackage[english,russian]{babel} \usepackage{amsmath,amssymb,amsfonts,textcomp,latexsym,pb-diagram,amsopn} \usepackage{cite,enumerate,float,indentfirst} \usepackage{graphicx,xcolor} % , \usepackage[left=2cm, right=2cm, top=2cm, bottom=2cm]{geometry} % Gnuplottex \usepackage{gnuplottex} \begin{document} \section{ Gnuplot \LaTeX} \end{document}
ATTENTION! The document should be assembled with the
-shell-escape switch , which includes the ability to execute shell commands, or so:
$ pdflatex -shell-escape gnuplottex_rus.tex
Or set this key in the IDE settings (I have this Kile):

Now, in the body of the document we will sculpt our schedule:
\begin{figure}[h] \centering \begin{gnuplot} plot x**3 title ' $y = x^3$' \end{gnuplot} \end{figure}
After assembly, getting:

Noticed that there is the most "delicious"? The formula in the caption looks like a human being - all the power of LaTeX is at your complete disposal. Now let's finish this file with a file:
\begin{figure}[h] \centering \begin{gnuplot} set terminal epslatex color size 12cm,15cm set xzeroaxis lt -1 set yzeroaxis lt -1 set style line 1 lt 1 lw 4 lc rgb '#4682b4' pt -1 set grid ytics lc rgb '#555555' lw 1 lt 0 set grid xtics lc rgb '#555555' lw 1 lt 0 set xrange [-3:3] plot x**3 title '$y = x^3$' ls 1 \end{gnuplot} \end{figure}
We especially note the command:
set terminal epslatex color size 12cm,15cm
Specifies the type of terminal: EPS LaTeX with support for color output; and its size is 12 x 15 cm - your drawing is this terminal. As a result, we get

Slightly change the code by adding another line style and graph:
set style line 2 lt 1 lw 4 lc rgb '#aa0000' pt -1 . . . plot x**3 title '$y = x^3$' ls 1, \ x**4 title '$y = x^4$' ls 2

It is seen that there is no fundamental difficulty in using the technology under consideration. You can also add a three-dimensional graph here:
\begin{figure}[h] \centering \begin{gnuplot} set terminal epslatex color size 12cm,12cm splot x**2 + y**3 with lines title '$z = x^2 + y^3$' \end{gnuplot} \caption{ } \end{figure}

Change the display scheme from the grid to the colored polygons:
splot x**2 + y**3 with pm3d title '$z = x^2 + y^3$'

Appearance settings, palette selection - all this can be found in the documentation for Gnuplot, and we move on to the next item on the program.
3. Building graphs from data files
This is the main power of this tool. Suppose you have a text file with data formed as follows:
# x y1 y2 0 0 0 1 1 1 2 4 8 3 9 27 4 16 64
The first column, for example, the argument, the second and third - the values of some functions. This may be the result of a field experiment, or the result of a numerical simulation. Construction of two-dimensional graphics will look like this:
plot '< >' using < >:< > title '<>'
Columns are numbered starting from one. In order not to be bored, I will give an example from my documents. I will create the
results / directory in the folder with this educational project and place there the file with the results of the numerical experiment
2319.log (here it has its own specific naming of logs ...). Then add the following code to our project:
\begin{figure} \centering \begin{gnuplot} set terminal epslatex color size 17cm,8cm set xzeroaxis lt -1 set yzeroaxis lt -1 set xrange [0:20] set style line 1 lt 1 lw 4 lc rgb '#4682b4' pt -1 set style line 2 lt 1 lw 4 lc rgb '#ee0000' pt -1 set style line 3 lt 1 lw 4 lc rgb '#008800' pt -1 set style line 4 lt 1 lw 4 lc rgb '#888800' pt -1 set style line 5 lt 1 lw 4 lc rgb '#00aaaa' pt -1 set style line 6 lt 1 lw 4 lc rgb '#cc0000' pt -1 set grid xtics lc rgb '#555555' lw 1 lt 0 set grid ytics lc rgb '#555555' lw 1 lt 0 set xlabel '$t$, c' set ylabel '$P$, ' set key bottom right plot 'results/2319.log' using 1:3 with lines ls 2 ti '$P_2$', \ 'results/2319.log' using 1:9 with lines ls 4 ti '$P_9$', \ 'results/2319.log' using 1:19 with lines ls 5 ti '$P_{19}$',\ 'results/2319.log' using 1:29 with lines ls 1 ti '$P_{29}$',\ 'results/2319.log' using 1:49 with lines ls 3 ti '$P_{49}$', \ 'results/2319.log' using 1:54 with lines ls 6 ti '$P_{53}$' \end{gnuplot} \caption{ } \end{figure}

Team:
set key bottom right
Places the legend in the lower right corner of the graph so that it does not interfere at the top and the right. In addition, Gnuplot commands and their parameters can be reduced to the degree of unambiguous interpretation of writing, as in this example: ti => title.
Now imagine that you have completed your thesis, but at the last moment you needed to substitute other results of the same measurements. No need to flip charts - replace the result file and rebuild the project. Everything! Your layout is not going anywhere. Five minutes of business, if changing data does not lead to far-reaching scientific conclusions.
And the last thing - if you place a graph on a Beamer slide, the environment of the slide must contain the
fragile option, otherwise a compilation error is waiting for you. Like this:
\begin{frame}[fragile]
Conclusion
The study of the question took me the whole of yesterday evening. The presentation had to be made up at night, but I managed to report successfully today (report on the first year of doctoral studies). In the soul there is a warm feeling of the possibility of open technologies that help in scientific work. Which way to go, everyone chooses for himself. The article is for review only and covers only the questions necessary for a quick start. The rest can be easily gleaned from the documentation.
The document created in the example can be collected
here.Successes in scientific work, and thank you for your attention to mine.