diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgfplots/test/pgfplotstest/pgfplotstest.scaling.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgfplots/test/pgfplotstest/pgfplotstest.scaling.tex | 478 |
1 files changed, 478 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/pgfplots/test/pgfplotstest/pgfplotstest.scaling.tex b/Master/texmf-dist/doc/generic/pgfplots/test/pgfplotstest/pgfplotstest.scaling.tex new file mode 100644 index 00000000000..d52d8024dab --- /dev/null +++ b/Master/texmf-dist/doc/generic/pgfplots/test/pgfplotstest/pgfplotstest.scaling.tex @@ -0,0 +1,478 @@ +\testfile{pgfplotstest.scaling.tex} +\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=linewidth} +\begin{tikzpicture} +\begin{axis}[width=\linewidth] +\smallplotstest +\end{axis} +\end{tikzpicture} + +\testsubsection{width=linewidth, height=textheight} +\begin{tikzpicture} +\begin{axis}[height=\textheight,width=\linewidth] +\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 +{\pgfplotsset{every picture/.append style={baseline}} +\pgfplotsset{every axis/.append style={width=3cm,scale only axis,ytick=\empty,cycle list=blue}}% +\def\TESTPLOTS{% +\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}% +}% +\TESTPLOTS + +once more again without `scale only axis': +\pgfplotsset{every axis/.append style={scale only axis=false}}% + +\TESTPLOTS +} + +\testsubsection{Testing numeric artefacts around tick position `0'} +{\pgfplotsset{every axis/.append style={scaled ticks=false}} +[scaled ticks=false] in this subsection + +\begin{tikzpicture} +\begin{axis} + \addplot coordinates { + (-4.5,-8) + (16,12) + }; +\end{axis} +\end{tikzpicture} + +\begin{tikzpicture} +\begin{axis} + \addplot coordinates { + (-0.7,-8) + (1.3,12) + }; +\end{axis} +\end{tikzpicture} + +\begin{tikzpicture} +\begin{axis} + \addplot coordinates { + (-7000,-0.0008) + (13000,0.0012) + }; +\end{axis} +\end{tikzpicture} +} + +\testsection{Scaling log plots} +\hrule +\nobreak +\vskip10pt +\nobreak +\noindent +\begin{tikzpicture} +\begin{loglogaxis}[width=\linewidth] +\loglogtestplot +\end{loglogaxis} +\end{tikzpicture} + +\begin{tikzpicture} +\begin{loglogaxis}[width=\linewidth,height=\textheight] +\loglogtestplot +\end{loglogaxis} +\end{tikzpicture} + +\begin{tikzpicture} +\begin{loglogaxis}[height=5.5cm] +\loglogtestplot +\end{loglogaxis} +\end{tikzpicture} + +\testsection{Scaletest} + +{ +\pgfplotsset{every axis/.append style={cycle list={% + 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{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} +{ +%\pgfplotsset{every x tick label/.append style={font=\Huge}} +%\pgfplotsset{every x tick scale label/.append style={anchor=base}} +\begin{tikzpicture} +\begin{axis} + \addplot plot coordinates { + (5e10,1e-6) + (1e11,2e-6) + (2e11,4e-6) + }; +\end{axis} +\end{tikzpicture} +} + +\testsubsection{1e+1} +\begin{tikzpicture} +\begin{axis} + \addplot plot coordinates { + (5,1) + (10,2) + (20,4) + }; +\end{axis} +\end{tikzpicture} + +\testsubsection{1e+3} +\begin{tikzpicture} +\begin{axis} + \addplot plot coordinates { + (0.5,1e3) + (10,2e3) + (200,4e3) + }; +\end{axis} +\end{tikzpicture} + +\testsubsection{1e+4} +\begin{tikzpicture} +\begin{axis} + \addplot plot coordinates { + (0.1,2e4) + (0.2,4e4) + (0.5,1e4) + }; +\end{axis} +\end{tikzpicture} + +\testsubsection{1e-2, 1e+4} +\begin{tikzpicture} +\begin{axis} + \addplot plot coordinates { + (0.01,2e4) + (0.02,4e4) + (0.05,1e4) + }; +\end{axis} +\end{tikzpicture} +} |