Debian Codegraph @

texmf-dist/doc/latex/pgfplots/pgfplotsexample.tex

raw
1
2 \documentclass[a4paper]{article}
3
4 % for dvipdfm:
5 %\def\pgfsysdriver{pgfsys-dvipdfm.def}
6 \usepackage{pgfplots}
7 \pgfplotsset{compat=1.8}% <-- moves axis labels near ticklabels (respects tick label widths)
8
9 \begin{document}
10 \begin{figure}
11 \centering
12 \begin{tikzpicture}
13 \begin{loglogaxis}
14 \addplot coordinates {
15 (1,1)
16 (16,16)
17 (32,64)
18 };
19 \end{loglogaxis}
20 \end{tikzpicture}
21 \caption{A small example}
22 \end{figure}
23
24 \begin{figure}
25 \centering
26 \begin{tikzpicture}
27 \begin{loglogaxis}[
28 xlabel=Cost,
29 ylabel=Error]
30 \addplot coordinates {
31 (5, 8.31160034e-02)
32 (17, 2.54685628e-02)
33 (49, 7.40715288e-03)
34 (129, 2.10192154e-03)
35 (321, 5.87352989e-04)
36 (769, 1.62269942e-04)
37 (1793, 4.44248889e-05)
38 (4097, 1.20714122e-05)
39 (9217, 3.26101452e-06)
40 };
41 \addplot coordinates {
42 (7, 8.47178381e-02)
43 (31, 3.04409349e-02)
44 (111, 1.02214539e-02)
45 (351, 3.30346265e-03)
46 (1023, 1.03886535e-03)
47 (2815, 3.19646457e-04)
48 (7423, 9.65789766e-05)
49 (18943, 2.87339125e-05)
50 (47103, 8.43749881e-06)
51 };
52 \legend{Case 1,Case 2}
53 \end{loglogaxis}
54 \end{tikzpicture}
55 \caption{A larger example}
56 \end{figure}
57
58 \end{document}