\documentclass[a4paper]{article}
\usepackage[intlimits]{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{ifpdf}
\usepackage{listings}
\usepackage{courier}
\lstset{%
	basicstyle=\ttfamily,
	language=[LaTeX]tex, % Seems as if \lstset{language=tex} must be invoked BEFORE loading tikz!?
	tabsize=4,
	breaklines=true,
	breakindent=0pt
}

\ifpdf
	\usepackage[pdftex]{hyperref}
	\pdfinfo {
		/Author	(Christian Feuersaenger)
	}

\else
	\usepackage[dvipdfm]{hyperref}
	\def\pgfsysdriver{pgfsys-dvipdfm.def}
\fi
%\def\pgfsysdriver{pgfsys-pdftex.def}
\usepackage{pgfplots}

\pgfrealjobname{pgfplotstest}

\def\testsection#1{\message{STARTING TEST SECTION '#1'}\section{#1}}
\def\testsubsection#1{\message{STARTING TEST SUBSECTION '#1'}\subsection{#1}}
\def\testsubsubsection#1{\message{STARTING TEST SUBSUBSECTION '#1'}\subsubsection{#1}}

\def\smallplotstest{%
\addplot[smooth,blue,mark=*] plot coordinates {
	(-1,	1)
	(-0.75,	0.5625)
	(-0.5,	0.25)
	(-0.25,	0.0625)
	(0,		0)
	(0.25,	0.0625)
	(0.5,	0.25)
	(0.75,	0.5625)
	(1,		1)
};
}

\def\loglogtestplot{
\addplot plot coordinates {
	(5,	8.311600e-02)
	(17,	2.546856e-02)
	(49,	7.407153e-03)
	(129,	2.101922e-03)
	(321,	5.873530e-04)
	(769,	1.622699e-04)
	(1793,	4.442489e-05)
	(4097,	1.207141e-05)
	(9217,	3.261015e-06)
};
\addlegendentry{$d=2$}

\addplot plot coordinates {
	(7,	8.471784e-02)
	(31,	3.044093e-02)
	(111,	1.022145e-02)
	(351,	3.303463e-03)
	(1023,	1.038865e-03)
	(2815,	3.196465e-04)
	(7423,	9.657898e-05)
	(18943,	2.873391e-05)
	(47103,	8.437499e-06)
};
\addlegendentry{$d=3$}
}%

\def\manylogplots{%
	\addplot plot coordinates {
		(5,		8.312e-02)
		(17,	2.547e-02)
		(49,	7.407e-03)
		(129,	2.102e-03)
		(321,	5.874e-04)
		(769,	1.623e-04)
		(1793,	4.442e-05)
		(4097,	1.207e-05)
		(9217,	3.261e-06)
	};

	\addplot plot coordinates {
		(7,		8.472e-02)
		(31,	3.044e-02)
		(111,	1.022e-02)
		(351,	3.303e-03)
		(1023,	1.039e-03)
		(2815,	3.196e-04)
		(7423,	9.658e-05)
		(18943,	2.873e-05)
		(47103,	8.437e-06)
	};

	\addplot plot coordinates {
		(9,	7.881e-02)
		(49,	3.243e-02)
		(209,	1.232e-02)
		(769,	4.454e-03)
		(2561,	1.551e-03)
		(7937,	5.236e-04)
		(23297,	1.723e-04)
		(65537,	5.545e-05)
		(178177,	1.751e-05)
	};

	\addplot plot coordinates {
		(11,	6.887e-02)
		(71,	3.177e-02)
		(351,	1.341e-02)
		(1471,	5.334e-03)
		(5503,	2.027e-03)
		(18943,	7.415e-04)
		(61183,	2.628e-04)
		(187903,	9.063e-05)
		(553983,	3.053e-05)
	};

	\addplot plot coordinates {
		(13,	5.755e-02)
		(97,	2.925e-02)
		(545,	1.351e-02)
		(2561,	5.842e-03)
		(10625,	2.397e-03)
		(40193,	9.414e-04)
		(141569,	3.564e-04)
		(471041,	1.308e-04)
		(1496065,	4.670e-05)
	};
	\legend{$d=2$\\$d=3$\\$d=4$\\$d=5$\\$d=6$\\}
}%

\author{Christian Feuers\"anger}
\title{Tests for pgfplots.sty}

\begin{document}
\maketitle

\testsection{Standard placement normal plot}
\begin{tikzpicture}
\begin{axis}
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsection{Scaling tests}
\testsubsection{width=5cm}
\begin{tikzpicture}
\begin{axis}[width=5cm]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{width=textwidth}
\begin{tikzpicture}
\begin{axis}[width=\textwidth]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{width=textwidth, height=textheight}
\begin{tikzpicture}
\begin{axis}[height=\textheight,width=\textwidth]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{height=3cm}
\begin{tikzpicture}
\begin{axis}[height=3cm]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{x=3cm}
\hrule width3cm height1pt
\vskip10pt
\begin{tikzpicture}[baseline]
\begin{axis}[x=3cm]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{x=3cm, y=4cm}
\hrule width3cm height1pt
\noindent
\vrule height4cm width1pt
\hskip10pt
\begin{tikzpicture}[baseline]
\begin{axis}[x=3cm,y=4cm]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{y=3cm}
\noindent
\vrule height3cm width1pt
\hskip10pt
\begin{tikzpicture}[baseline]
\begin{axis}[y=3cm]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{Scale vs. Datascale trafo}
All should have the same size; especially the same height.
This tests the data scale transformation and rounding inaccuracies during the computation of $x$~and~$y$ unit vectors,
\[ x = \frac{W}{T(\bar x) - T(\underline x)}. \]
The larger $x$, the higher the scaling accuracy. Large $x$ means small $T(\bar x) - T(\underline x)$ (relative to width~$W$). But this implies low accuracy for the input data! And nobody wants inaccurate plots.

The datascale transformation~$T$ is set up such that $O(W) = O(x)$, but I am not sure if I need to adjust some parameters. Some parameters lead to inaccurate~$x$ and~$y$ vectors, such that axis sizes are \emph{not} the same although $W$~and~$H$ (width and height) are the same.

\noindent
{\tikzstyle{every picture}+=[baseline]
\axispreset{width=3cm,scale only axis,ytick=\empty}%
\listnew\autoplotspeclist{blue\\}%
\begin{tikzpicture}%
\begin{axis}
\addplot plot coordinates {
	(0.000000,	0.113142)
	(0.062500,	0.114457)
	(0.125000,	0.115773)
	(0.187500,	0.117088)
	(0.250000,	0.118404)
	(0.312500,	0.119719)
	(0.375000,	0.121035)
	(0.437500,	0.122350)
	(0.500000,	0.123666)
	(0.562500,	0.124981)
	(0.625000,	0.126297)
	(0.687500,	0.127612)
	(0.750000,	0.128928)
	(0.812500,	0.130243)
	(0.875000,	0.131559)
	(0.937500,	0.132874)
	(1.000000,	0.134190)
};
\end{axis}
\end{tikzpicture}%
\begin{tikzpicture}%
\begin{axis}
\addplot plot coordinates {
	(0.000000,	0.192392)
	(0.020408,	0.551660)
	(0.040816,	0.816371)
	(0.061224,	0.957528)
	(0.081633,	0.936301)
	(0.102041,	0.784097)
	(0.122449,	0.539922)
	(0.142857,	0.257432)
	(0.163265,	-0.039651)
	(0.183673,	-0.313379)
	(0.204082,	-0.533386)
	(0.224490,	-0.712582)
	(0.244898,	-0.856655)
	(0.265306,	-0.932880)
	(0.285714,	-0.953862)
	(0.306122,	-0.957749)
	(0.326531,	-0.890993)
	(0.346939,	-0.774152)
	(0.367347,	-0.602360)
	(0.387755,	-0.396801)
	(0.408163,	-0.132261)
	(0.428571,	0.161664)
	(0.448980,	0.460018)
	(0.469388,	0.720198)
	(0.489796,	0.880398)
	(0.510204,	0.967384)
	(0.530612,	0.900632)
	(0.551020,	0.729232)
	(0.571429,	0.460479)
	(0.591837,	0.155311)
	(0.612245,	-0.153827)
	(0.632653,	-0.430787)
	(0.653061,	-0.653561)
	(0.673469,	-0.819444)
	(0.693878,	-0.931060)
	(0.714286,	-0.984394)
	(0.734694,	-0.981970)
	(0.755102,	-0.940272)
	(0.775510,	-0.825804)
	(0.795918,	-0.664138)
	(0.816327,	-0.465371)
	(0.836735,	-0.219185)
	(0.857143,	0.070697)
	(0.877551,	0.377456)
	(0.897959,	0.658660)
	(0.918367,	0.853564)
	(0.938776,	0.925472)
	(0.959184,	0.868936)
	(0.979592,	0.629528)
	(1.000000,	0.228732)
};
\end{axis}
\end{tikzpicture}%
\begin{tikzpicture}%
\begin{axis}

\addplot plot coordinates {
	(0.000000,	0.112104)
	(0.062500,	0.098029)
	(0.125000,	0.083954)
	(0.187500,	0.069879)
	(0.250000,	0.055804)
	(0.312500,	0.041729)
	(0.375000,	0.027654)
	(0.437500,	0.013579)
	(0.500000,	-0.000496)
	(0.562500,	-0.014571)
	(0.625000,	-0.028646)
	(0.687500,	-0.042722)
	(0.750000,	-0.056797)
	(0.812500,	-0.070872)
	(0.875000,	-0.084947)
	(0.937500,	-0.099022)
	(1.000000,	-0.113097)
};
\end{axis}
\end{tikzpicture}%
\begin{tikzpicture}%
\begin{axis}
\addplot plot coordinates {
	(0.000000,	-0.963159)
	(0.020408,	-0.781664)
	(0.040816,	-0.488585)
	(0.061224,	-0.137738)
	(0.081633,	0.234861)
	(0.102041,	0.556489)
	(0.122449,	0.791942)
	(0.142857,	0.941856)
	(0.163265,	0.977486)
	(0.183673,	0.930499)
	(0.204082,	0.809581)
	(0.224490,	0.653308)
	(0.244898,	0.474588)
	(0.265306,	0.268631)
	(0.285714,	0.048692)
	(0.306122,	-0.168568)
	(0.326531,	-0.380963)
	(0.346939,	-0.577633)
	(0.367347,	-0.751043)
	(0.387755,	-0.893755)
	(0.408163,	-0.960465)
	(0.428571,	-0.932380)
	(0.448980,	-0.841830)
	(0.469388,	-0.650880)
	(0.489796,	-0.346509)
	(0.510204,	-0.007265)
	(0.530612,	0.329744)
	(0.551020,	0.621489)
	(0.571429,	0.826905)
	(0.591837,	0.947602)
	(0.612245,	0.956706)
	(0.632653,	0.872426)
	(0.653061,	0.724325)
	(0.673469,	0.528915)
	(0.693878,	0.310032)
	(0.714286,	0.081807)
	(0.734694,	-0.143046)
	(0.755102,	-0.363063)
	(0.775510,	-0.559141)
	(0.795918,	-0.733031)
	(0.816327,	-0.880063)
	(0.836735,	-0.959350)
	(0.857143,	-0.968957)
	(0.877551,	-0.885145)
	(0.897959,	-0.702171)
	(0.918367,	-0.410704)
	(0.938776,	-0.035900)
	(0.959184,	0.359062)
	(0.979592,	0.719407)
	(1.000000,	0.940563)
};
\end{axis}
\end{tikzpicture}%
}


\testsection{Tick placement}
\begin{tikzpicture}
\begin{axis}[
	xtick={-1.5,-1,...,1.5},
	ytick={-0.5,0,...,1.5},
	]
\smallplotstest
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[
	xmin=0,xmax=1,
	xtick={-1.5,-1.25,...,1.5}]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{Enlargelimits tests}
\testsubsubsection{enlargelimits=false, x limits provided}
\begin{tikzpicture}
\begin{axis}[%
	enlargelimits=false,
	xmin=0,xmax=1,
	xtick={-1.5,-1.25,...,1.5}]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsubsection{enlargelimits=false, no limits provided}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsubsection{enlargelimits=true, all limits provided $[-1,1]\times [-1,1]$}
\begin{tikzpicture}
\begin{axis}[enlargelimits=true,xmin=-1,xmax=1,ymin=-1,ymax=1]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsubsection{enlargelimits=0.5}
\begin{tikzpicture}
\begin{axis}[enlargelimits=0.5]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{modified labels}

{
\tikzstyle{every axis label}=[]
\tikzstyle{every axis x label}=[
    at={(0.5,1)},
    above,
    yshift=+15pt]
\tikzstyle{every axis y label}=[
    at={(1,0.5)},
    xshift=+35pt,
    rotate=90]

\begin{tikzpicture}
\begin{axis}[
	xlabel=$x$ axis,
	ylabel=$y$ axis,
	xmin=0,xmax=1,
	tickpos=right,
	xtick={-1.5,-1.25,...,1.5}]
\smallplotstest
\end{axis}
\end{tikzpicture}
}

\begin{tikzpicture}
\begin{axis}[
	xlabel=$x$ axis,
	ylabel=$y$ axis,
	xmin=0,xmax=1,
	tickpos=both,
	xtick={-1.5,-1.25,...,1.5}]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsection{Tick label assigment tests}
\testsubsection{Using xticklabel and xtick}
\begin{tikzpicture}
\begin{axis}[
	xtick={-1.5,-1,...,1.5},
	xticklabel={%
		\ifcase\ticknum	$-1\frac12$%
		\or				$-1$%
		\or				$-\frac12$%
		\or				$0$%
		\or				$\frac12$%
		\or				$1$%
		\or				$1\frac12$%
		\else			$\tick$%
		\fi
	}
]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{Using xticklabels}%
\begin{tikzpicture}
\begin{axis}[
	xtick={-1.5,-1,...,1.5},
	xticklabels={%
		$-1\frac 12$,
		$-1$,
		$-\frac 12$,
		$0$,
		$\frac 12$,
		$1$}
]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{With commas}
\begin{tikzpicture}
\begin{axis}[
	xtick={-1.5,-1,...,1.5},
	xticklabels={%
		{-1,5},
		-1,
		{-0,5},
		0,
		{0,5},
		1,
		{1,5}}
]
\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{Using yticklabels in logplot}%
{
\def\tickformat#1{1e#1}%
\begin{tikzpicture}
\begin{loglogaxis}[
	ytick={1e-8,1e-7,1e-6,1e-5,1e-4,1e-3,1e-2,1e-1,1e0,1e1},
	yticklabels={%
		\tickformat{-8},
		\tickformat{-7},
		\tickformat{-6},
		\tickformat{-5},
		\tickformat{-4},
		\tickformat{-3},
		\tickformat{-2},
		\tickformat{-1},
		\tickformat{-0}}
]
\loglogtestplot
\end{loglogaxis}
\end{tikzpicture}
}

\testsection{Default options log plot}
\begin{tikzpicture}
\begin{loglogaxis}
\loglogtestplot
\end{loglogaxis}
\end{tikzpicture}

\testsection{Semilogy plot}
\begin{tikzpicture}
	\begin{semilogyaxis}[xlabel=Index,ylabel=Value]
	\addplot[color=blue,mark=*] plot coordinates {
		(1,8)
		(2,16)
		(3,32)
		(4,64)
		(5,128)
		(6,256)
		(7,512)
	};
	\end{semilogyaxis}
\end{tikzpicture}

\testsection{Semilogx plot}
\begin{tikzpicture}
	\begin{semilogxaxis}[xlabel=Index,ylabel=Value]
	\addplot[color=blue,mark=*] plot coordinates {
		(8,1)
		(16,2)
		(32,3)
		(64,4)
		(128,5)
		(256,6)
		(512,7)
	};
	\end{semilogxaxis}
\end{tikzpicture}

\testsection{Scaling log plots}
\hrule
\nobreak
\vskip10pt
\nobreak
\noindent
\begin{tikzpicture}
\begin{loglogaxis}[width=\textwidth]
\loglogtestplot
\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{loglogaxis}[width=\textwidth,height=\textheight]
\loglogtestplot
\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{loglogaxis}[height=5.5cm]
\loglogtestplot
\end{loglogaxis}
\end{tikzpicture}

\testsection{Tick/Tick-Label placement log plots}
\begin{tikzpicture}
\begin{loglogaxis}[
	xmin=0.99e2,xmax=1e4,
	ytickten={-5,-4,-3.6,-3,-2,-1,0},
	yticklabel={
		\ifnum\ticknum=2	
			$\rightarrow$
		\else
			\axisdefaultticklabellog
		\fi
	}
]
\loglogtestplot
\end{loglogaxis}
\end{tikzpicture}

\testsection{Legends}
\begingroup
\begin{tikzpicture}
\begin{loglogaxis}[title=A test title,xlabel=Dof,ylabel=Error]
\loglogtestplot
\legend{Eins\\Zwei\\}%
\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{loglogaxis}[title=A test title,xlabel=Dof,ylabel=Error,legend columns=2]
\manylogplots
\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{loglogaxis}[title=A test title,xlabel=Dof,ylabel=Error,legend columns=3]
\manylogplots
\end{loglogaxis}
\end{tikzpicture}

{
\tikzstyle{every axis legend}+=[inner sep=0pt,nodes={inner sep=0pt}]
\begin{tikzpicture}
\begin{loglogaxis}[title=A test title,xlabel=Dof,ylabel=Error,legend columns=4]
\manylogplots
\end{loglogaxis}
\end{tikzpicture}
}

{\tikzstyle{every axis legend}+=[at={(0.5,-0.2)},anchor=north]
\begin{tikzpicture}
\begin{loglogaxis}[title=A test title,xlabel=Dof,ylabel=Error,legend columns=6]
\manylogplots
\end{loglogaxis}
\end{tikzpicture}
}%

{\tikzstyle{every axis legend}+=[at={(0.5,0.98)},anchor=north,inner sep=0pt]
\begin{tikzpicture}
\begin{loglogaxis}[title=A test title,xlabel=Dof,ylabel=Error,legend columns=-1]
\manylogplots
\end{loglogaxis}
\end{tikzpicture}
}%

\testsubsection{``legend plot pos'' options}
\begin{tikzpicture}
\begin{loglogaxis}[title=A test title,xlabel=Dof,ylabel=Error,legend plot pos=left]
\manylogplots
\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{loglogaxis}[title=A test title,xlabel=Dof,ylabel=Error,legend plot pos=right]
\manylogplots
\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{loglogaxis}[title=A test title,xlabel=Dof,ylabel=Error,legend plot pos=none]
\manylogplots
\end{loglogaxis}
\end{tikzpicture}
\endgroup

\testsection{Title-option}
\begin{tikzpicture}
\begin{loglogaxis}[title=A test title,xlabel=Dof,ylabel=Error]
\loglogtestplot
\end{loglogaxis}
\end{tikzpicture}

\testsection{Scaling test for very small or very large x values}
\testsubsection{1e-2}
\begin{tikzpicture}
\begin{axis}
	\addplot plot coordinates {
		(0.005,1)
		(0.01,2)
		(0.02,4)
	};
\end{axis}
\end{tikzpicture}

\testsubsection{1e+2}
% \tracingmacros=2\tracingcommands=2
\begin{tikzpicture}
\begin{axis}
	\addplot plot coordinates {
		(50,1)
		(100,2)
		(200,4)
	};
\end{axis}
\end{tikzpicture}
% \tracingmacros=0\tracingcommands=0

\testsubsection{x=1e+11; y=1e-6}
\begin{tikzpicture}
\begin{axis}
	\addplot plot coordinates {
		(5e10,1e-6)
		(1e11,2e-6)
		(2e11,4e-6)
	};
\end{axis}
\end{tikzpicture}

\testsubsection{1e+2}
\begin{tikzpicture}
\begin{axis}
	\addplot plot coordinates {
		(5,1)
		(10,2)
		(20,4)
	};
\end{axis}
\end{tikzpicture}

\testsection{Filter test}
{%
\def\myOwnYfilter#1\to#2{%
	\def#2{0.5}%
}%
\begin{tikzpicture}
\begin{axis}[yfilter={\myOwnYfilter}]
\addplot plot coordinates {
	(4,0)
	(6,1)
};
\end{axis}
\end{tikzpicture}
}%

\testsection{Test for addplot+[...]}
{
\tikzstyle{every axis legend}+=[at={(1.03,1)},anchor=north west]
\begin{enumerate}
	\item Ohne aenderung:

\begin{tikzpicture}
\begin{axis}
\smallplotstest

\addplot plot coordinates {
	(4,0)
	(6,1)
};
\legend{eins\\zwei\\}%
\end{axis}
\end{tikzpicture}

\item MIT aenderung:

\begin{tikzpicture}
\begin{axis}
\smallplotstest

\addplot+[only marks] plot coordinates {
	(4,0)
	(6,1)
};
\legend{eins\\zwei\\}%
\end{axis}
\end{tikzpicture}
\end{enumerate}
}

\testsection{Baseline alignment}
\noindent
\begin{tikzpicture}[baseline]
\begin{axis}[width=0.4\linewidth,xlabel=An x label]
	\smallplotstest
\end{axis}
\end{tikzpicture}
\hspace{1cm}
\begin{tikzpicture}[baseline]
\begin{axis}[width=0.4\linewidth,xlabel={\Huge An x label}]
	\smallplotstest
\end{axis}
\end{tikzpicture}

\testsubsection{Baseline alignment and externalized graphics}
One needs \texttt{\textbackslash beginpgfgraphicnamed} around the complete paragraph, so this here doesn't work (see source code):

\beginpgfgraphicnamed{baselinetesta}
\begin{tikzpicture}[baseline]
\begin{axis}[width=0.4\linewidth,xlabel=An x label]
	\smallplotstest
\end{axis}
\end{tikzpicture}
\endpgfgraphicnamed
%
%
\hspace{1cm}
\beginpgfgraphicnamed{baselinetestb}
\begin{tikzpicture}[baseline]
\begin{axis}[width=0.4\linewidth,xlabel={\Huge An x label}]
	\smallplotstest
\end{axis}
\end{tikzpicture}
\endpgfgraphicnamed

\testsubsection{Baseline alignment and externalized graphics II}
\beginpgfgraphicnamed{baselinetestc}
\begin{tikzpicture}[baseline]
\begin{axis}[width=0.4\linewidth,xlabel=An x label]
	\smallplotstest
\end{axis}
\end{tikzpicture}
%
%
\hspace{1cm}
\begin{tikzpicture}[baseline]
\begin{axis}[width=0.4\linewidth,xlabel={\Huge An x label}]
	\smallplotstest
\end{axis}
\end{tikzpicture}
\endpgfgraphicnamed

\testsubsection{Horizontal and Vertical alignment}
\begin{tikzpicture}[baseline]
\begin{axis}[width=0.4\linewidth,xlabel=An x label,ylabel=An y label]
	\smallplotstest
\end{axis}

\begin{scope}[yshift=-4cm]
\begin{axis}[width=0.4\linewidth,xlabel=An x label,ylabel={$\displaystyle\sum_{k=1}^n \frac 1n$}]
	\smallplotstest
\end{axis}
\end{scope}

\node[fill=yellow,circle] at (0,0) {$(0,0)$};
\end{tikzpicture}
%
%
\hspace{1cm}
\begin{tikzpicture}[baseline]
\begin{axis}[width=0.4\linewidth,xlabel={\Huge An x label}]
	\smallplotstest
\end{axis}

\begin{scope}[yshift=-4cm]
\begin{axis}[width=0.4\linewidth,xlabel={\Huge An x label},ylabel={$\displaystyle\sum_{k=1}^n \frac 1n$}]
	\smallplotstest
\end{axis}
\end{scope}
\node[fill=yellow,circle] at (0,0) {$(0,0)$};
\end{tikzpicture}

\testsection{Scaletest}

{
\listnew{\autoplotspeclist}{%
	red,only marks,mark options={fill=red!80!black},mark=*\\%
	black,only marks,mark options={fill=black},mark=square*\\%
}%
\begin{tikzpicture}
\begin{axis}[%
	width=8cm,
	height=2cm,
	xtick=\empty,
	ytick=\empty
]

\addplot plot coordinates {
	(0.968555,	0.000000)
	(0.984277,	0.000000)
	(0.030884,	0.000000)
	(0.250000,	0.000000)
	(0.750000,	0.000000)
	(0.468750,	0.000000)
	(0.750000,	0.000000)
	(0.484375,	0.000000)
	(0.968555,	0.000000)
	(0.968555,	0.000000)
	(1.000000,	0.000000)
	(1.000000,	0.000000)
	(0.030176,	0.000000)
	(0.250000,	0.000000)
	(0.250000,	0.000000)
	(0.250000,	0.000000)
	(0.750000,	0.000000)
	(1.000000,	0.000000)
	(0.500000,	0.000000)
	(0.500000,	0.000000)
	(0.234375,	0.000000)
	(0.500000,	0.000000)
	(0.750000,	0.000000)
	(0.000000,	0.000000)
	(0.750000,	0.000000)
	(0.468750,	0.000000)
	(0.500000,	0.000000)
	(0.000000,	0.000000)
	(0.468750,	0.000000)
	(0.000000,	0.000000)
	(0.750000,	0.000000)
	(0.000000,	0.000000)
	(0.234375,	0.000000)
	(1.000000,	0.000000)
};
\addplot plot coordinates {
	(0.367188,	0.000000)
	(0.625000,	0.000000)
	(0.312500,	0.000000)
	(0.656250,	0.000000)
	(0.312500,	0.000000)
	(0.148438,	0.000000)
	(0.125000,	0.000000)
	(0.640625,	0.000000)
	(0.136719,	0.000000)
	(0.875000,	0.000000)
	(0.390625,	0.000000)
	(0.828125,	0.000000)
	(0.875000,	0.000000)
	(0.656250,	0.000000)
	(0.125000,	0.000000)
	(0.343750,	0.000000)
	(0.861328,	0.000000)
	(0.312500,	0.000000)
	(0.578125,	0.000000)
	(0.578125,	0.000000)
	(0.625000,	0.000000)
	(0.375000,	0.000000)
	(0.875000,	0.000000)
	(0.812500,	0.000000)
	(0.847656,	0.000000)
	(0.589844,	0.000000)
	(0.343750,	0.000000)
	(0.125000,	0.000000)
	(0.875000,	0.000000)
	(0.125000,	0.000000)
	(0.609375,	0.000000)
	(0.156250,	0.000000)
};
\end{axis}
\end{tikzpicture}
}

\testsection{Anchortest}
{
\def\plot#1{
\vbox{\hsize=5cm
#1:

\begin{tikzpicture}
	\begin{axis}[width=5cm,anchor=#1]
		\smallplotstest
	\end{axis}
	\node[fill=yellow,circle] at (0,0) {$(0,0)$};
\end{tikzpicture}
}
}%
\noindent
\plot{north}
\plot{north west}
\plot{west}
\plot{south west}
\plot{south}
\plot{south east}
\plot{east}
\plot{north east}
\plot{center}
}

\testsection{Hide axis test}
\begin{tikzpicture}
	\begin{axis}
		\smallplotstest
	\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
	\begin{axis}[hide axis]
		\smallplotstest
	\end{axis}
\end{tikzpicture}
\vskip 1cm
\noindent
\begin{tikzpicture}
	\begin{axis}[hide axis,title=A plot with hidden axis]
		\smallplotstest
	\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
	\begin{axis}[hide axis,title=A plot with hidden axis]
		\smallplotstest
		\legend{A legend\\}
	\end{axis}
\end{tikzpicture}

\testsection{Style--test}
{
%\tikzstyle{every axis}=[xmin=-3,xmax=3]
\begin{tikzpicture}
	\begin{axis}
		\smallplotstest
	\end{axis}
\end{tikzpicture}
}

\testsection{Grid lines test}
\begin{tikzpicture}
	\begin{axis}[xmajorgrids]
	\smallplotstest
	\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{axis}[ymajorgrids,xmajorgrids]
	\smallplotstest
	\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{loglogaxis}[ymajorgrids,xmajorgrids]
	\loglogtestplot
	\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{loglogaxis}[grid=both]
	\loglogtestplot
	\end{loglogaxis}
\end{tikzpicture}

{
\tikzstyle{every major tick}+=[color=black,thick]
\begin{tikzpicture}
	\begin{loglogaxis}[grid=major]
	\loglogtestplot
	\end{loglogaxis}
\end{tikzpicture}

\tikzstyle{every minor tick}+=[color=black,thick]
\begin{tikzpicture}
	\begin{loglogaxis}[grid=both]
	\loglogtestplot
	\end{loglogaxis}
\end{tikzpicture}
}

\testsection{Tick lines test}
\begin{tikzpicture}
	\begin{loglogaxis}[xmajorticks=false,xminorticks=true]
	\loglogtestplot
	\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{loglogaxis}[ymajorticks=false,yminorticks=false]
	\loglogtestplot
	\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{loglogaxis}[ticks=none]
	\loglogtestplot
	\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{loglogaxis}[ticks=major]
	\loglogtestplot
	\end{loglogaxis}
\end{tikzpicture}

\testsection{TikZ-coordinate system ``axis''}
\begin{tikzpicture}
\begin{axis}
\smallplotstest
\axispath\draw (axis cs:0.5,0.6) -- (axis cs:-1,0);
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{loglogaxis}
	\axispath\draw 
		(axis cs:18943,2.873391e-05) |- (axis cs:47103,8.437499e-06);
	\loglogtestplot
	\end{loglogaxis}
\end{tikzpicture}
\end{document}
