summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgfplots/test/pgfplotstest/pgfplotstest.file.tex
blob: 423b2c4ee0d51134dd9926ba3cb018d67035b5c6 (plain)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
\testfile{pgfplotstest.file.tex}
{%
\lstset{
	showtabs=true,
	showspaces=true,
	basicstyle=\footnotesize\ttfamily,
	numbers=left,
	numberblanklines=true,
	breaklines=false,
	tabsize=10}
\testsection{`plot file' test}
\testsubsection{A file in gnuplot format 'num num i'}
\lstinputlisting{plotdata/pgfplotstest_plot2.gnuplot}
\begin{tikzpicture}
\begin{axis}
\addplot plot file{plotdata/pgfplotstest_plot2.gnuplot};
\end{axis}
\end{tikzpicture}

\testsubsubsection{Same file loaded with `plot table'}
\begin{tikzpicture}
\begin{axis}
\addplot plot table{plotdata/pgfplotstest_plot2.gnuplot};
\end{axis}
\end{tikzpicture}


\testsubsection{A file which differs slightly from gnuplot format}
\lstinputlisting{plotdata/pgfplotstest_plot4}
\begin{tikzpicture}
\begin{axis}
\addplot plot file{plotdata/pgfplotstest_plot4};
\end{axis}
\end{tikzpicture}

\testsubsection{A file which starts with newlines}
\lstinputlisting{plotdata/pgfplotstest_plot5}
\begin{tikzpicture}
\begin{axis}
\addplot plot file{plotdata/pgfplotstest_plot5};
\end{axis}
\end{tikzpicture}

\testsubsubsection{Same file loaded with `plot table'}
The first data point should have been identified as column name.

\begin{tikzpicture}
\begin{axis}
\addplot plot table{plotdata/pgfplotstest_plot5};
\end{axis}
\end{tikzpicture}

\testsubsubsection{testing space gobbling in 'plot file' command}
\begin{tikzpicture}
\begin{axis}
\addplot plot file {plotdata/pgfplotstest_plot2.gnuplot};
\end{axis}
\end{tikzpicture}

\testsection{`plot table' test}
\begin{sidewaystable}
\lstinputlisting{plotdata/pgfplotstest_plot}
\caption{\texttt{pgfplotstest\_plot}}
\end{sidewaystable}
\testsubsection{Plot by column `dof' versus column `Lmax'}
\begin{tikzpicture}
\begin{loglogaxis}[xlabel=Dof,ylabel=$L_\infty$ error,title=Read from file `pgfplotstest\_plot']
\addplot plot table[x=dof,y=Lmax] {plotdata/pgfplotstest_plot};
\end{loglogaxis}
\end{tikzpicture}

\testsubsection{Plot by column \#2 versus column \#3}
\begin{tikzpicture}
\begin{loglogaxis}[
	xlabel=Dof,
	ylabel=$L_2$ error,
	title=Read from file `pgfplotstest\_plot'
]
\addplot plot table[x index=2,y index=3]{plotdata/pgfplotstest_plot};

\end{loglogaxis}
\end{tikzpicture}

\testsubsection{Plot by preloaded tables}
{
\begin{sidewaystable}
\lstinputlisting{plotdata/pgfplotstest_plot3}
\caption{\texttt{pgfplotstest\_plot3}}
\end{sidewaystable}
\pgfnumtableread{plotdata/pgfplotstest_plot} to \tableA
\pgfnumtableread{plotdata/pgfplotstest_plot3} to \tableB
\begin{tikzpicture}
\begin{loglogaxis}[
	xlabel=Dof,
	ylabel=$L_2$ error,
	title=Read from file `pgfplotstest\_plot' and `pgfplotstest\_plot3'
]
	\addplot plot table[x=dof,y=L2] from \tableA;
	\addplot plot table[x=dof,y=L2] from \tableB;
	\legend{$d=2$\\$d=3$\\}%
\end{loglogaxis}
\end{tikzpicture}
}

\testsubsection{a table which has no column names}
\begin{sidewaystable}
\lstinputlisting{plotdata/pgfplotstest_plotnocolnames}
\caption{\texttt{plotdata/pgfplotstest\_plotnocolnames}}
\end{sidewaystable}
\begin{tikzpicture}
\begin{loglogaxis}[
	xlabel=Dof,
	ylabel=$L_2$ error,
	title=Read from file `pgfplotstest\_plotnocolnames'
]
\addplot plot table[x index=2,y index=3]{plotdata/pgfplotstest_plotnocolnames};

\end{loglogaxis}
\end{tikzpicture}

}