How to do graphics in LaTeX
Very often in a document you want to insert a particular schedule. Today there are many tools allowing you to do with the ability to insert into a LaTeX document among them, Gnuplot, Matplotlib. In this post I would like to highlight another way of creating a plot using pgfplots package. This package is an "add-on"/"Supplement" to the package Tikz(PGF).
Thus, we assume that the packages you already have installed. To include the packages you need in the preamble insert the following code.
Code charts is placed in a special environment:
As the first schedule proposes the creation of graphics for the known points. Let's say we have a small data table that you want to display, the code for the graph in this case would be.
Visually it will look as follows.

As you can see on the chart we have both lines and markers. If we need one then we modify \begin{axis} to the form: \begin{axis}[only marks] \begin{axis}[mark=none].
Now consider the case when we need to place two charts in the same field. Complete the first example the graph of the interpolation of available data.

Pay attention that the presence/absence of the markers, we set not a grid, but separate schedule.
Now consider the case when you want to graph is not in the 10-20 spots, and in much greater quantity. Assume that we have a file with the following structure
Then we will easily be able to build the dependence x(t) with the following code:

In this example, we used two additional variables xmin,xmax. As you can guess by using these variables we set the boundaries of a grid. There are also the commands ymin and ymax.
In conclusion of post I would like to describe the mechanism for the creation of labels and legends. Signatures are created by the xlabel and ylabel commands. They are followed by the signature, which can be mathematical symbols. Legends are created using the commands \addlegendentry{Some-text} command after the schedule.

In the package there are a lot of settings chips. You can read about in the official documentatie.
Article based on information from habrahabr.ru
Thus, we assume that the packages you already have installed. To include the packages you need in the preamble insert the following code.
\usepackage{tikz}
\usepackage{pgfplots}
Code charts is placed in a special environment:
\begin{tikzpicture}
... Code for graphs
\end{tikzpicture}
As the first schedule proposes the creation of graphics for the known points. Let's say we have a small data table that you want to display, the code for the graph in this case would be.
\begin{tikzpicture}
\begin{axis}
\addplot coordinates {
( 338.1, 266.45 )
( 169.1, 143.43 )
( 84.5, 64.80 )
( 42.3, 34.19 )
( 21.1, 9.47 )};
\end{axis}
\end{tikzpicture}
Visually it will look as follows.

As you can see on the chart we have both lines and markers. If we need one then we modify \begin{axis} to the form: \begin{axis}[only marks] \begin{axis}[mark=none].
Now consider the case when we need to place two charts in the same field. Complete the first example the graph of the interpolation of available data.
\begin{tikzpicture}
\begin{axis}
\addplot[only marks] coordinates {
( 338.1, 266.45 )
( 169.1, 143.43 )
( 84.5, 64.80 )
( 42.3, 34.19 )
( 21.1, 9.47 )};
\addplot[mark = none] coordinates {( 350, 279 )
( 0, 0 )};
\end{axis}
\end{tikzpicture}

Pay attention that the presence/absence of the markers, we set not a grid, but separate schedule.
Now consider the case when you want to graph is not in the 10-20 spots, and in much greater quantity. Assume that we have a file with the following structure
t x
0.000000 -0.000000
0.001000 20.326909
0.002000 19.856433
0.003000 8.330376
0.004000 13.982180
0.005000 17.589183
0.006000 19.611675
Then we will easily be able to build the dependence x(t) with the following code:
\begin{tikzpicture}
\begin{axis}[ no markers,
xmin=0, xmax=0.3 ]
\addplot table[x=t,y=x] {foo.dat};
\end{axis}
\end{tikzpicture}

In this example, we used two additional variables xmin,xmax. As you can guess by using these variables we set the boundaries of a grid. There are also the commands ymin and ymax.
In conclusion of post I would like to describe the mechanism for the creation of labels and legends. Signatures are created by the xlabel and ylabel commands. They are followed by the signature, which can be mathematical symbols. Legends are created using the commands \addlegendentry{Some-text} command after the schedule.
\begin{tikzpicture}
\begin{axis}[
ylabel=Data
xlabel=time ]
\addplot[only marks] coordinates {
( 338.1, 266.45 )
( 169.1, 143.43 )
( 84.5, 64.80 )
( 42.3, 34.19 )
( 21.1, 9.47 )};
\addlegendentry{Dots}
\addplot[mark = none] coordinates {( 350, 279 )
( 0, 0 )};
\addlegendentry{Line}
\end{axis}
\end{tikzpicture}

In the package there are a lot of settings chips. You can read about in the official documentatie.