-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalytic_function.tex
87 lines (75 loc) · 1.88 KB
/
analytic_function.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
\documentclass{article}
\usepackage{geometry}
\geometry{
letterpaper,
left=1in,
right=1in,
top=1in,
bottom=1in,
}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,float}
\floatplacement{figure}{H}
\usepackage{hyperref}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.12}
\graphicspath{{./images/}}
\input{math_commands}
% used tikz libraries
\usetikzlibrary{patterns}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usetikzlibrary{intersections}
\usetikzlibrary{trees}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\usetikzlibrary{chains}
\usetikzlibrary{decorations.shapes}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{shapes}
\usetikzlibrary{matrix}
\begin{document}
\begin{figure}[!ht]
\centering
\begin{tikzpicture}
% plot curve for first axis
\begin{axis}[
width=11cm,
height=8cm,
xmin=0, xmax=1,
ylabel={$u_1$ [m/s]},
xlabel={$t^*$},
axis y line=left,
legend style={draw=none}
]
\addplot[mark=o] table[x index=0,y index=1] {data/moy_phase_4hz.dat};
% add label to access plot from first axis
\label{plot_one};
\end{axis}
% plot curves for second axis
\begin{axis}[
width=11cm,
height=8cm,
xmin=0, xmax=1,
ylabel={$u_2$ [m/s]},
xlabel={$t^*$},
axis y line=right,
ylabel style={yshift=-0.5em},
axis x line=none
]
% add the item of the first axis referencing axis !!
\addlegendimage{/pgfplots/refstyle=plot_one}\addlegendentry{$u_1$: Piston, 4~Hz}
% then we use add plot for curves on second axis
\addplot[color=red,mark=x] table[x index=0,y index=1] {data/moy_phase_34hz.dat};
\addplot[domain=0:1,dashed,thick]{0.030759*sin(deg(2*pi*x)-7)+0.730899065};
% that we also create legend entry
\addlegendentry{$u_2$: P.-à-f., 34~Hz}
\addlegendentry{Fonction sinus}
\end{axis}
\end{tikzpicture}
\caption{Two axis from different file using one combined legend}
\end{figure}
\end{document}