diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex | 6136 |
1 files changed, 2549 insertions, 3587 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex index 53b602b0d9a..03b56e28bdc 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex @@ -24,21 +24,35 @@ % %-------------------------------------------- -\input pgfplotsutil.code.tex +\edef\pgfplots@oldcatcodesemicolon{\the\catcode`\;}% +\catcode`\;=12 + +\input pgfplotscore.code.tex \input pgfplotsoldpgfsupp_loader.code.tex +\input pgfplotsutil.code.tex +\input pgfplotscolormap.code.tex \input pgfplots.stackedplots.code.tex +\input pgfplotscoordprocessing.code.tex +\input pgfplotsticks.code.tex + \usetikzlibrary{decorations,decorations.pathmorphing,decorations.pathreplacing} % FIXME: reduce number of variables! +\newif\ifpgfplots@bb@isactive \newif\ifpgfplots@xislinear \newif\ifpgfplots@yislinear +\newif\ifpgfplots@zislinear +\newif\ifpgfplots@axis@equal +\newif\ifpgfplots@axis@equal@image \newcount\pgfplots@numplots -\newdimen\pgfplots@xcoordminTEX -\newdimen\pgfplots@xcoordmaxTEX -\newdimen\pgfplots@ycoordminTEX -\newdimen\pgfplots@ycoordmaxTEX +\newdimen\pgfplots@xmin@reg +\newdimen\pgfplots@xmax@reg +\newdimen\pgfplots@ymin@reg +\newdimen\pgfplots@ymax@reg +\newdimen\pgfplots@zmin@reg +\newdimen\pgfplots@zmax@reg \newif\ifpgfplots@warn@for@filter@discards \newif\ifpgfplots@isuniformtick \newif\ifpgfplots@clip@limits @@ -46,40 +60,50 @@ \newif\ifpgfplots@enlargelimits@rel@thresh \newif\ifpgfplots@enlargelimits@auto \newif\ifpgfplots@tickshow +\newif\ifpgfplots@scatterplotenabled \newif\ifpgfplots@xminorticks \newif\ifpgfplots@xmajorticks \newif\ifpgfplots@yminorticks \newif\ifpgfplots@ymajorticks +\newif\ifpgfplots@zminorticks +\newif\ifpgfplots@zmajorticks \newif\ifpgfplots@xminorgrids \newif\ifpgfplots@xmajorgrids \newif\ifpgfplots@yminorgrids \newif\ifpgfplots@ymajorgrids +\newif\ifpgfplots@zminorgrids +\newif\ifpgfplots@zmajorgrids \newif\ifpgfplots@clip@marker@paths \newif\ifpgfplots@axis@on@top \newif\ifpgfplots@separate@axis@lines -\newif\ifpgfplots@scaled@ticks@x -\newif\ifpgfplots@scaled@ticks@y \newif\ifpgfplots@identify@log@minor@tick@pos -\newif\ifpgfplots@disablelogfilter +\newif\ifpgfplots@disablelogfilter@x +\newif\ifpgfplots@disablelogfilter@y +\newif\ifpgfplots@disablelogfilter@z \newif\ifpgfplots@disabledatascaling \newif\ifpgfplots@hide@x \newif\ifpgfplots@hide@y +\newif\ifpgfplots@hide@z \newif\ifpgfplots@is@old@list@format \newif\ifpgfplots@errorbars@enabled \newif\ifpgfplots@scale@only@axis \newif\ifpgfplots@xticklabel@interval \newif\ifpgfplots@yticklabel@interval -\newif\ifpgfplots@stacked@x +\newif\ifpgfplots@zticklabel@interval \newif\ifpgfplots@stackedmode \newif\ifpgfplots@stacked@reverse \newif\ifpgfplots@stacked@plus \newif\ifpgfplots@plot@file@skipfirst +\newif\ifpgfplots@threedim +\newif\ifpgfplots@curplot@isirrelevant +\newif\ifpgfplots@perpointmeta@usesfloat \let\pgfnodepartimagebox=\pgfnodeparttextbox \newif\ifpgfplots@collect@firstplot@astick \def\pgfplots@errorbars@xdirection{0}% pre-init, see below \def\pgfplots@errorbars@ydirection{0}% +\def\pgfplots@errorbars@zdirection{0}% \def\axisdefaultwidth{240pt} \def\axisdefaultheight{207pt} @@ -93,9 +117,9 @@ % #2: the list entries. You can use either a comma-separated list or % a '\\'-terminated list. The latter case also requires '\\' % AFTER the last entry. -\def\pgfcreateplotcyclelist#1#2{\pgfplots@assign@list#1{#2}} +\def\pgfplotscreateplotcyclelist#1#2{\expandafter\pgfplots@assign@list\csname pgfp@cyclist@\string#1@\endcsname{#2}} -\pgfcreateplotcyclelist{\blackwhiteplotspeclist}{% +\pgfplotscreateplotcyclelist{black white}{% every mark/.append style={fill=gray},mark=*\\% every mark/.append style={fill=gray},mark=square*\\% every mark/.append style={fill=gray},mark=otimes*\\% @@ -107,7 +131,8 @@ densely dashed,every mark/.append style={solid},mark=star\\% densely dashed,every mark/.append style={solid,fill=gray},mark=diamond*\\% } -\pgfcreateplotcyclelist{\coloredplotspeclist}{% + +\pgfplotscreateplotcyclelist{color}{% blue,every mark/.append style={fill=blue!80!black},mark=*\\% red,every mark/.append style={fill=red!80!black},mark=square*\\% brown!60!black,every mark/.append style={fill=brown!80!black},mark=otimes*\\% @@ -119,6 +144,25 @@ blue,densely dashed,mark=star,every mark/.append style=solid\\% red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=diamond*\\% } +\pgfplotscreateplotcyclelist{exotic}{% + teal,every mark/.append style={fill=teal!80!black},mark=*\\% + orange,every mark/.append style={fill=orange!80!black},mark=square*\\% + cyan!60!black,every mark/.append style={fill=cyan!80!black},mark=otimes*\\% + red!70!white,mark=star\\% + lime!80!black,every mark/.append style={fill=lime},mark=diamond*\\% + red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=*\\% + yellow!60!black,densely dashed,every mark/.append style={solid,fill=yellow!80!black},mark=square*\\% + black,every mark/.append style={solid,fill=gray},mark=otimes*\\% + blue,densely dashed,mark=star,every mark/.append style=solid\\% + red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=diamond*\\% +} + + +% backwards compatibility: +\let\pgfcreateplotcyclelist=\pgfplotscreateplotcyclelist +\pgfplots@letcsname{pgfp@cyclist@\string\blackwhiteplotspeclist @}={pgfp@cyclist@black white@}% +\pgfplots@letcsname{pgfp@cyclist@\string\coloredplotspeclist @}={pgfp@cyclist@color@}% +%%%% \def\pgfplotsset#{\pgfqkeys{/pgfplots}} @@ -137,6 +181,43 @@ }{}% }% +\def\pgfplots@scaled@ticks@setargs#1#2{% + \pgfutil@in@{:}{#2}% + \ifpgfutil@in@ + \pgfplots@scaled@ticks@setargs@{#1}#2\pgfplots@EOI + \else + \expandafter\pgfutil@in@\expandafter{\pgfplots@activecolon}{#2}% + \ifpgfutil@in@ + \pgfplots@scaled@ticks@setargs@active{#1}#2\pgfplots@EOI + \else + \pgfkeysalso{/pgfplots/scaled #1 ticks/#2}% + \fi + \fi +}% +\def\pgfplots@scaled@ticks@setargs@#1#2:#3\pgfplots@EOI{% + \pgfkeysalso{/pgfplots/scaled #1 ticks/#2=#3}% +} + +{ + \catcode`\:=\active + \gdef\pgfplots@scaled@ticks@setargs@active#1#2:#3\pgfplots@EOI{% + \pgfkeysalso{/pgfplots/scaled #1 ticks/#2=#3}% + } +} + +% does the work for '[xyz]ticklabel pos'. +% #1 : one of [xyz] +% #2 : an axis line spec. +\def\pgfplots@setticklabelpos@for#1#2{% + \pgfkeysifdefined{/pgfplots/#1ticklabel pos/#2/.@cmd}{% + \pgfkeysvalueof{/pgfplots/#1ticklabel pos/#2/.@cmd}\pgfeov + }{% + \expandafter\def\csname pgfplots@#1ticklabelaxisspec\endcsname{#2}% + }% +}% + + + \pgfkeys{% /pgfplots/search path for tikz/.unknown/.code={% \let\searchname=\pgfkeyscurrentname% @@ -174,6 +255,7 @@ /pgfplots/every axis plot/.belongs to family=/pgfplots/style commands, /pgfplots/every axis plot post/.style={}, /pgfplots/every axis plot post/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis plot}}, + /pgfplots/no markers/.style={/pgfplots/every axis plot post/.append style={mark=none}}, /pgfplots/every axis label/.style={}, /pgfplots/every axis label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis label}}, /pgfplots/every axis label/.belongs to family=/pgfplots/style commands, @@ -183,6 +265,9 @@ /pgfplots/every axis y label/.style={at={(0,0.5)},xshift=-35pt,rotate=90}, /pgfplots/every axis y label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis y label}}, /pgfplots/every axis y label/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis z label/.style={at={(0,0.5)},xshift=-35pt,rotate=90}, + /pgfplots/every axis z label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis z label}}, + /pgfplots/every axis z label/.belongs to family=/pgfplots/style commands, /pgfplots/every axis title/.style={at={(0.5,1)},above,yshift=6pt}, /pgfplots/every axis title/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis title}}, /pgfplots/every axis title/.belongs to family=/pgfplots/style commands, @@ -191,8 +276,10 @@ /pgfplots/every tick/.belongs to family=/pgfplots/style commands, /pgfplots/every inner x axis line/.style={}, /pgfplots/every inner y axis line/.style={}, + /pgfplots/every inner z axis line/.style={}, /pgfplots/every outer x axis line/.style={}, /pgfplots/every outer y axis line/.style={}, + /pgfplots/every outer z axis line/.style={}, /pgfplots/x axis line style/.style={ /pgfplots/every outer x axis line/.append style={#1}, /pgfplots/every inner x axis line/.append style={#1}, @@ -201,13 +288,19 @@ /pgfplots/every outer y axis line/.append style={#1}, /pgfplots/every inner y axis line/.append style={#1}, }, + /pgfplots/z axis line style/.style={ + /pgfplots/every outer z axis line/.append style={#1}, + /pgfplots/every inner z axis line/.append style={#1}, + }, /pgfplots/outer axis line style/.style={ /pgfplots/every outer x axis line/.append style={#1}, /pgfplots/every outer y axis line/.append style={#1}% + /pgfplots/every outer z axis line/.append style={#1}% }, /pgfplots/inner axis line style/.style={ /pgfplots/every inner x axis line/.append style={#1}, /pgfplots/every inner y axis line/.append style={#1}% + /pgfplots/every inner z axis line/.append style={#1}% }, /pgfplots/axis line style/.style={ /pgfplots/inner axis line style={#1}, @@ -239,6 +332,15 @@ /pgfplots/every major y tick/.style={}, /pgfplots/every major y tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major y tick}}, /pgfplots/every major y tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every z tick/.style={}, + /pgfplots/every z tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every z tick}}, + /pgfplots/every z tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every minor z tick/.style={}, + /pgfplots/every minor z tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor z tick}}, + /pgfplots/every minor z tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every major z tick/.style={}, + /pgfplots/every major z tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major z tick}}, + /pgfplots/every major z tick/.belongs to family=/pgfplots/style commands, %/pgfplots/every axis grid/.style={help lines}, /pgfplots/every axis grid/.style={thin,black!25}, /pgfplots/every axis grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis grid}}, @@ -267,6 +369,15 @@ /pgfplots/every major y grid/.style={}, /pgfplots/every major y grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major y grid}}, /pgfplots/every major y grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis z grid/.style={}, + /pgfplots/every axis z grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis z grid}}, + /pgfplots/every axis z grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every minor z grid/.style={}, + /pgfplots/every minor z grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor z grid}}, + /pgfplots/every minor z grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every major z grid/.style={}, + /pgfplots/every major z grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major z grid}}, + /pgfplots/every major z grid/.belongs to family=/pgfplots/style commands, /pgfplots/every tick label/.style={}, /pgfplots/every tick label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every tick label}}, /pgfplots/every tick label/.belongs to family=/pgfplots/style commands, @@ -300,6 +411,21 @@ /pgfplots/every y tick scale label/.style={at={(0,1)},above right,inner sep=0pt,yshift=0.3em}, /pgfplots/every y tick scale label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every y tick scale label}}, /pgfplots/every y tick scale label/.belongs to family=/pgfplots/style commands, + /pgfplots/every z tick label/.style={}, + /pgfplots/every z tick label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every z tick label}}, + /pgfplots/every z tick label/.belongs to family=/pgfplots/style commands, + /pgfplots/every extra z tick/.style={ + /pgfplots/log identify minor tick positions=true, + }, + /pgfplots/every extra z tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every extra z tick}}, + /pgfplots/every extra z tick/.belongs to family=/pgfplots/style commands, + /pgfplots/extra z tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/extra z tick style/.code={% + \pgfkeysalso{/pgfplots/every extra z tick/.append style={#1}}% + }, + /pgfplots/every z tick scale label/.style={at={(0,1)},above right,inner sep=0pt,yshift=0.3em}, + /pgfplots/every z tick scale label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every z tick scale label}}, + /pgfplots/every z tick scale label/.belongs to family=/pgfplots/style commands, /pgfplots/every axis legend/.style={% cells={anchor=center}, inner xsep=3pt,inner ysep=2pt,nodes={inner sep=2pt,text depth=0.15em}, @@ -328,12 +454,23 @@ /pgfplots/yticklabel/.store in= \pgfplots@yticklabel, /pgfplots/yticklabel/.belongs to family=/pgfplots/tick, /pgfplots/yticklabel=, + /pgfplots/zticklabels/.belongs to family=/pgfplots/tick, + /pgfplots/zticklabels/.code={% + \pgfplots@foreach@to@list{#1}\to\pgfplots@zticklabels + \let\pgfplots@zticklabel=\pgfplots@user@ticklabel@list@z + }, + /pgfplots/zticklabel/.store in= \pgfplots@zticklabel, + /pgfplots/zticklabel/.belongs to family=/pgfplots/tick, + /pgfplots/zticklabel=, /pgfplots/x tick label as interval/.is if=pgfplots@xticklabel@interval, /pgfplots/x tick label as interval/.default=true, /pgfplots/x tick label as interval/.belongs to family=/pgfplots/tick, /pgfplots/y tick label as interval/.is if=pgfplots@yticklabel@interval, /pgfplots/y tick label as interval/.default=true, /pgfplots/y tick label as interval/.belongs to family=/pgfplots/tick, + /pgfplots/z tick label as interval/.is if=pgfplots@zticklabel@interval, + /pgfplots/z tick label as interval/.default=true, + /pgfplots/z tick label as interval/.belongs to family=/pgfplots/tick, /pgfplots/extra x tick label/.store in= \pgfplots@extra@xticklabel, /pgfplots/extra x tick label/.belongs to family=/pgfplots/tick, /pgfplots/extra x tick label=, @@ -346,6 +483,10 @@ \pgfplots@foreach@to@list{#1}\to\pgfplots@extra@yticklabels \let\pgfplots@extra@yticklabel=\pgfplots@user@extra@ticklabel@list@y }, + /pgfplots/extra z tick labels/.code={% + \pgfplots@foreach@to@list{#1}\to\pgfplots@extra@zticklabels + \let\pgfplots@extra@zticklabel=\pgfplots@user@extra@ticklabel@list@z + }, /pgfplots/xtick/.store in= \pgfplots@xtick, /pgfplots/xtick/.belongs to family=/pgfplots/tick, /pgfplots/xtick=, @@ -367,17 +508,70 @@ /pgfplots/ytickten/.store in= \pgfplots@ytickten, /pgfplots/ytickten/.belongs to family=/pgfplots/tick, /pgfplots/ytickten=, - /pgfplots/tick scale label code/.code={$\cdot 10^{#1}$}, - /pgfplots/tick scale label code/.belongs to family=/pgfplots/tick, - /pgfplots/scaled x ticks/.is if=pgfplots@scaled@ticks@x, + /pgfplots/extra z tick label/.store in= \pgfplots@extra@zticklabel, + /pgfplots/extra z tick label/.belongs to family=/pgfplots/tick, + /pgfplots/extra z tick label=, + /pgfplots/ztick/.store in= \pgfplots@ztick, + /pgfplots/ztick/.belongs to family=/pgfplots/tick, + /pgfplots/ztick=, + /pgfplots/extra z ticks/.store in=\pgfplots@extra@ztick, + /pgfplots/extra z ticks/.belongs to family=/pgfplots/tick, + /pgfplots/extra z ticks=, + /pgfplots/ztickten/.store in= \pgfplots@ztickten, + /pgfplots/ztickten/.belongs to family=/pgfplots/tick, + /pgfplots/ztickten=, + /pgfplots/xtick scale label code/.code={$\cdot 10^{#1}$}, + /pgfplots/xtick scale label code/.belongs to family=/pgfplots/tick, + /pgfplots/ytick scale label code/.code={$\cdot 10^{#1}$}, + /pgfplots/ytick scale label code/.belongs to family=/pgfplots/tick, + /pgfplots/ztick scale label code/.code={$\cdot 10^{#1}$}, + /pgfplots/ztick scale label code/.belongs to family=/pgfplots/tick, + /pgfplots/tick scale label code/.style={% + /pgfplots/xtick scale label code={#1}, + /pgfplots/ytick scale label code={#1}% + /pgfplots/ztick scale label code={#1}% + },% + /pgfplots/scaled x ticks/.code={\pgfplots@scaled@ticks@setargs{x}{#1}}, + /pgfplots/scaled x ticks/false/.code= {\def\pgfplots@scaled@ticks@x@choice{0}}, + /pgfplots/scaled x ticks/true/.code= {\def\pgfplots@scaled@ticks@x@choice{1}}, + /pgfplots/scaled x ticks/base 10/.code= {\def\pgfplots@scaled@ticks@x@choice{2}\def\pgfplots@scaled@ticks@x@arg{#1}}, + /pgfplots/scaled x ticks/real/.code= {% + \def\pgfplots@scaled@ticks@x@choice{3}\def\pgfplots@scaled@ticks@x@arg{#1}% + \pgfkeys{/pgfplots/xtick scale label code/.code={$\cdot \pgfmathprintnumber{#1}$}}}, + /pgfplots/scaled x ticks/manual/.code 2 args= {% + \def\pgfplots@scaled@ticks@x@choice{4}\def\pgfplots@scaled@ticks@x@arg##1{#2}% + \pgfkeys{/pgfplots/xtick scale label code/.code={#1}}}, /pgfplots/scaled x ticks/.belongs to family=/pgfplots/tick, /pgfplots/scaled x ticks=true, - /pgfplots/scaled y ticks/.is if=pgfplots@scaled@ticks@y, + /pgfplots/scaled y ticks/.code={\pgfplots@scaled@ticks@setargs{y}{#1}}, + /pgfplots/scaled y ticks/false/.code= {\def\pgfplots@scaled@ticks@y@choice{0}}, + /pgfplots/scaled y ticks/true/.code= {\def\pgfplots@scaled@ticks@y@choice{1}}, + /pgfplots/scaled y ticks/base 10/.code= {\def\pgfplots@scaled@ticks@y@choice{2}\def\pgfplots@scaled@ticks@y@arg{#1}}, + /pgfplots/scaled y ticks/real/.code= {% + \def\pgfplots@scaled@ticks@y@choice{3}\def\pgfplots@scaled@ticks@y@arg{#1}% + \pgfkeys{/pgfplots/ytick scale label code/.code={$\cdot \pgfmathprintnumber{#1}$}}}, + /pgfplots/scaled y ticks/manual/.code 2 args= {% + \def\pgfplots@scaled@ticks@y@choice{4}\def\pgfplots@scaled@ticks@y@arg##1{#2}% + \pgfkeys{/pgfplots/ytick scale label code/.code={#1}}}, /pgfplots/scaled y ticks/.belongs to family=/pgfplots/tick, /pgfplots/scaled y ticks=true, + /pgfplots/scaled z ticks/.code={\pgfplots@scaled@ticks@setargs{z}{#1}}, + /pgfplots/scaled z ticks/false/.code= {\def\pgfplots@scaled@ticks@z@choice{0}}, + /pgfplots/scaled z ticks/true/.code= {\def\pgfplots@scaled@ticks@z@choice{1}}, + /pgfplots/scaled z ticks/base 10/.code= {\def\pgfplots@scaled@ticks@z@choice{2}\def\pgfplots@scaled@ticks@z@arg{#1}}, + /pgfplots/scaled z ticks/real/.code= {% + \def\pgfplots@scaled@ticks@z@choice{3}\def\pgfplots@scaled@ticks@z@arg{#1}% + \pgfkeys{/pgfplots/ztick scale label code/.code={$\cdot \pgfmathprintnumber{#1}$}}}, + /pgfplots/scaled z ticks/manual/.code 2 args= {% + \def\pgfplots@scaled@ticks@z@choice{4}\def\pgfplots@scaled@ticks@z@arg##1{#2}% + \pgfkeys{/pgfplots/ztick scale label code/.code={#1}}}, + /pgfplots/scaled z ticks/.belongs to family=/pgfplots/tick, + /pgfplots/scaled z ticks=true, /pgfplots/scaled ticks/.style={% /pgfplots/scaled x ticks=#1, - /pgfplots/scaled y ticks=#1}, + /pgfplots/scaled y ticks=#1, + /pgfplots/scaled z ticks=#1 + }, /pgfplots/scale ticks above exponent/.store in= \pgfplots@scale@ticks@above@exponent, /pgfplots/scale ticks above exponent/.belongs to family=/pgfplots/tick, /pgfplots/scale ticks above exponent=3, @@ -394,7 +588,13 @@ /pgfplots/minor x tick num/.belongs to family=/pgfplots/tick, /pgfplots/minor y tick num/.initial=0, /pgfplots/minor y tick num/.belongs to family=/pgfplots/tick, - /pgfplots/minor tick num/.style={/pgfplots/minor x tick num=#1,/pgfplots/minor y tick num=#1}, + /pgfplots/minor z tick num/.initial=0, + /pgfplots/minor z tick num/.belongs to family=/pgfplots/tick, + /pgfplots/minor tick num/.style={ + /pgfplots/minor x tick num=#1, + /pgfplots/minor y tick num=#1, + /pgfplots/minor z tick num=#1, + }, /pgfplots/minor tick num/.belongs to family=/pgfplots/tick, /pgfplots/minor tick length/.estore in=\pgfplots@subtickwidth, /pgfplots/minor tick length/.belongs to family=/pgfplots/tick, @@ -451,30 +651,60 @@ /pgfplots/ytick pos/top/.style={/pgfplots/ytick pos/right}, /pgfplots/ytick pos/bottom/.style={/pgfplots/ytick pos/left}, /pgfplots/ytick pos=both, - /pgfplots/tickpos/.style={/pgfplots/xtick pos={#1},/pgfplots/ytick pos={#1}}, + /pgfplots/ztick pos/.is choice, + /pgfplots/ztick pos/.belongs to family=/pgfplots/tick, + /pgfplots/ztick pos/left/.code ={\def\pgfplots@ztickposnum{1}}, + /pgfplots/ztick pos/left/.belongs to family=/pgfplots/tick, + /pgfplots/ztick pos/right/.code ={\def\pgfplots@ztickposnum{3}}, + /pgfplots/ztick pos/right/.belongs to family=/pgfplots/tick, + /pgfplots/ztick pos/both/.code ={\def\pgfplots@ztickposnum{0}}, + /pgfplots/ztick pos/both/.belongs to family=/pgfplots/tick, + /pgfplots/ztick pos/top/.style={/pgfplots/ztick pos/right}, + /pgfplots/ztick pos/bottom/.style={/pgfplots/ztick pos/left}, + /pgfplots/ztick pos=both, + /pgfplots/tickpos/.style={ + /pgfplots/xtick pos={#1}, + /pgfplots/ytick pos={#1}, + /pgfplots/ztick pos={#1} + }, /pgfplots/tickpos/.belongs to family=/pgfplots/tick, -% sets the tick LABEL position, \pgfplots@[xy]ticklabelposnum - /pgfplots/xticklabel pos/.is choice, +% sets the tick LABEL position, \pgfplots@[xy]ticklabelaxisspec +% to one of +% default : 0 +% left : 1 +% right : 3 + /pgfplots/xticklabel pos/.code={\pgfplots@setticklabelpos@for x{#1}}, /pgfplots/xticklabel pos/.belongs to family=/pgfplots/tick, - /pgfplots/xticklabel pos/default/.code ={\def\pgfplots@xticklabelposnum{0}}, + /pgfplots/xticklabel pos/default/.code ={\def\pgfplots@xticklabelaxisspec{}}, /pgfplots/xticklabel pos/default/.belongs to family=/pgfplots/tick, - /pgfplots/xticklabel pos/left/.code ={\def\pgfplots@xticklabelposnum{1}}, + /pgfplots/xticklabel pos/left/.code ={\def\pgfplots@xticklabelaxisspec{v00}}, /pgfplots/xticklabel pos/left/.belongs to family=/pgfplots/tick, - /pgfplots/xticklabel pos/right/.code ={\def\pgfplots@xticklabelposnum{3}}, + /pgfplots/xticklabel pos/right/.code ={\def\pgfplots@xticklabelaxisspec{v10}}, /pgfplots/xticklabel pos/right/.belongs to family=/pgfplots/tick, + /pgfplots/xticklabel pos/top/.style={/pgfplots/xticklabel pos/right}, + /pgfplots/xticklabel pos/bottom/.style={/pgfplots/xticklabel pos/left}, /pgfplots/xticklabel pos=default, - /pgfplots/yticklabel pos/.is choice, + /pgfplots/yticklabel pos/.code={\pgfplots@setticklabelpos@for y{#1}}, /pgfplots/yticklabel pos/.belongs to family=/pgfplots/tick, - /pgfplots/yticklabel pos/default/.code ={\def\pgfplots@yticklabelposnum{0}}, + /pgfplots/yticklabel pos/default/.code ={\def\pgfplots@yticklabelaxisspec{}}, /pgfplots/yticklabel pos/default/.belongs to family=/pgfplots/tick, - /pgfplots/yticklabel pos/left/.code ={\def\pgfplots@yticklabelposnum{1}}, + /pgfplots/yticklabel pos/left/.code ={\def\pgfplots@yticklabelaxisspec{0v0}}, /pgfplots/yticklabel pos/left/.belongs to family=/pgfplots/tick, - /pgfplots/yticklabel pos/right/.code ={\def\pgfplots@yticklabelposnum{3}}, + /pgfplots/yticklabel pos/right/.code ={\def\pgfplots@yticklabelaxisspec{1v0}}, /pgfplots/yticklabel pos/right/.belongs to family=/pgfplots/tick, /pgfplots/yticklabel pos/top/.style={/pgfplots/yticklabel pos/right}, /pgfplots/yticklabel pos/bottom/.style={/pgfplots/yticklabel pos/left}, /pgfplots/yticklabel pos=default, - /pgfplots/ticklabelpos/.style={/pgfplots/xticklabel pos={#1},/pgfplots/yticklabel pos={#1}}, + /pgfplots/zticklabel pos/.code={\pgfplots@setticklabelpos@for z{#1}}, + /pgfplots/zticklabel pos/.belongs to family=/pgfplots/tick, + /pgfplots/zticklabel pos/default/.code ={\def\pgfplots@zticklabelaxisspec{}}, + /pgfplots/zticklabel pos/default/.belongs to family=/pgfplots/tick, + /pgfplots/zticklabel pos=default, + /pgfplots/ticklabelpos/.style={ + /pgfplots/xticklabel pos={#1}, + /pgfplots/yticklabel pos={#1}, + % /pgfplots/zticklabel pos={#1}, + }, % sets \pgfplots@{x,y}tickalignnum to % inside=0 % outside=1 @@ -497,10 +727,20 @@ /pgfplots/ytick align/center/.code ={\def\pgfplots@ytickalignnum{2}}, /pgfplots/ytick align/center/.belongs to family=/pgfplots/tick, /pgfplots/ytick align=inside, + /pgfplots/ztick align/.is choice, + /pgfplots/ztick align/.belongs to family=/pgfplots/tick, + /pgfplots/ztick align/inside/.code ={\def\pgfplots@ztickalignnum{0}}, + /pgfplots/ztick align/inside/.belongs to family=/pgfplots/tick, + /pgfplots/ztick align/outside/.code ={\def\pgfplots@ztickalignnum{1}}, + /pgfplots/ztick align/outside/.belongs to family=/pgfplots/tick, + /pgfplots/ztick align/center/.code ={\def\pgfplots@ztickalignnum{2}}, + /pgfplots/ztick align/center/.belongs to family=/pgfplots/tick, + /pgfplots/ztick align=inside, /pgfplots/tick align/.belongs to family=/pgfplots/tick, /pgfplots/tick align/.style={% /pgfplots/xtick align=#1, /pgfplots/ytick align=#1, + /pgfplots/ztick align=#1, },% % 'axis' options: /pgfplots/anchor/.belongs to family=/pgfplots, @@ -513,29 +753,37 @@ /pgfplots/ticks/none/.code={% \pgfplots@xminorticksfalse \pgfplots@yminorticksfalse + \pgfplots@zminorticksfalse \pgfplots@xmajorticksfalse \pgfplots@ymajorticksfalse + \pgfplots@zmajorticksfalse }, /pgfplots/ticks/major/.belongs to family=/pgfplots/tick, /pgfplots/ticks/major/.code={% \pgfplots@xminorticksfalse \pgfplots@yminorticksfalse + \pgfplots@zminorticksfalse \pgfplots@xmajortickstrue \pgfplots@ymajortickstrue + \pgfplots@zmajortickstrue }, /pgfplots/ticks/minor/.belongs to family=/pgfplots/tick, /pgfplots/ticks/minor/.code={% \pgfplots@xminortickstrue \pgfplots@yminortickstrue + \pgfplots@zminortickstrue \pgfplots@xmajorticksfalse \pgfplots@ymajorticksfalse + \pgfplots@zmajorticksfalse }, /pgfplots/ticks/both/.belongs to family=/pgfplots/tick, /pgfplots/ticks/both/.code={% \pgfplots@xminortickstrue \pgfplots@yminortickstrue + \pgfplots@zminortickstrue \pgfplots@xmajortickstrue \pgfplots@ymajortickstrue + \pgfplots@zmajortickstrue }, /pgfplots/ticks=both, /pgfplots/grid/.is choice, @@ -544,29 +792,37 @@ /pgfplots/grid/none/.code={% \pgfplots@xminorgridsfalse \pgfplots@yminorgridsfalse + \pgfplots@zminorgridsfalse \pgfplots@xmajorgridsfalse \pgfplots@ymajorgridsfalse + \pgfplots@zmajorgridsfalse }, /pgfplots/grid/major/.belongs to family=/pgfplots/tick, /pgfplots/grid/major/.code={% \pgfplots@xminorgridsfalse \pgfplots@yminorgridsfalse + \pgfplots@zminorgridsfalse \pgfplots@xmajorgridstrue \pgfplots@ymajorgridstrue + \pgfplots@zmajorgridstrue }, /pgfplots/grid/minor/.belongs to family=/pgfplots/tick, /pgfplots/grid/minor/.code={% \pgfplots@xminorgridstrue \pgfplots@yminorgridstrue + \pgfplots@zminorgridstrue \pgfplots@xmajorgridsfalse \pgfplots@ymajorgridsfalse + \pgfplots@zmajorgridsfalse }, /pgfplots/grid/both/.belongs to family=/pgfplots/tick, /pgfplots/grid/both/.code={% \pgfplots@xminorgridstrue \pgfplots@yminorgridstrue + \pgfplots@zminorgridstrue \pgfplots@xmajorgridstrue \pgfplots@ymajorgridstrue + \pgfplots@zmajorgridstrue }, /pgfplots/grid=none, /pgfplots/grid/.default=major, @@ -582,6 +838,12 @@ /pgfplots/ymajorticks/.is if=pgfplots@ymajorticks, /pgfplots/ymajorticks/.default=true, /pgfplots/ymajorticks/.belongs to family=/pgfplots/tick, + /pgfplots/zminorticks/.is if=pgfplots@zminorticks, + /pgfplots/zminorticks/.default=true, + /pgfplots/zminorticks/.belongs to family=/pgfplots/tick, + /pgfplots/zmajorticks/.is if=pgfplots@zmajorticks, + /pgfplots/zmajorticks/.default=true, + /pgfplots/zmajorticks/.belongs to family=/pgfplots/tick, /pgfplots/xminorgrids/.is if=pgfplots@xminorgrids, /pgfplots/xminorgrids/.default=true, /pgfplots/xminorgrids/.belongs to family=/pgfplots/tick, @@ -594,6 +856,12 @@ /pgfplots/ymajorgrids/.is if=pgfplots@ymajorgrids, /pgfplots/ymajorgrids/.default=true, /pgfplots/ymajorgrids/.belongs to family=/pgfplots/tick, + /pgfplots/zminorgrids/.is if=pgfplots@zminorgrids, + /pgfplots/zminorgrids/.default=true, + /pgfplots/zminorgrids/.belongs to family=/pgfplots/tick, + /pgfplots/zmajorgrids/.is if=pgfplots@zmajorgrids, + /pgfplots/zmajorgrids/.default=true, + /pgfplots/zmajorgrids/.belongs to family=/pgfplots/tick, % legend options: /pgfplots/legend entries/.initial={}, /pgfplots/legend entries/.belongs to family=/pgfplots/legend, @@ -625,6 +893,8 @@ /pgfplots/xlabel/.belongs to family=/pgfplots/descriptions, /pgfplots/ylabel/.initial=, /pgfplots/ylabel/.belongs to family=/pgfplots/descriptions, + /pgfplots/zlabel/.initial=, + /pgfplots/zlabel/.belongs to family=/pgfplots/descriptions, /pgfplots/before end axis/.code=, /pgfplots/after end axis/.code=, /pgfplots/extra description/.code=, @@ -638,6 +908,10 @@ /pgfplots/clip limits/.default=true, /pgfplots/clip limits=true, /pgfplots/clip limits/.belongs to family=/pgfplots, + /pgfplots/axis equal/.is if=pgfplots@axis@equal, + /pgfplots/axis equal/.default=true, + /pgfplots/axis equal image/.is if=pgfplots@axis@equal@image, + /pgfplots/axis equal image/.default=true, /pgfplots/xmin/.belongs to family=/pgfplots, /pgfplots/xmin/.initial=, /pgfplots/xmax/.belongs to family=/pgfplots, @@ -646,12 +920,30 @@ /pgfplots/ymin/.initial=, /pgfplots/ymax/.belongs to family=/pgfplots, /pgfplots/ymax/.initial=, + /pgfplots/zmin/.belongs to family=/pgfplots, + /pgfplots/zmin/.initial=, + /pgfplots/zmax/.belongs to family=/pgfplots, + /pgfplots/zmax/.initial=, + /pgfplots/xtickmin/.belongs to family=/pgfplots, + /pgfplots/xtickmin/.initial=, + /pgfplots/xtickmax/.belongs to family=/pgfplots, + /pgfplots/xtickmax/.initial=, + /pgfplots/ytickmin/.belongs to family=/pgfplots, + /pgfplots/ytickmin/.initial=, + /pgfplots/ytickmax/.belongs to family=/pgfplots, + /pgfplots/ytickmax/.initial=, + /pgfplots/ztickmin/.belongs to family=/pgfplots, + /pgfplots/ztickmin/.initial=, + /pgfplots/ztickmax/.belongs to family=/pgfplots, + /pgfplots/ztickmax/.initial=, /pgfplots/stack plots/.is choice, /pgfplots/stack plots/.belongs to family=/pgfplots, - /pgfplots/stack plots/x/.code={\pgfplots@stacked@xtrue\pgfplots@stackedmodetrue}, + /pgfplots/stack plots/x/.code={\def\pgfplots@stacked@dir{x}\pgfplots@stackedmodetrue}, /pgfplots/stack plots/x/.belongs to family=/pgfplots, - /pgfplots/stack plots/y/.code={\pgfplots@stacked@xfalse\pgfplots@stackedmodetrue}, + /pgfplots/stack plots/y/.code={\def\pgfplots@stacked@dir{y}\pgfplots@stackedmodetrue}, /pgfplots/stack plots/y/.belongs to family=/pgfplots, + /pgfplots/stack plots/z/.code={\def\pgfplots@stacked@dir{z}\pgfplots@stackedmodetrue}, + /pgfplots/stack plots/z/.belongs to family=/pgfplots, /pgfplots/stack plots/false/.code={\pgfplots@stackedmodefalse}, /pgfplots/stack plots/false/.belongs to family=/pgfplots, /pgfplots/stack plots=false, @@ -672,6 +964,8 @@ /pgfplots/x filter/.belongs to family=/pgfplots, /pgfplots/y filter/.code={}, /pgfplots/y filter/.belongs to family=/pgfplots, + /pgfplots/z filter/.code={}, + /pgfplots/z filter/.belongs to family=/pgfplots, /pgfplots/skip coords between index/.style 2 args={% /pgfplots/x filter/.append code={% \ifnum\coordindex<#1\relax @@ -682,9 +976,25 @@ \fi} }, /pgfplots/xfilter/.initial=,% DEPRECATED - /pgfplots/xfilter/.belongs to family=/pgfplots, /pgfplots/yfilter/.initial=,% DEPRECATED - /pgfplots/yfilter/.belongs to family=/pgfplots, + /pgfplots/zfilter/.initial=,% DEPRECATED + % interpretation: + % if 'samples at'==empty && 'domain' == empty + % use tikz option processing! + % else if 'samples at' == empty + % use 'domain' + % else + % use 'samples at' + /pgfplots/domain/.initial=,% empty -> use value of /tikz/domain! see \pgfplots@validate@plot@domain@arguments + /pgfplots/samples at/.initial=,% empty -> use value of /tikz/samples at! + /pgfplots/samples/.initial=,% empty -> use /tikz/samples! + % and provide aliases in the '/pgfplots/' tree to avoid + % search path problems just for these two options: + /pgfplots/name/.belongs to family=/pgfplots/naming commands, + /pgfplots/name/.code={\pgfkeysalso{/tikz/name={#1}}}, + /pgfplots/alias/.belongs to family=/pgfplots/naming commands, + /pgfplots/alias/.code={\pgfkeysalso{/tikz/alias={#1}}}, + /pgfplots/y domain/.initial=-5:5, /pgfplots/width/.store in= \pgfplots@width, /pgfplots/width/.belongs to family=/pgfplots, /pgfplots/width=, @@ -701,22 +1011,42 @@ /pgfplots/enlarge x limits/.default=true, /pgfplots/enlarge y limits/.initial=auto, /pgfplots/enlarge y limits/.default=true, + /pgfplots/enlarge z limits/.initial=auto, + /pgfplots/enlarge z limits/.default=true, /pgfplots/enlargelimits/.style={% /pgfplots/enlarge x limits=#1,% /pgfplots/enlarge y limits=#1,% + /pgfplots/enlarge z limits=#1,% },% /pgfplots/enlargelimits/.default=true, - /pgfplots/x/.store in= \pgfplots@x, + /pgfplots/x/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth' /pgfplots/x/.belongs to family=/pgfplots, - /pgfplots/x=,% is implicitly set by 'width' and/or '\axisdefaultwidth' - /pgfplots/y/.store in= \pgfplots@y, + /pgfplots/y/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth' /pgfplots/y/.belongs to family=/pgfplots, - /pgfplots/y=,% is implicitly set by 'width' and/or '\axisdefaultwidth' + /pgfplots/z/.initial=, + /pgfplots/z/.belongs to family=/pgfplots, + /pgfplots/view/.code 2 args={% + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \let\pgfplots@view@pitch=\pgfutil@empty + \let\pgfplots@view@yaw=\pgfutil@empty + \else + \pgfmathparse{#1}\let\pgfplots@view@pitch=\pgfmathresult + \pgfmathparse{#2}\let\pgfplots@view@yaw=\pgfmathresult + \fi + }, + /pgfplots/view={}{}, /pgfplots/cycle list/.code={\pgfplots@assign@list\autoplotspeclist{#1}}, /pgfplots/cycle list/.belongs to family=/pgfplots, - /pgfplots/cycle list name/.code={\let\autoplotspeclist=#1\relax}, + /pgfplots/cycle list name/.code={% + \pgfutil@ifundefined{pgfp@cyclist@\string#1@}{% + \pgfplots@error{Sorry, there is no such cycle list named \string#1. Maybe you misspelled it?}% + }{% + \expandafter\let\expandafter\autoplotspeclist\csname pgfp@cyclist@\string#1@\endcsname + }% + }, /pgfplots/cycle list name/.belongs to family=/pgfplots, - /pgfplots/cycle list name=\coloredplotspeclist, + /pgfplots/cycle list name=color, /pgfplots/legend style/.belongs to family=/pgfplots/style commands, /pgfplots/legend style/.code={% \pgfkeysalso{/pgfplots/every axis legend/.append style={#1}}% @@ -733,6 +1063,10 @@ /pgfplots/y label style/.code={% \pgfkeysalso{/pgfplots/every axis y label/.append style={#1}}% }, + /pgfplots/z label style/.belongs to family=/pgfplots/style commands, + /pgfplots/z label style/.code={% + \pgfkeysalso{/pgfplots/every axis z label/.append style={#1}}% + }, /pgfplots/title style/.belongs to family=/pgfplots/style commands, /pgfplots/title style/.code={% \pgfkeysalso{/pgfplots/every axis title/.append style={#1}}% @@ -749,6 +1083,10 @@ /pgfplots/y tick label style/.code={% \pgfkeysalso{/pgfplots/every y tick label/.append style={#1}}% }, + /pgfplots/z tick label style/.belongs to family=/pgfplots/style commands, + /pgfplots/z tick label style/.code={% + \pgfkeysalso{/pgfplots/every z tick label/.append style={#1}}% + }, /pgfplots/x tick scale label style/.belongs to family=/pgfplots/style commands, /pgfplots/x tick scale label style/.code={% \pgfkeysalso{/pgfplots/every x scale tick label/.append style={#1}}% @@ -757,6 +1095,10 @@ /pgfplots/y tick scale label style/.code={% \pgfkeysalso{/pgfplots/every y scale tick label/.append style={#1}}% }, + /pgfplots/z tick scale label style/.belongs to family=/pgfplots/style commands, + /pgfplots/z tick scale label style/.code={% + \pgfkeysalso{/pgfplots/every z scale tick label/.append style={#1}}% + }, /pgfplots/tick style/.belongs to family=/pgfplots/style commands, /pgfplots/tick style/.code={% \pgfkeysalso{/pgfplots/every tick/.append style={#1}}% @@ -793,6 +1135,18 @@ /pgfplots/major y tick style/.code={% \pgfkeysalso{/pgfplots/every major y tick/.append style={#1}}% }, + /pgfplots/z tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/z tick style/.code={% + \pgfkeysalso{/pgfplots/every z tick/.append style={#1}}% + }, + /pgfplots/minor z tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/minor z tick style/.code={% + \pgfkeysalso{/pgfplots/every minor z tick/.append style={#1}}% + }, + /pgfplots/major z tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/major z tick style/.code={% + \pgfkeysalso{/pgfplots/every major z tick/.append style={#1}}% + }, /pgfplots/grid style/.belongs to family=/pgfplots/style commands, /pgfplots/grid style/.code={% \pgfkeysalso{/pgfplots/every axis grid/.append style={#1}}% @@ -829,10 +1183,29 @@ /pgfplots/major y grid style/.code={% \pgfkeysalso{/pgfplots/every major y grid/.append style={#1}}% }, - /pgfplots/disablelogfilter/.is if=pgfplots@disablelogfilter, - /pgfplots/disablelogfilter/.default=true, - /pgfplots/disablelogfilter/.belongs to family=/pgfplots, - /pgfplots/disablelogfilter=false, + /pgfplots/y grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/y grid style/.code={% + \pgfkeysalso{/pgfplots/every axis z grid/.append style={#1}}% + }, + /pgfplots/minor z grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/minor z grid style/.code={% + \pgfkeysalso{/pgfplots/every minor z grid/.append style={#1}}% + }, + /pgfplots/major z grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/major z grid style/.code={% + \pgfkeysalso{/pgfplots/every major z grid/.append style={#1}}% + }, + /pgfplots/disablelogfilter x/.is if=pgfplots@disablelogfilter@x, + /pgfplots/disablelogfilter x/.default=true, + /pgfplots/disablelogfilter y/.is if=pgfplots@disablelogfilter@y, + /pgfplots/disablelogfilter y/.default=true, + /pgfplots/disablelogfilter z/.is if=pgfplots@disablelogfilter@z, + /pgfplots/disablelogfilter z/.default=true, + /pgfplots/disablelogfilter/.style={ + /pgfplots/disablelogfilter x=#1, + /pgfplots/disablelogfilter y=#1, + /pgfplots/disablelogfilter z=#1, + }, /pgfplots/disabledatascaling/.is if=pgfplots@disabledatascaling, /pgfplots/disabledatascaling/.default=true, /pgfplots/disabledatascaling/.belongs to family=/pgfplots, @@ -843,9 +1216,13 @@ /pgfplots/hide y axis/.is if=pgfplots@hide@y, /pgfplots/hide y axis/.default=true, /pgfplots/hide y axis=false, + /pgfplots/hide z axis/.is if=pgfplots@hide@y, + /pgfplots/hide z axis/.default=true, + /pgfplots/hide z axis=false, /pgfplots/hide axis/.style={% /pgfplots/hide x axis=#1, /pgfplots/hide y axis=#1, + /pgfplots/hide z axis=#1, }, /pgfplots/hide axis/.default=true, /pgfplots/every non boxed x axis/.style={% @@ -858,8 +1235,14 @@ enlarge y limits=false, y axis line style={-stealth} }, + /pgfplots/every non boxed z axis/.style={% + ytick align=center, + enlarge z limits=false, + y axis line style={-stealth} + }, /pgfplots/every boxed x axis/.style={}, /pgfplots/every boxed y axis/.style={}, + /pgfplots/every boxed z axis/.style={}, % /pgfplots/hide axis/.belongs to family=/pgfplots, % sets \pgfplots@xaxislinesnum to % box=0 @@ -953,6 +1336,55 @@ }% },% /pgfplots/axis y line/none/.style ={axis y line*/none,hide y axis}, +% +% sets \pgfplots@zaxislinesnum to +% box=0 +% left=1 +% center=2 ( aliased with middle ) +% right=3 + /pgfplots/axis z line*/.is choice, + /pgfplots/axis z line*/box/.code ={\def\pgfplots@zaxislinesnum{0}\def\pgfplots@ztickposnum{0}}, + /pgfplots/axis z line*/left/.code ={\def\pgfplots@zaxislinesnum{1}\def\pgfplots@ztickposnum{1}}, + /pgfplots/axis z line*/center/.code ={\def\pgfplots@zaxislinesnum{2}\def\pgfplots@ztickposnum{2}}, + /pgfplots/axis z line*/middle/.style ={/pgfplots/axis z line*/center}, + /pgfplots/axis z line*/right/.code ={\def\pgfplots@zaxislinesnum{3}\def\pgfplots@ztickposnum{3}}, + /pgfplots/axis z line*/none/.code ={\def\pgfplots@zaxislinesnum{4}\def\pgfplots@ztickposnum{4}}, + /pgfplots/axis z line*=box, + % + /pgfplots/axis z line/.is choice, + /pgfplots/axis z line/box/.style ={ + /pgfplots/axis z line*/box, + /pgfplots/every boxed z axis + }, + /pgfplots/axis z line/left/.style ={ + /pgfplots/axis z line*/left, + /pgfplots/every non boxed z axis + }, + /pgfplots/axis z line/center/.code ={ + \ifnum\pgfplots@xaxislinesnum=3 % if 'axis x line==top' then + \pgfkeysalso{% + /pgfplots/every axis z label/.style={at={(current axis.below origin)},anchor=south west}}% + \else + \pgfkeysalso{% + /pgfplots/every axis z label/.style={at={(current axis.above origin)},anchor=north west}}% + \fi + \pgfkeysalso{% + /pgfplots/axis z line*/center, + /pgfplots/every non boxed z axis}% + }, + /pgfplots/axis z line/middle/.style ={/pgfplots/axis z line/center}, + /pgfplots/axis z line/right/.code ={% + \ifnum\pgfplots@xaxislinesnum=2 + \pgfkeysalso{every axis x label/.style={at={(current axis.left of origin)},anchor=south west}}% + \fi + \pgfkeysalso{ + axis z line*/right, + %every axis y label/.style={at={(1,1)},anchor=north west,xshift=15pt}, + every axis z label/.style={at={(1,0.5)},xshift=33pt,rotate=90}, + /pgfplots/every non boxed z axis + }% + },% + /pgfplots/axis z line/none/.style ={axis z line*/none,hide z axis}, % set \pgfplots@xaxisdiscontnum % none = 0 % crunch = 1 @@ -979,6 +1411,19 @@ /pgfplots/axis y discontinuity/parallel/.code ={\def\pgfplots@yaxisdiscontnum{2}}, /pgfplots/axis y discontinuity/parallel/.belongs to family=/pgfplots, %/axis, /pgfplots/axis y discontinuity=none, +% set \pgfplots@yaxisdiscontnum +% none = 0 +% crunch = 1 +% open = 2 + /pgfplots/axis z discontinuity/.is choice, + /pgfplots/axis z discontinuity/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis z discontinuity/none/.code ={\def\pgfplots@zaxisdiscontnum{0}}, + /pgfplots/axis z discontinuity/none/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis z discontinuity/crunch/.code ={\def\pgfplots@zaxisdiscontnum{1}}, + /pgfplots/axis z discontinuity/crunch/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis z discontinuity/parallel/.code ={\def\pgfplots@zaxisdiscontnum{2}}, + /pgfplots/axis z discontinuity/parallel/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis z discontinuity=none, /pgfplots/scale only axis/.is if=pgfplots@scale@only@axis, /pgfplots/scale only axis/.default=true, /pgfplots/scale only axis/.belongs to family=/pgfplots, @@ -1004,6 +1449,15 @@ /pgfplots/ymode/log/.code={\pgfplots@yislinearfalse}, /pgfplots/ymode/log/.belongs to family=/pgfplots/scale, /pgfplots/ymode=linear, + /pgfplots/zmode/.is choice, + /pgfplots/zmode/.belongs to family=/pgfplots/scale, + /pgfplots/zmode/normal/.code={\pgfplots@zislineartrue}, + /pgfplots/zmode/normal/.belongs to family=/pgfplots/scale, + /pgfplots/zmode/linear/.code={\pgfplots@zislineartrue}, + /pgfplots/zmode/linear/.belongs to family=/pgfplots/scale, + /pgfplots/zmode/log/.code={\pgfplots@zislinearfalse}, + /pgfplots/zmode/log/.belongs to family=/pgfplots/scale, + /pgfplots/zmode=linear, /pgfplots/error bars/x fixed/.code= \def\pgfplots@errorbars@xfixed{#1}\def\pgfplots@errorbars@xmode{0}, /pgfplots/error bars/x fixed relative/.code= \def\pgfplots@errorbars@xrel{#1}\def\pgfplots@errorbars@xmode{1}, /pgfplots/error bars/x explicit/.code= \def\pgfplots@errorbars@xmode{2}, @@ -1016,11 +1470,19 @@ /pgfplots/error bars/y explicit relative/.code= \def\pgfplots@errorbars@ymode{3}, /pgfplots/error bars/y fixed relative=0, /pgfplots/error bars/y fixed=0, + /pgfplots/error bars/z fixed/.code= \def\pgfplots@errorbars@zfixed{#1}\def\pgfplots@errorbars@zmode{0}, + /pgfplots/error bars/z fixed relative/.code= \def\pgfplots@errorbars@zrel{#1}\def\pgfplots@errorbars@zmode{1}, + /pgfplots/error bars/z explicit/.code= \def\pgfplots@errorbars@zmode{2}, + /pgfplots/error bars/z explicit relative/.code= \def\pgfplots@errorbars@zmode{3}, + /pgfplots/error bars/z fixed relative=0, + /pgfplots/error bars/z fixed=0, /pgfplots/error bars/x dir/.is choice, /pgfplots/error bars/x dir/none/.code={% \def\pgfplots@errorbars@xdirection{0}% \ifnum\pgfplots@errorbars@ydirection=0 - \pgfplots@errorbars@enabledfalse + \ifnum\pgfplots@errorbars@zdirection=0 + \pgfplots@errorbars@enabledfalse + \fi \fi }, /pgfplots/error bars/x dir/plus/.code= \def\pgfplots@errorbars@xdirection{1}\pgfplots@errorbars@enabledtrue, @@ -1031,13 +1493,28 @@ /pgfplots/error bars/y dir/none/.code={% \def\pgfplots@errorbars@ydirection{0}% \ifnum\pgfplots@errorbars@xdirection=0 - \pgfplots@errorbars@enabledfalse + \ifnum\pgfplots@errorbars@zdirection=0 + \pgfplots@errorbars@enabledfalse + \fi \fi }, /pgfplots/error bars/y dir/plus/.code= \def\pgfplots@errorbars@ydirection{1}\pgfplots@errorbars@enabledtrue, /pgfplots/error bars/y dir/minus/.code= \def\pgfplots@errorbars@ydirection{2}\pgfplots@errorbars@enabledtrue, /pgfplots/error bars/y dir/both/.code= \def\pgfplots@errorbars@ydirection{3}\pgfplots@errorbars@enabledtrue, /pgfplots/error bars/y dir=none, + /pgfplots/error bars/z dir/.is choice, + /pgfplots/error bars/z dir/none/.code={% + \def\pgfplots@errorbars@zdirection{0}% + \ifnum\pgfplots@errorbars@xdirection=0 + \ifnum\pgfplots@errorbars@ydirection=0 + \pgfplots@errorbars@enabledfalse + \fi + \fi + }, + /pgfplots/error bars/z dir/plus/.code= \def\pgfplots@errorbars@zdirection{1}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/z dir/minus/.code= \def\pgfplots@errorbars@zdirection{2}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/z dir/both/.code= \def\pgfplots@errorbars@zdirection{3}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/z dir=none, /pgfplots/error bars/error mark/.initial={-}, /pgfplots/error bars/error mark options/.initial={rotate=90}, /pgfplots/error bars/error bar style/.code={% @@ -1083,6 +1560,17 @@ -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + % the '0.5*w' is for centering (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1},% + /pgfplots/error bars/draw error bar/.code 2 args={% +% FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! + \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% + \pgfkeysgetvalue{/pgfplots/error bars/error mark options}{\pgfplotserrorbarsmarkopts}% + \draw[xshift={\pgfkeysvalueof{/pgf/bar shift}}] + ##1 -- ##2 node[pos=1,sloped,allow upside down] {% + \expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{% + \expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}% + \pgfusepath{stroke}}% + }; + },% /tikz/ybar, }, /pgfplots/ybar/.default=2pt, @@ -1097,6 +1585,17 @@ -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + % the '0.5*w' is for centering (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1},% + /pgfplots/error bars/draw error bar/.code 2 args={% +% FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! + \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% + \pgfkeysgetvalue{/pgfplots/error bars/error mark options}{\pgfplotserrorbarsmarkopts}% + \draw[yshift={\pgfkeysvalueof{/pgf/bar shift}}] + ##1 -- ##2 node[pos=1,sloped,allow upside down] {% + \expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{% + \expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}% + \pgfusepath{stroke}}% + }; + },% /tikz/xbar, }, /pgfplots/xbar/.default=2pt, @@ -1169,6 +1668,10 @@ }, /pgfplots/plot file/skip first/.is if=pgfplots@plot@file@skipfirst, /pgfplots/plot file/skip first/.default=true, + /pgfplots/plot file/.unknown/.code={% + \let\pgfplots@table@curkeyname=\pgfkeyscurrentname + \pgfqkeys{/pgfplots}{\pgfplots@table@curkeyname=##1}% + }, /pgfplots/clip marker paths/.is if=pgfplots@clip@marker@paths, /pgfplots/clip marker paths/.default=true, /pgfplots/axis on top/.is if=pgfplots@axis@on@top, @@ -1180,6 +1683,171 @@ /pgfplots/x coord inv trafo/.code={}, /pgfplots/y coord trafo/.code={}, /pgfplots/y coord inv trafo/.code={}, + /pgfplots/z coord trafo/.code={}, + /pgfplots/z coord inv trafo/.code={}, +% Set \pgfplots@perpointmeta@choice to +% 0: mi is not available/not used. +% 1: mi = xi +% 2: mi = yi +% 3: mi = zi +% 4: mi = given explicitly somehow +% 5: mi = given explicitly somehow AS SYMBOLIC CONSTANTS. + /pgfplots/point meta/.is choice, + /pgfplots/point meta/none/.code={ + \def\pgfplots@perpointmeta@choice{0}% + \def\pgfplots@perpointmeta@arg{}% + }, + /pgfplots/point meta/x/.code={ + \def\pgfplots@perpointmeta@choice{1}% + \def\pgfplots@perpointmeta@arg{}% + }, + /pgfplots/point meta/y/.code={ + \def\pgfplots@perpointmeta@choice{2}% + \def\pgfplots@perpointmeta@arg{}% + }, + /pgfplots/point meta/z/.code={ + \def\pgfplots@perpointmeta@choice{3}% + \def\pgfplots@perpointmeta@arg{}% + }, + /pgfplots/point meta/explicit/.code={ + \def\pgfplots@perpointmeta@choice{4}% + \def\pgfplots@perpointmeta@arg{#1}% + }, + /pgfplots/point meta/explicit symbolic/.code={ + \def\pgfplots@perpointmeta@choice{5}% + \def\pgfplots@perpointmeta@arg{#1}% + }, + /pgfplots/point meta/none, + /pgfplots/colormap name/.initial=hot, + /pgfplots/colormap/.code 2 args={ + \pgfplotscreatecolormap{#1}{#2}% + \pgfkeysdef{/pgfplots/colormap name}{#1}% + }, + /pgfplots/scatter/.is choice, + /pgfplots/scatter/false/.code={% + \pgfplots@scatterplotenabledfalse + }, + /pgfplots/scatter/true/.code={% + \pgfplots@scatterplotenabledtrue + % make sure there is a mark set! + \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% + \def\pgfplots@loc@TMPa{none}% + \ifx\tikz@plot@mark\pgfplots@loc@TMPa + % this here happens only in older versions of pgf. + \pgfqkeys{/tikz}{mark=*}% + \else + \ifx\tikz@plot@mark\pgfutil@empty + \pgfqkeys{/tikz}{mark=*}% + \fi + \fi + }, + /pgfplots/scatter/.default=true, + /pgfplots/scatter src/.style={/pgfplots/point meta=#1}, + /tikz/scatter/.style={/pgfplots/scatter=#1}, + % + % ARGUMENTS: the macros + % - \pgfplotspointmeta + % - \pgfplotspointmetarange + % - \pgfplotspointmetatransformed + % - \pgfplotspointmetatransformedrange + % are set during @pre marker code and @post marker code. + % '#1' is empty. + /pgfplots/scatter/@pre marker code/.code={}, + /pgfplots/scatter/@post marker code/.code={}, + /pgfplots/scatter/use mapped color/.style={ + /pgfplots/scatter/@pre marker code/.code={ + \expandafter\pgfplotscolormapfind\expandafter[\pgfplotspointmetatransformedrange] + [1.0] + {\pgfplotspointmetatransformed} + {\pgfkeysvalueof{/pgfplots/colormap name}} +%\message{Color for current point is RGB '\pgfmathresult' (determined using meta 'phi(\pgfplotspointmeta) = \pgfplotspointmetatransformed')}% + \def\pgfplots@loc@TMPb{\definecolor{mapped color}{rgb}} + \expandafter\pgfplots@loc@TMPb\expandafter{\pgfmathresult} + \scope[#1] + }, + /pgfplots/scatter/@post marker code/.code={\endscope} + }, + /pgfplots/scatter/use mapped color/.default={draw=mapped color!80!black,fill=mapped color}, + /pgfplots/scatter/use mapped color, + % expect '#1 = {<class>=<style>,<class>=<style>,...} where <class> + % is expected as SYMBOL, not as number. See 'point meta/explicit symbolic' + /pgfplots/scatter/classes/.code={% + % Step 1: remember the per class-styles as + % \csname pgfp@scatter@class@<class name>\endcsname + % -> this is done locally! + \global\let\pgfplots@glob@TMPa=\pgfutil@empty + \def\pgfplots@loc@TMPa##1=##2\relax{% + \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}% + \t@pgfplots@tokb={\expandafter\def\csname pgfp@scatter@class@##1\endcsname{##2}}% + \xdef\pgfplots@glob@TMPa{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + }% + % accumulate the \def-macros in a global macro because + % \foreach is scoped: + \foreach \entry in {#1} {% + \edef\eentry{\entry}% + \expandafter\pgfplots@loc@TMPa\eentry\relax + }% + % do the assignments: + \pgfplots@glob@TMPa + \global\let\pgfplots@glob@TMPa=\pgfutil@empty + \pgfkeysdef{/pgfplots/scatter/@pre marker code}{% + \pgfutil@ifundefined{pgfp@scatter@class@\pgfplotspointmeta}{% + \let\pgfplots@loc@TMPa=\pgfplotspointmeta + % + % ups - no styles available? Maybe something went + % wrong with the 'scatter src' key. Check whether it + % was accidentally a numerical style: + \ifnum\pgfplots@perpointmeta@choice=5 + \else + % ok, be fault tolerant and round to an integer: + \pgfmathfloattofixed{\pgfplotspointmeta}% + \begingroup + \pgfkeys{/pgf/number format/precision=0}% + \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let\pgfplotspointmeta=\pgfmathresult + \fi + % now, check again: + \pgfutil@ifundefined{pgfp@scatter@class@\pgfplotspointmeta}{% + % still not possible? Then, try truncating the + % number to an integer. + \expandafter\pgfutil@in@\expandafter.\expandafter{\pgfplotspointmeta}% + \ifpgfutil@in@ + \def\pgfplots@loc@TMPb####1.####2\relax{\def\pgfplotspointmeta{####1}}% + \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\relax + \fi + % now, check again: + \pgfutil@ifundefined{pgfp@scatter@class@\pgfplotspointmeta}{% + \pgfutil@ifundefined{pgfp@scatter@WARNING@\pgfplotspointmeta}{% + \pgfplots@warning{scatter/classes: can't find class for '\pgfplotspointmeta'!? Please make sure you have specified 'scatter src=explicit symbolic'. Ignoring class '\pgfplotspointmeta' (this message will not come again).}% + \expandafter\gdef\csname pgfp@scatter@WARNING@\pgfplotspointmeta\endcsname{ALREADY CHECKED}% + }{}% + \def\pgfplots@loc@TMPa{}% + }{% + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@scatter@class@\pgfplotspointmeta\endcsname + }% + }{% + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@scatter@class@\pgfplotspointmeta\endcsname + }% + }{% + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@scatter@class@\pgfplotspointmeta\endcsname + }% + \expandafter\scope\expandafter[\pgfplots@loc@TMPa]% + }% + \pgfkeysdef{/pgfplots/scatter/@post marker code}{\endscope}% + }, + /pgfplots/refstyle/.code={% + \pgfutil@ifundefined{pgfplots@labelstyle@#1}{% + \G@refundefinedtrue + \@latex@warning{Reference `#1' on page \thepage \space undefined}% + }{% + \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfplots@labelstyle@#1\endcsname}% + \expandafter\pgfkeysalso\expandafter{\the\t@pgfplots@toka}% + }% + },% + /pgfplots/forget plot/.is if=pgfplots@curplot@isirrelevant, + /pgfplots/forget plot/.default=true, } { @@ -1188,302 +1856,80 @@ \global\let\pgfplots@empty@command@key=\pgfplots@loc@TMPa } +% Only define if it is undefined. It may be possible that related libraries +% habe been loaded before pgfplots. +\pgfkeysifdefined{/pgfplots/@backgroundpath@hook}{\relax}{% + \pgfkeysdef{/pgfplots/@backgroundpath@hook}{}% +} + \def\pgfplots@cmdkey@alias#1=#2;{% \pgfkeysgetvalue{/pgfplots/#2/.@cmd}\pgfplots@glob@TMPa \pgfkeyslet{/pgfplots/#1/.@cmd}\pgfplots@glob@TMPa }% \pgfplots@cmdkey@alias xlabel style=x label style; \pgfplots@cmdkey@alias ylabel style=y label style; +\pgfplots@cmdkey@alias zlabel style=z label style; \pgfplots@cmdkey@alias xticklabel style=x tick label style; \pgfplots@cmdkey@alias yticklabel style=y tick label style; +\pgfplots@cmdkey@alias zticklabel style=z tick label style; %\pgfplots@cmdkey@alias xtick scale label style=x tick scale label style; %\pgfplots@cmdkey@alias ytick scale label style=y tick scale label style; \pgfplots@cmdkey@alias xtick style=x tick style; \pgfplots@cmdkey@alias ytick style=y tick style; +\pgfplots@cmdkey@alias ztick style=z tick style; -\newif\ifpgfplots@log@tick@isminor@tick@pos -% Checks whether the tick position given as #1.#2=log10(T) belongs to -% T=i*10^j with an integer i>1. -% -% If T=i*10^j, \ifpgfplots@log@tick@isminor@tick@pos will be set to true and -% \pgfmathresult will contain T. -% -% Otherwise, \ifpgfplots@log@tick@isminor@tick@pos will be set to false and -% pgfmathresult to #1.#2 + +% A backwards compatibility method which works as follows: +% if any user specified arguments exist for the 'domain' or 'samples +% at' or 'samples' keys, nothing is done. % -% Arguments: -% #1.#2 the value log10(T) +% It these keys are empty, we switch to backwards compatibility mode +% and acquire the key settings from tikz. % -% Implementation: -% if T = i*10^j, log10(T) = log10(i) + j. -% That means if log10(T) in \Z, we have T = 10^j. If not, we need to -% check wether i is an integer. Please note that log10(i) < 1. +% This allows something like +% \begin{tikzpicture}[samples=70,domain=1:5] +% \begin{axis} +% \addplot {x^2}; +% \end{axis} +% \end{tikzpicture} % -% Further note: log(T) < 0 <=> j<0. -% In case j<0, we have -% #1.#2 = j + log(i) -% = - ( -j - log(i) ) -% = - ( -j - 1 + (1-log(i)) ) -% = #1 '.' #2 [ up to the '0.' -% that means #1 = j-1 and #2 = 1-log(i). -\def\pgfplots@is@log@tick@a@minor@tick@pos#1.#2\relax{% - \pgfmathapproxequalto@{#1.#2}{#1.0}% - \ifpgfmathcomparison - % in MOST cases, this here will be true: - \pgfplots@log@tick@isminor@tick@posfalse - \def\pgfmathresult{#1.#2}% - \else - % I guess this won't happen too often. In fact, it's a very - % special case. - \begingroup - \c@pgf@counta=#1\relax - \ifnum\c@pgf@counta<0 - \advance\c@pgf@counta by-1 - \pgfmathsubtract@{1}{0.#2}% - \expandafter\pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi\pgfmathresult\relax - \ifpgfplots@log@tick@isminor@tick@pos - \aftergroup\pgfplots@log@tick@isminor@tick@postrue - \edef\pgfmathresult{\pgfmathresult e\the\c@pgf@counta}% - \else - \aftergroup\pgfplots@log@tick@isminor@tick@posfalse - \def\pgfmathresult{#1.#2}% - \fi +% POSTCONDITION: +% - \pgfplots@plot@domain = value of '/pgfplots/domain', +% - \pgfplots@plot@samples@at = the value of '/pgfplots/samples at', +% - \pgfplots@plot@samples = value of '/pgfplots/samples', +% the values after any backwards compatibility issues will be used. +\def\pgfplots@validate@plot@domain@arguments{% + \pgfkeysgetvalue{/pgfplots/domain}\pgfplots@plot@domain + \pgfkeysgetvalue{/pgfplots/samples at}\pgfplots@plot@samples@at + \ifx\pgfplots@plot@domain\pgfutil@empty + \ifx\pgfplots@plot@samples@at\pgfutil@empty + \pgfplots@gettikzinternal@keyval{samples at}{tikz@plot@samplesat}{-5,-4.6,...,5}% + \pgfkeyslet{/pgfplots/samples at}{\tikz@plot@samplesat}% + \let\pgfplots@plot@samples@at=\tikz@plot@samplesat \else - \pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi0.#2\relax - \ifpgfplots@log@tick@isminor@tick@pos - \aftergroup\pgfplots@log@tick@isminor@tick@postrue - \edef\pgfmathresult{\pgfmathresult e\the\c@pgf@counta}% - \else - \aftergroup\pgfplots@log@tick@isminor@tick@posfalse - \def\pgfmathresult{#1.#2}% - \fi + % routines should use \pgfplots@plot@samples@at. \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup \fi -} - -% expects a positive number. -\def\pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi0.#1\relax{% - \pgfplots@log@tick@isminor@tick@postrue - \pgfmathapproxequalto@{0.#1}{0.3010299956639}% - \ifpgfmathcomparison - \def\pgfmathresult{2}% - \else - \pgfmathapproxequalto@{0.#1}{0.4771212547196}% - \ifpgfmathcomparison - \def\pgfmathresult{3}% - \else - \pgfmathapproxequalto@{0.#1}{0.6020599913279}% - \ifpgfmathcomparison - \def\pgfmathresult{4}% - \else - \pgfmathapproxequalto@{0.#1}{0.698970004}% - \ifpgfmathcomparison - \def\pgfmathresult{5}% - \else - \pgfmathapproxequalto@{0.#1}{0.7781512503}% - \ifpgfmathcomparison - \def\pgfmathresult{6}% - \else - \pgfmathapproxequalto@{0.#1}{0.8450980400}% - \ifpgfmathcomparison - \def\pgfmathresult{7}% - \else - \pgfmathapproxequalto@{0.#1}{0.9030899869}% - \ifpgfmathcomparison - \def\pgfmathresult{8}% - \else - \pgfmathapproxequalto@{0.#1}{0.954242509439}% - \ifpgfmathcomparison - \def\pgfmathresult{9}% - \else - \pgfplots@log@tick@isminor@tick@posfalse - \fi - \fi - \fi - \fi - \fi - \fi - \fi + \pgfkeysgetvalue{/pgfplots/samples}\pgfplots@plot@samples + \ifx\pgfplots@plot@samples\pgfutil@empty + \pgfplots@gettikzinternal@keyval{samples}{tikz@plot@samples}{25}% + \pgfkeyslet{/pgfplots/samples}{\tikz@plot@samples}% + \let\pgfplots@plot@samples=\tikz@plot@samples \fi -} - +}% \def\pgfplots@set@at#1{\def\pgfplots@at{#1}}% - -% converts a comma-separated list (PGF foreach) to my internal list -% structure. -\long\def\pgfplots@foreach@to@list#1\to#2{% - \global\pgfplotslistnewempty\pgfplots@glob@TMPa - \begingroup - \foreach \pgfplots@i in {#1} {% - \expandafter\pgfplotslistpushbackglobal\pgfplots@i\to\pgfplots@glob@TMPa - }% - \endgroup - \pgfplotslistcopy\pgfplots@glob@TMPa\to#2\relax -} - -% Several tick options: +% DEPRECATED \long\def\axispreset#1{% \pgfplotsset{every axis/.append style={#1}}% } +% DEPRECATED \long\def\legendpreset#1{% \pgfplots@error{Sorry, legendpreset is now deprecated, along with the legend options text width and font. Legends are now TikZ-matrizes which provide better alignment and can be placed horizontally. See the manual for details.}% } -% Checks whether we need to create a separate 'tick scale label', -% a node with ' * 10^3' on the side of the axis: -% -% PRECONDITION: -% Axis limits for #1 are given. I need their values before any data -% scale transformation has been applied. -% If -% \pgfplots@#1min@unscaled@as@float -% and -% \pgfplots@#1max@unscaled@as@float -% exist; I will use these macros. -% Otherwise, I will use \pgfplots@#1min and \pgfplots@#1max; -% assuming that no data scale transformation is active. -% FIXME : does that need further attention? -\def\pgfplots@init@scaled@tick@for#1{% - \begingroup - % the \pgfplots@xmin@unscaled@as@float is set just before the data - % scale transformation is initialised. - % - % The variables are empty if there is no datascale transformation. - \expandafter\let\expandafter\pgfplots@cur@min@unscaled\csname pgfplots@#1min@unscaled@as@float\endcsname - \expandafter\let\expandafter\pgfplots@cur@max@unscaled\csname pgfplots@#1max@unscaled@as@float\endcsname - % - \ifx\pgfplots@cur@min@unscaled\pgfutil@empty - \edef\pgfplots@loc@TMPa{\csname pgfplots@#1min\endcsname}% - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% - \let\pgfplots@cur@min@unscaled=\pgfmathresult - \edef\pgfplots@loc@TMPa{\csname pgfplots@#1max\endcsname}% - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% - \let\pgfplots@cur@max@unscaled=\pgfmathresult - \fi - % - \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@min@unscaled\relax\pgfmathfloat@a@E - \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@max@unscaled\relax\pgfmathfloat@b@E - \ifnum\pgfmathfloat@b@E<\pgfmathfloat@a@E - \pgfmathfloat@b@E=\pgfmathfloat@a@E - \fi - \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@above@exponent}% - \expandafter\ifnum\pgfplots@glob@TMPa<\pgfmathfloat@b@E - % ok, scale it: - \multiply\pgfmathfloat@b@E by-1 - \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% - \else - \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@below@exponent}% - \expandafter\ifnum\pgfplots@glob@TMPa>\pgfmathfloat@b@E - % ok, scale it: - \multiply\pgfmathfloat@b@E by-1 - \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% - \else - % no scaling necessary: - \xdef\pgfplots@glob@TMPa{0}% - \fi - \fi - \endgroup - \expandafter\let\csname pgfplots@tick@scale@#1\endcsname=\pgfplots@glob@TMPa% -} - -% x-axis tick labels for #1th tick -% #1: the axis (x or y) -% #2: the value -% #3,#4: coordinates for tikz -% #5: ticknumber -\def\pgfplots@show@ticklabel#1#2(#3,#4)#5{{% - \csname ifpgfplots@#1ticklabel@interval\endcsname - \pgfmathparse{#3}% - \edef\pgfplots@show@ticklabel@coord@x@new{\pgfmathresult pt}% - \pgfmathparse{#4}% - \edef\pgfplots@show@ticklabel@coord@y@new{\pgfmathresult pt}% - % - \pgfplots@show@ticklabel@{#1}{#2}% - \let\nexttick=\tick - \ifx\pgfplots@show@ticklabel@LASTTICK\pgfutil@empty - % its the first call. Simply remember arguments and wait - % for interval boundary before proceeding. - \else - % acquire options of first interval boundary: - \pgfplots@show@ticklabel@LASTTICK - % compute new node position: - \pgfmathparse{0.5*(\csname pgfplots@show@ticklabel@coord@#1\endcsname + \csname pgfplots@show@ticklabel@coord@#1@new\endcsname)}% - \expandafter\edef\csname pgfplots@show@ticklabel@coord@#1\endcsname{\pgfmathresult pt}% - \let\ticknum=\pgfplots@show@ticklabel@num\relax% - \let\tick=\pgfplots@show@ticklabel@tick% - \edef\pgfplots@loc@TMPa{at (\pgfplots@show@ticklabel@coord@x,\pgfplots@show@ticklabel@coord@y)}% - \expandafter\node\pgfplots@loc@TMPa - {\csname pgfplots@#1ticklabel\endcsname};% - \fi - \xdef\pgfplots@show@ticklabel@LASTTICK{% - \noexpand\def\noexpand\pgfplots@show@ticklabel@tick{\nexttick}% - \noexpand\def\noexpand\pgfplots@show@ticklabel@coord@x{\pgfplots@show@ticklabel@coord@x@new}% - \noexpand\def\noexpand\pgfplots@show@ticklabel@coord@y{\pgfplots@show@ticklabel@coord@y@new}% - \noexpand\edef\noexpand\pgfplots@show@ticklabel@num{#5}% - }% - \else - \let\ticknum=#5\relax% - \pgfplots@show@ticklabel@{#1}{#2}% - \node at (#3,#4) {\csname pgfplots@#1ticklabel\endcsname};% - \fi -}} - -% Defines \tick by applying any necessary math to the (possibly -% transformed) tick value #2. -% -% #1: axis (x or y) -% #2: tick value. -\def\pgfplots@show@ticklabel@#1#2{% - \csname ifpgfplots@apply@datatrafo@#1\endcsname - \csname pgfplots@inverse@datascaletrafo@#1\endcsname{#2}% - \pgfplots@if{pgfplots@scaled@ticks@#1}{% - \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% - }\relax - % .. and this here provides \tick as fixed point repr: - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% - \let\tick=\pgfmathresult - \else - \edef\tick{#2}% - \pgfplots@if{pgfplots@#1islinear}{% - \pgfplots@if{pgfplots@scaled@ticks@#1}{% - \pgfmathfloatparsenumber{#2}% - \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% - \let\tick=\pgfmathresult - }{}% - }{}% - \fi - \pgfkeysgetvalue{/pgfplots/#1 coord inv trafo/.@cmd}\pgfplots@loc@TMPa - \ifx\pgfplots@loc@TMPa\pgfplots@empty@command@key - \else - \let\pgfmathresult=\tick% - \expandafter\pgfplots@loc@TMPa\expandafter{\tick}\pgfeov - \let\tick=\pgfmathresult - \fi -}% - -\def\pgfplots@user@ticklabel@list@x{% - \pgfplotslistselectorempty\ticknum\of\pgfplots@xticklabels\to\tick - \tick -} -\def\pgfplots@user@ticklabel@list@y{% - \pgfplotslistselectorempty\ticknum\of\pgfplots@yticklabels\to\tick - \tick -} -\def\pgfplots@user@extra@ticklabel@list@x{% - \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@xticklabels\to\tick - \tick -} -\def\pgfplots@user@extra@ticklabel@list@y{% - \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@yticklabels\to\tick - \tick -} - % #1 axis (x or y) % #2 the label @@ -1500,280 +1946,70 @@ {#1}; } -% Check if a label does not cross the x-axis -\def\pgfplots@ytick@check@tickshow{% - \pgfplots@tickshowtrue - \ifnum\pgfplots@yaxislinesnum=2\relax - \ifcase\pgfplots@xaxislinesnum\relax - \ifdim\pgfplots@tmpa=\pgfplots@ycoordminTEX\relax - \pgfplots@tickshowfalse - \fi - \ifdim\pgfplots@tmpa=\pgfplots@ycoordmaxTEX\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@ycoordminTEX\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@ZERO@y\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@ycoordmaxTEX\relax - \pgfplots@tickshowfalse - \fi - \fi - \fi -} -% Fills the macros -% \pgfplots@tick@beg@a \pgfplots@tick@end@a -% \pgfplots@tick@beg@b \pgfplots@tick@end@b -% with coordinates such that -% (\pgfplots@tick@beg@a,\pgfplots@tmpa) -- (\pgfplots@tick@end@a,\pgfplots@tmpa) -% produces a correct tick line. -% -% The '@b' variant is only used in case of \pgfplots@ytickposnum = 0 -% -% #1 : the current axis (x or y). -% #2 : the axis which is NOT fixed. For x tick lines, this is the y -% axis and for y tick lines, this is the x axis (#1 = x or y) -% #3 : the current tick width -\def\pgfplots@prepare@tick@offsets@for@#1#2#3{% - \ifcase\csname pgfplots@#1tickposnum\endcsname\relax - %(\pgfplots@xcoordminTEX-\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #3, 0pt) - \edef\pgfplots@tick@beg@a{\pgf@sys@tonumber{\csname pgfplots@#2coordminTEX\endcsname}}% - \pgfmathsubtract@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@a=\pgfmathresult - \pgfmathadd@{\pgfplots@tick@beg@a}{#3}% - \edef\pgfplots@tick@beg@a{\pgfplots@tick@beg@a pt}% - \edef\pgfplots@tick@end@a{\pgfmathresult pt}% - % - %(\pgfplots@xcoordmaxTEX+\pgfplots@tick@offset, \pgfplots@tmpa) -- ++(-#3, 0pt) - \edef\pgfplots@tick@beg@b{\pgf@sys@tonumber{\csname pgfplots@#2coordmaxTEX\endcsname}}% - \pgfmathadd@{\pgfplots@tick@beg@b}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@b=\pgfmathresult - \pgfmathsubtract@{\pgfplots@tick@beg@b}{#3}% - \edef\pgfplots@tick@beg@b{\pgfplots@tick@beg@b pt}% - \edef\pgfplots@tick@end@b{\pgfmathresult pt}% - \or - % (\pgfplots@xcoordminTEX-\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #3, 0pt); - \edef\pgfplots@tick@beg@a{\pgf@sys@tonumber{\csname pgfplots@#2coordminTEX\endcsname}}% - \pgfmathsubtract@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@a=\pgfmathresult - \pgfmathadd@{\pgfplots@tick@beg@a}{#3}% - \edef\pgfplots@tick@beg@a{\pgfplots@tick@beg@a pt}% - \edef\pgfplots@tick@end@a{\pgfmathresult pt}% - \or - % (\pgfplots@ZERO@x -\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #3, 0pt); - \pgf@xa=\csname pgfplots@ZERO@#2\endcsname - \edef\pgfplots@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}% - \pgfmathsubtract@{\pgfplots@loc@TMPa}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@a=\pgfmathresult - \pgfmathadd@{\pgfplots@tick@beg@a}{#3}% - \edef\pgfplots@tick@beg@a{\pgfplots@tick@beg@a pt}% - \edef\pgfplots@tick@end@a{\pgfmathresult pt}% - \or - % (\pgfplots@xcoordmaxTEX+\pgfplots@tick@offset, \pgfplots@tmpa) -- ++(-#3, 0pt); - \edef\pgfplots@tick@beg@a{\pgf@sys@tonumber{\csname pgfplots@#2coordmaxTEX\endcsname}}% - \pgfmathadd@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@a=\pgfmathresult - \pgfmathsubtract@{\pgfplots@tick@beg@a}{#3}% - \edef\pgfplots@tick@beg@a{\pgfplots@tick@beg@a pt}% - \edef\pgfplots@tick@end@a{\pgfmathresult pt}% - \fi -}% - -\def\pgfplots@drawyaxis@placecomputedtick{% - \pgfpathmoveto{\pgfqpoint{\pgfplots@tick@beg@a}{\pgfplots@tmpa}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tick@end@a}{\pgfplots@tmpa}}% - \ifnum\pgfplots@ytickposnum=0\relax - \pgfpathmoveto{\pgfqpoint{\pgfplots@tick@beg@b}{\pgfplots@tmpa}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tick@end@b}{\pgfplots@tmpa}}% - \fi -}% -\def\pgfplots@drawyaxis@placecomputedgridline{% - \pgfpathmoveto{\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@tmpa}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@xcoordmaxTEX}{\pgfplots@tmpa}}% -}% - -\newif\ifpgfplots@needsminorloop - -\def\pgfplots@draw@tick@scale@label@for#1{% - \csname ifpgfplots@#1islinear\endcsname - \pgfplots@if{pgfplots@scaled@ticks@#1}{% - \begingroup - \xdef\pgfplots@glob@TMPa{\csname pgfplots@tick@scale@#1\endcsname}% - \expandafter\c@pgf@counta\pgfplots@glob@TMPa\relax - \multiply\c@pgf@counta by-1 - \ifnum\c@pgf@counta=0\relax - \global\let\pgfplots@glob@TMPa=\pgfutil@empty - \else - \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% - \fi - \endgroup - \ifx\pgfplots@glob@TMPa\pgfutil@empty - \else - \edef\pgfplots@tick@scale@labels{\noexpand\pgfplots@invoke@pgfkeyscode{/pgfplots/tick scale label code/.@cmd}{\pgfplots@glob@TMPa}}% - \node - [% - xshift=\pgfplots@xcoordminTEX,% - yshift=\pgfplots@ycoordminTEX,% - x=\pgfplots@xcoordmaxTEX-\pgfplots@xcoordminTEX,% - y=\pgfplots@ycoordmaxTEX-\pgfplots@ycoordminTEX,% - /pgfplots/every tick label,% - /pgfplots/every #1 tick label,% - /pgfplots/every #1 tick scale label] - {\pgfplots@tick@scale@labels}; - \fi - }{\relax}% - \fi -} - -% Simply invokes the code of PGF key #1 with value #2, that means -% #1#2\pgfeov -\def\pgfplots@invoke@pgfkeyscode#1#2{% - \pgfkeysgetvalue{#1}\pgfplots@invoke@pgfkeyscode@CODE - \pgfplots@invoke@pgfkeyscode@CODE#2\pgfeov -} - -% Check if the current tick position, stored in \pgfplots@tmpa, -% does not cross the y-axis. -% -% This is just a special case for centered axis lines. -\def\pgfplots@xtick@check@tickshow{% - \pgfplots@tickshowtrue - \ifnum\pgfplots@xaxislinesnum=2\relax - \ifcase\pgfplots@yaxislinesnum\relax - \ifdim\pgfplots@tmpa=\pgfplots@xcoordminTEX\relax - \pgfplots@tickshowfalse - \fi - \ifdim\pgfplots@tmpa=\pgfplots@xcoordmaxTEX\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@xcoordminTEX\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@ZERO@x\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@xcoordmaxTEX\relax - \pgfplots@tickshowfalse - \fi - \fi - \fi -} - -\def\pgfplots@drawxaxis@placecomputedtick{% - \pgfpathmoveto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@tick@beg@a}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@tick@end@a}}% - \ifnum\pgfplots@xtickposnum=0\relax - \pgfpathmoveto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@tick@beg@b}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@tick@end@b}}% - \fi -}% -\def\pgfplots@drawxaxis@placecomputedgridline{% - \pgfpathmoveto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@ycoordminTEX}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@ycoordmaxTEX}}% -}% - -% #1: axis (x or y) -% #2: axis index (0 or 1) -% #3: tick position list -\def\pgfplots@draw@extra@ticks@for#1#2#3{% - \begingroup - \pgfplots@scaled@ticks@xfalse - \pgfplots@scaled@ticks@yfalse - \csname pgfplots@#1minorticksfalse\endcsname - \csname pgfplots@#1minorgridsfalse\endcsname - \expandafter\let\expandafter\axis@TMP\csname pgfplots@extra@#1ticklabel\endcsname - \expandafter\let\csname pgfplots@#1ticklabel\endcsname=\axis@TMP - \pgfplotsset{/pgfplots/every extra #1 tick}% FIXME : used 'search path for tikz' before... - \pgfplots@prepare@ticks@for{#3}{#1}{#2}% - \pgfplots@drawgridlines@for{#1}{#2}% - \pgfplots@drawticklines@for{#1}{#2}% - \pgfplots@drawticklabels@for{#1}{#2}% - \endgroup -} - -\def\pgfplots@drawaxis@innerlines{% - \ifpgfplots@hide@y\else - \ifnum\pgfplots@yaxislinesnum=2 - \draw[/pgfplots/every inner y axis line,% - decorate,% - ydiscont,% - decoration={pre length=\ydisstart, post length=\ydisend}] - (\pgfplots@ZERO@x, \pgfplots@ycoordminTEX) -- (\pgfplots@ZERO@x, \pgfplots@ycoordmaxTEX); - \fi - \fi - \ifpgfplots@hide@x\else - \ifnum\pgfplots@xaxislinesnum=2 - \draw[/pgfplots/every inner x axis line,% - decorate,% - xdiscont,% - decoration={pre length=\xdisstart, post length=\xdisend}] - (\pgfplots@xcoordminTEX, \pgfplots@ZERO@y) -- (\pgfplots@xcoordmaxTEX, \pgfplots@ZERO@y); - \fi +% #1: the 'a' axis on the oriented surface (the same as \pgfplotspointonorientedsurfaceA) +% #2: the 'b' axis on the orentied surface (the same as \pgfplotspointonorientedsurfaceB) +\def\pgfplots@drawaxis@innerlines@onorientedsurf#1#2#3{% + \ifnum\csname pgfplots@#1axislinesnum\endcsname=2 + \draw[/pgfplots/every inner #1 axis line,% + decorate,% + #1discont,% + decoration={pre length=\csname #1disstart\endcsname, post length=\csname #1disend\endcsname}] + \pgfextra + \csname pgfplotspointonorientedsurfaceabsetupforset#3\endcsname{\csname pgfplots@logical@ZERO@#3\endcsname}{2}% + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@logical@ZERO@#2\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@logical@ZERO@#2\endcsname}}% + \endpgfextra + ; \fi }% % Ok, we don't mind whether edges with thick lines look ugly. We just % draw separate lines. This here is necessary if we want arrow heads. -\def\pgfplots@drawaxis@outerlines@separate{% - \ifpgfplots@hide@x - \else - \scope[/pgfplots/every outer x axis line, - xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] - \ifcase\pgfplots@xaxislinesnum - \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) }; - \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordmaxTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; - - \or - \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) }; - \or - \or +% +% #1: the 'a' axis on the oriented surface (the same as \pgfplotspointonorientedsurfaceA) +% #2: the 'b' axis on the orentied surface (the same as \pgfplotspointonorientedsurfaceB) +\def\pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2{% + \scope[/pgfplots/every outer #1 axis line, + #1discont,decoration={pre length=\csname #1disstart\endcsname, post length=\csname #1disend\endcsname}] + \ifcase\csname pgfplots@#1axislinesnum\endcsname\relax + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordmaxTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; - - \fi - \endscope - \fi - \ifpgfplots@hide@y - \else - \scope[/pgfplots/every outer y axis line, - ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] - \ifcase\pgfplots@yaxislinesnum - \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordminTEX,\pgfplots@ycoordmaxTEX) }; + \pgfextra + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2min\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2min\endcsname}}% + \endpgfextra + }; + }{\relax}% + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% \draw decorate { - (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; - - \or + \pgfextra + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2max\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2max\endcsname}}% + \endpgfextra + }; + }{\relax}% + \or + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordminTEX,\pgfplots@ycoordmaxTEX) }; - \or - \or + \pgfextra + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2min\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2min\endcsname}}% + \endpgfextra + }; + }{\relax}% + \or + \or + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% \draw decorate { - (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; - - \fi - \endscope + \pgfextra + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2max\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2max\endcsname}}% + \endpgfextra + }; + }{\relax}% \fi + \endscope }% % This here is complicated: we try to create good edges and draw a @@ -1783,494 +2019,104 @@ % | | % | | % ----- +% +% ATTENTION: this thing is used IF AND ONLY IF d=2 and the axis is +% drawn as box. \def\pgfplots@drawaxis@outerlines@cycledpath{% \draw[ /pgfplots/every outer x axis line, % FIXME! these outer styles need much more attention :-( /pgfplots/every outer y axis line] - (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) + (\pgfplots@xmin, \pgfplots@ymin) \ifpgfplots@hide@y - { (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } + { (\pgfplots@xmin, \pgfplots@ymax) } \else \ifcase\pgfplots@yaxislinesnum - decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } - \or decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } - \or { (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } - \or { (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } + decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xmin, \pgfplots@ymax) } + \or decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xmin, \pgfplots@ymax) } + \or { (\pgfplots@xmin, \pgfplots@ymax) } + \or { (\pgfplots@xmin, \pgfplots@ymax) } \fi \fi \ifpgfplots@hide@x - { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } + { (\pgfplots@xmax, \pgfplots@ymax) } \else \ifcase\pgfplots@xaxislinesnum - decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } - \or { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } - \or { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } - \or decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } + decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xmax, \pgfplots@ymax) } + \or { (\pgfplots@xmax, \pgfplots@ymax) } + \or { (\pgfplots@xmax, \pgfplots@ymax) } + \or decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xmax, \pgfplots@ymax) } \fi \fi \ifpgfplots@hide@y - { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } + { (\pgfplots@xmax, \pgfplots@ymin) } \else \ifcase\pgfplots@yaxislinesnum - decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } - \or { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } - \or { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } - \or decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } + decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xmax, \pgfplots@ymin) } + \or { (\pgfplots@xmax, \pgfplots@ymin) } + \or { (\pgfplots@xmax, \pgfplots@ymin) } + \or decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xmax, \pgfplots@ymin) } \fi \fi \ifpgfplots@hide@x - { (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } + { (\pgfplots@xmin, \pgfplots@ymin) } \else \ifcase\pgfplots@xaxislinesnum - decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } - \or decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } - \or { (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } - \or { (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } + decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xmin, \pgfplots@ymin) } + \or decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xmin, \pgfplots@ymin) } + \or { (\pgfplots@xmin, \pgfplots@ymin) } + \or { (\pgfplots@xmin, \pgfplots@ymin) } \fi% can't use cycle here! \fi ; % -- cycle; }% -\def\pgfplots@drawaxis@outerlines{% - \ifnum\pgfplots@xaxislinesnum>0 - \pgfplots@separate@axis@linestrue - \fi - \ifnum\pgfplots@yaxislinesnum>0 - \pgfplots@separate@axis@linestrue - \fi - \ifpgfplots@separate@axis@lines - \pgfplots@drawaxis@outerlines@separate - \else - \pgfplots@drawaxis@outerlines@cycledpath - \fi -}% - -\def\pgfplots@drawaxis@lines{% - \begingroup - \begingroup - % this group employs several temporary dimension registers - % and is therefor scoped: - \let\ydisstart=\pgf@xa - \let\ydisend=\pgf@xb - \let\xdisstart=\pgf@ya - \let\xdisend=\pgf@yb - \ydisend=\pgfplots@ycoordmaxTEX - \advance \ydisend by -\pgfplots@ycoordminTEX - \ifcase\pgfplots@yaxisdiscontnum\relax - \let\ydiscontstyle=\pgfutil@empty - \or - \def\ydiscontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}% - \advance \ydisend by -16pt - \or - \def\ydiscontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}% - \advance \ydisend by -8pt - \fi - \ifpgfplots@apply@datatrafo@y - \advance \pgfplots@ycoordmaxTEX by\pgfplots@data@scale@trafo@SHIFT@y pt - \fi - \ifdim\pgfplots@ycoordmaxTEX<0pt - \ydisstart=\ydisend - \ydisend=4pt - \else - \ydisstart=4pt - \fi - \ifpgfplots@apply@datatrafo@y - \advance \pgfplots@ycoordmaxTEX by-\pgfplots@data@scale@trafo@SHIFT@y pt - \fi - \xdisend=\pgfplots@xcoordmaxTEX - \advance \xdisend by -\pgfplots@xcoordminTEX - \ifcase\pgfplots@xaxisdiscontnum\relax - \let\xdiscontstyle=\pgfutil@empty - \or - \def\xdiscontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}% - \advance \xdisend by -16pt - \or - \def\xdiscontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}% - \advance \xdisend by -8pt - \fi - \ifpgfplots@apply@datatrafo@x - \advance \pgfplots@xcoordmaxTEX by\pgfplots@data@scale@trafo@SHIFT@x pt - \fi - \ifdim\pgfplots@xcoordmaxTEX<0pt - \xdisstart=\xdisend - \xdisend=4pt - \else - \xdisstart=4pt - \fi - \ifpgfplots@apply@datatrafo@x - \advance \pgfplots@xcoordmaxTEX by-\pgfplots@data@scale@trafo@SHIFT@x pt - \fi - % carry local computations outside of group: - \xdef\pgfplots@glob@TMPa{% - \noexpand\def\noexpand\xdisstart{\the\xdisstart}% - \noexpand\def\noexpand\xdisend{\the\xdisend}% - \noexpand\def\noexpand\ydisstart{\the\ydisstart}% - \noexpand\def\noexpand\ydisend{\the\ydisend}% - \noexpand\pgfkeys{% - /tikz/xdiscont/.style={\xdiscontstyle},% - /tikz/ydiscont/.style={\ydiscontstyle}}% - }% - \endgroup - \pgfplots@glob@TMPa - \pgfplots@drawaxis@outerlines% - \pgfplots@drawaxis@innerlines% - \endgroup -}% - -% Computes final major and minor tick positions into global lists -% \pgfplots@prepared@tick@positions@major@x -% and -% \pgfplots@prepared@tick@positions@minor@x. -% -% The major tick list contains tuples (canvas position,logical position) -% while the minor tick list contains just the canvas position. +% Assigns the macros +% #1disstart +% #1disend +% and the key /tikz/#1discont for use in the axis line routines. % -% #1: the tick list. -% #2: the axis name as character, i.e. 'x' or 'y' -% #3: the axis name as integer, i.e. 0 or 1 -\def\pgfplots@prepare@ticks@for#1#2#3{% - \begingroup - \expandafter\let\expandafter\ifpgfplots@islinear\csname ifpgfplots@#2islinear\endcsname - \expandafter\let\expandafter\ifpgfplots@minorticks\csname ifpgfplots@#2minorticks\endcsname - \expandafter\let\expandafter\ifpgfplots@minorgrids\csname ifpgfplots@#2minorgrids\endcsname - % these lists need to be global such that I can fill them inside - % of \foreach statements. And, yes: I have also added a TeX group - % on my own (but that's not the problem). - \global\pgfplotslistnewempty\pgfplots@prepared@tick@positions@major - \global\pgfplotslistnewempty\pgfplots@prepared@tick@positions@minor - \edef\pgfplots@loc@TMPa{#1}% - \ifx\pgfplots@loc@TMPa\pgfutil@empty - \else - \ifpgfplots@minorticks - \pgfplots@needsminorlooptrue - \else - \ifpgfplots@minorgrids - \pgfplots@needsminorlooptrue - \else - \pgfplots@needsminorloopfalse - \fi - \fi - \ifpgfplots@needsminorloop - \ifpgfplots@islinear - \expandafter\let\expandafter\pgfplots@minor@tick@num\csname pgfplots@minor@#2tick@num\endcsname - \begingroup - \c@pgf@counta=\pgfplots@minor@tick@num\relax - \advance\c@pgf@counta by1\relax - \pgfplots@tmpa=\csname pgfplots@tick@distance@#2\endcsname pt - \divide\pgfplots@tmpa by\c@pgf@counta - \edef\pgfmathresult{\pgf@sys@tonumber{\pgfplots@tmpa}}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - \let\pgfplots@minor@tick@dist=\pgfmathresult - \else - \def\pgfplots@minor@tick@num{9}% - \fi - \fi - \foreach \x in {#1} {% - \ifcase#3\relax - \pgfextractx{\pgfplots@tmpa}{\pgfpointxy{\x}{0}}% - \or - \pgfextracty{\pgfplots@tmpa}{\pgfpointxy{0}{\x}}% - \fi - \csname pgfplots@#2tick@check@tickshow\endcsname - % - \ifpgfplots@tickshow - \ifdim\pgfplots@tmpa<\csname pgfplots@#2coordminTEX\endcsname - \else - \ifdim\pgfplots@tmpa>\csname pgfplots@#2coordmaxTEX\endcsname - \else - \edef\pgfplots@loc@TMPa{{\the\pgfplots@tmpa}{\x}}% - \expandafter\pgfplotslistpushbackglobal\pgfplots@loc@TMPa\to\pgfplots@prepared@tick@positions@major - \fi - \fi - \fi - % X-Axis ticks bottom and top - % in log: - % log( i*10^k ) = log\pgfplots@i + k\log10 -> draw ticks for i=1..9 - \ifpgfplots@needsminorloop - \foreach \pgfplots@i in {1,...,\pgfplots@minor@tick@num} {% - \begingroup - \ifcase#3\relax - \ifpgfplots@islinear - \pgfextractx{\pgfplots@tmpa}{\pgfpointxy{\pgfplots@i*\pgfplots@minor@tick@dist}{0}}% - \else - \pgfextractx{\pgfplots@tmpa}{\pgfpointxy{\logi\pgfplots@i}{0}}% - \fi - \or - \ifpgfplots@islinear - \pgfextracty{\pgfplots@tmpa}{\pgfpointxy{0}{\pgfplots@i*\pgfplots@minor@tick@dist}}% - \else - \pgfextracty{\pgfplots@tmpa}{\pgfpointxy{0}{\logi\pgfplots@i}}% - \fi - \fi - \edef\pgfmathresult{\the\pgfplots@tmpa}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - \advance\pgfplots@tmpa by\pgfmathresult\relax - \ifdim\pgfplots@tmpa<\csname pgfplots@#2coordminTEX\endcsname - \else - \ifdim\pgfplots@tmpa>\csname pgfplots@#2coordmaxTEX\endcsname - \else - \expandafter\pgfplotslistpushbackglobal\the\pgfplots@tmpa\to\pgfplots@prepared@tick@positions@minor - \fi - \fi - }% - \fi - }% - \fi - \endgroup - \expandafter\let\csname pgfplots@prepared@tick@positions@minor@#2\endcsname=\pgfplots@prepared@tick@positions@minor - \expandafter\let\csname pgfplots@prepared@tick@positions@major@#2\endcsname=\pgfplots@prepared@tick@positions@major - \global\let\pgfplots@prepared@tick@positions@major=\relax - \global\let\pgfplots@prepared@tick@positions@minor=\relax -}% - -% Converts the tuples in major tick lists into two separate variables. -% -% Usage: -% \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@x\as\curelement{% -% \expandafter\pgfplots@parse@prepared@major@tickpos\curelement\canvas\logical -% } -% -% #1#2 : the tuples as they are found in the prepared major tick list, -% #3 : a dimen register which will be filled with #1 -% #4 : a macro which will be assigned with #2 -\def\pgfplots@parse@prepared@major@tickpos#1#2#3#4{% - #3=#1\relax% - \def#4{#2}% -}% - - -% #1 : the verbatim axis name (either 'x' or 'y') -% #2 : the index of the axis (either 0 or 1) -\def\pgfplots@drawgridlines@for#1#2{% - \begingroup - \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorgrids\endcsname - \expandafter\let\expandafter\ifpgfplots@minor\csname ifpgfplots@#1minorgrids\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname - \pgfplots@loop@CONTINUEfalse - \ifpgfplots@major - \pgfplots@loop@CONTINUEtrue - \fi - \ifpgfplots@minor - \pgfplots@loop@CONTINUEtrue - \fi - \ifpgfplots@loop@CONTINUE - \scope - %\clip (\pgfplots@xcoordminTEX\pgfplots@leftover, \pgfplots@ycoordminTEX\pgfplots@leftover) - % rectangle (\pgfplots@xcoordmaxTEX\pgfplots@rightover, \pgfplots@ycoordmaxTEX\pgfplots@rightover); - \pgfinterruptboundingbox% - \ifcase#2\relax - \clip (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX-5cm) - rectangle (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX+5cm); - \or - \clip (\pgfplots@xcoordminTEX-5cm, \pgfplots@ycoordminTEX) - rectangle (\pgfplots@xcoordmaxTEX+5cm, \pgfplots@ycoordmaxTEX); - \fi - \endpgfinterruptboundingbox% - \ifpgfplots@major - \draw[% - /pgfplots/every axis grid, - /pgfplots/every major grid, - /pgfplots/every axis #1 grid, - /pgfplots/every major #1 grid]% - \pgfextra - \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curgridpos{% - \expandafter\pgfplots@parse@prepared@major@tickpos\pgfplots@curgridpos\pgfplots@tmpa\pgfplots@curgridpos - \csname pgfplots@draw#1axis@placecomputedgridline\endcsname - }% - \endpgfextra; - \fi - % - \ifpgfplots@minor - \draw[% - /pgfplots/every axis grid, - /pgfplots/every minor grid, - /pgfplots/every axis #1 grid, - /pgfplots/every minor #1 grid]% - \pgfextra - \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curgridpos{% - \pgfplots@tmpa=\pgfplots@curgridpos - \csname pgfplots@draw#1axis@placecomputedgridline\endcsname - }% - \endpgfextra; - \fi - \endscope - \fi - \endgroup -} - -% #1 : the verbatim axis name (either 'x' or 'y') -% #2 : the index of the axis (either 0 or 1) -\def\pgfplots@drawticklines@for#1#2{% - \scope - \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorticks\endcsname - \expandafter\let\expandafter\ifpgfplots@minor\csname ifpgfplots@#1minorticks\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname - %\clip (\pgfplots@xcoordminTEX\pgfplots@leftover, \pgfplots@ycoordminTEX\pgfplots@leftover) - % rectangle (\pgfplots@xcoordmaxTEX\pgfplots@rightover, \pgfplots@ycoordmaxTEX\pgfplots@rightover); - \pgfinterruptboundingbox% - \ifcase#2\relax - \clip (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX-5cm) - rectangle (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX+5cm); - \or - \clip (\pgfplots@xcoordminTEX-5cm, \pgfplots@ycoordminTEX) - rectangle (\pgfplots@xcoordmaxTEX+5cm, \pgfplots@ycoordmaxTEX); - \fi - \endpgfinterruptboundingbox% - \ifpgfplots@major - \draw[% - /pgfplots/every tick, - /pgfplots/every major tick, - /pgfplots/every #1 tick, - /pgfplots/every major #1 tick]% - \pgfextra - \pgfmathparse{\pgfplots@tickwidth}% - \let\pgfplots@tickwidth@=\pgfmathresult - \edef\pgfplots@tickwidth{\pgfplots@tickwidth@ pt}% - \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax - \def\pgfplots@tick@offset{0} - \or - \let\pgfplots@tick@offset=\pgfplots@tickwidth@% - \or - \pgfmathmultiply@{0.5}{\pgfplots@tickwidth@}% - \let\pgfplots@tick@offset=\pgfmathresult% - \fi - \ifcase#2\relax - \pgfplots@prepare@tick@offsets@for@{#1}{y}{\pgfplots@tickwidth@}% - \else - \pgfplots@prepare@tick@offsets@for@{#1}{x}{\pgfplots@tickwidth@}% - \fi - \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curtickpos{% - \expandafter\pgfplots@parse@prepared@major@tickpos\pgfplots@curtickpos\pgfplots@tmpa\pgfplots@curtickpos - \csname pgfplots@draw#1axis@placecomputedtick\endcsname - }% - \endpgfextra; - \fi - % - \ifpgfplots@minor - \draw[% - /pgfplots/every tick, - /pgfplots/every minor tick, - /pgfplots/every #1 tick, - /pgfplots/every minor #1 tick]% - \pgfextra - \pgfmathparse{\pgfplots@subtickwidth}% - \let\pgfplots@subtickwidth@=\pgfmathresult - \edef\pgfplots@subtickwidth{\pgfplots@subtickwidth@ pt}% - \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax - \def\pgfplots@tick@offset{0}% - \or - \let\pgfplots@tick@offset=\pgfplots@subtickwidth@% - \or - \pgfmathmultiply@{0.5}{\pgfplots@subtickwidth@}% - \let\pgfplots@tick@offset=\pgfmathresult% - \fi - \ifcase#2\relax - \pgfplots@prepare@tick@offsets@for@{#1}{y}{\pgfplots@subtickwidth@}% - \else - \pgfplots@prepare@tick@offsets@for@{#1}{x}{\pgfplots@subtickwidth@}% - \fi - \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curtickpos{% - \pgfplots@tmpa=\pgfplots@curtickpos - \csname pgfplots@draw#1axis@placecomputedtick\endcsname - }% - \endpgfextra; - \fi - \endscope -} - -% #1 : the verbatim axis name (either 'x' or 'y') -% #2 : the index of the axis (either 0 or 1) -\def\pgfplots@drawticklabels@for#1#2{% - \begingroup - \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorticks\endcsname - \expandafter\let\expandafter\ifpgfplots@islinear\csname ifpgfplots@#1islinear\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname - \ifpgfplots@major - \ifpgfplots@islinear - \pgfplots@if{pgfplots@scaled@ticks@#1}{% - \pgfplots@init@scaled@tick@for{#1}% - }\relax% - \fi +% #1 : either x or y. +\def\pgfplots@drawaxis@lines@preparediscont@for#1{% + \ifnum\csname pgfplots@#1axisdiscontnum\endcsname>0 \begingroup - \pgfkeys{/tikz/every node/.append style={/pgfplots/every tick label,/pgfplots/every #1 tick label}}% - \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax - \def\pgfmathresult{0}% - \or - \pgfmathparse{\pgfplots@tickwidth}% + % this group employs several temporary dimension registers + % and is therefor scoped: + \let\disstart=\pgf@ya + \let\disend=\pgf@yb + \disend=\csname pgfplots@#1max@reg\endcsname + \advance\disend by -\csname pgfplots@#1min@reg\endcsname + \disend=\csname pgfplots@#1@veclength\endcsname\disend + \ifcase\csname pgfplots@#1axisdiscontnum\endcsname\relax + % has already been checked above. \or - \pgfmathmultiply{0.5}{\pgfplots@tickwidth}% - \fi - \let\pgfplots@tick@offset=\pgfmathresult - \ifnum\csname pgfplots@#1ticklabelposnum\endcsname=0 - % the choice '[xy]ticklabel pos=default': - \expandafter\let\expandafter\pgfplots@tmpposnum\csname pgfplots@#1tickposnum\endcsname - \else - \expandafter\let\expandafter\pgfplots@tmpposnum\csname pgfplots@#1ticklabelposnum\endcsname - \fi - \ifcase#2\relax - \ifcase\pgfplots@tmpposnum\relax - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@ycoordminTEX}}% - \or - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@ycoordminTEX}}% - \or - \pgf@xa=\pgfplots@ZERO@y - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgf@xa}}% - \or - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@ycoordmaxTEX}}% - \fi - \def\pgfplots@tickposchoicea{\tikzset{above}}% - \def\pgfplots@tickposchoiceb{\tikzset{below}}% + \def\discontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}% + \advance \disend by -16pt \or - \ifcase\pgfplots@tmpposnum\relax - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@xcoordminTEX}}% - \or - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@xcoordminTEX}}% - \or - \pgf@xa=\pgfplots@ZERO@x - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgf@xa}}% - \or - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@xcoordmaxTEX}}% - \fi - \def\pgfplots@tickposchoicea{\tikzset{right}}% - \def\pgfplots@tickposchoiceb{\tikzset{left}}% - \fi - \ifnum\pgfplots@tmpposnum=3 - \pgfplots@tickposchoicea - \pgfmathadd@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \def\discontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}% + \advance \disend by -8pt + \fi + % if #1max + shift < 0pt (shift is 0 without the scaling trafo) + \ifdim\csname pgfplots@#1max@reg\endcsname<-\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname pt + % swap start and end + \disstart=\disend + \disend=4pt \else - \pgfplots@tickposchoiceb - \pgfmathsubtract@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \disstart=4pt \fi - \edef\pgfplots@tick@origin{\pgfmathresult pt}% - \def\pgfplots@ticknum{0}% - \xdef\pgfplots@show@ticklabel@LASTTICK{}% - \pgfplotslistforeachungrouped\pgfplots@prepared@tick@positions@major@\as\pgfplots@curtickpos{% - \expandafter\pgfplots@parse@prepared@major@tickpos\pgfplots@curtickpos\pgfplots@tmpa\pgfplots@curtickpos - \ifcase#2\relax - \pgfplots@show@ticklabel - {#1}{\pgfplots@curtickpos}(\pgfplots@tmpa,\pgfplots@tick@origin)% - {\pgfplots@ticknum}% - \or - \pgfplots@show@ticklabel - {#1}{\pgfplots@curtickpos}(\pgfplots@tick@origin,\pgfplots@tmpa)% - {\pgfplots@ticknum}% - \fi - \begingroup - \c@pgf@counta=\pgfplots@ticknum\relax - \advance\c@pgf@counta by1 - \edef\pgfplots@ticknum{\the\c@pgf@counta}% - \pgfmath@smuggleone\pgfplots@ticknum - \endgroup + % carry local computations outside of group: + \xdef\pgfplots@glob@TMPa{% + \noexpand\def\expandafter\noexpand\csname #1disstart\endcsname{\the\disstart}% + \noexpand\def\expandafter\noexpand\csname #1disend\endcsname{\the\disend}% + \noexpand\pgfkeysdef{/tikz/#1discont}{\noexpand\pgfkeysalso{\discontstyle}}% }% \endgroup - \pgfplots@draw@tick@scale@label@for #1% + \pgfplots@glob@TMPa + \else + \expandafter\def\csname #1disstart\endcsname{0pt}% + \expandafter\def\csname #1disend\endcsname{0pt}% + \pgfkeyslet{/tikz/#1discont}=\pgfutil@empty \fi - \endgroup -} +}% \def\pgfplots@rememberplotspec#1{% \pgfplotslistpushbackglobal{#1}\to\pgfplots@plotspeclist @@ -2283,7 +2129,7 @@ \else \c@pgf@countb=\pgfplots@numplots % offset modulo size: - \loop + \pgfutil@loop \ifnum\c@pgf@countb<\c@pgf@counta \pgfplots@loop@CONTINUEfalse \else @@ -2291,1474 +2137,42 @@ \fi \ifpgfplots@loop@CONTINUE \advance\c@pgf@countb by-\c@pgf@counta - \repeat + \pgfutil@repeat \pgfplotslistselect\c@pgf@countb\of\autoplotspeclist\to#1 %\pgfplots@message{pgfplots.sty: using \string\autoplotspeclist\ specification no\#\the\c@pgf@countb (of \the\c@pgf@counta): #1}% \fi } -% The main interface to draw a plot into an axis. -% -% Usage: -% \addplot -% plot coordinates { -% (0,0) -% (1,1) -% }; -% -% or -% -% \addplot[color=blue,mark=*] -% plot coordinates { -% (0,0) -% (1,1) -% }; -% -% The first syntax will use the next plot specification in the list -% \autoplotspeclist -% and the first will use blue color and * markers. -% -% \addplot[<style options>] plot[<behavior options>] <input type and args> <post plot path> ; -% -% -% The linespec. will be used in the legend. -% -% Low-level implementation: -% -% \pgfplots@addplot -% \pgfplots@addplotimpl -% \pgfplots@start@plot@with@behavioroptions <--- \begingroup -% ... -% ... remember options GLOBALLY -% ... update limits GLOBALLY -% ... \pgfplots@addplot@enqueue@coords GLOBALLY -% ... -% \pgfplots@end@plot <--- \endgroup -\long\def\pgfplots@addplot{% - \pgfutil@ifnextchar+{% - \pgfplots@getautoplotspec into\nextplotspec - \pgfplots@addplotimplAPPEND - }{% - \pgfutil@ifnextchar[{% - \pgfplots@addplotimpl% - }{% - \pgfplots@getautoplotspec into\nextplotspec - % the space after ']' is required here: - % FIXME: - % - \addplot[]plot coordinates is NOT allowed!? - \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec]% - }% - }% -} - -\long\def\pgfplots@addplotimplAPPEND+[{% - \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec, -} - -\long\def\pgfplots@addplotimpl[#1]{% - \pgfutil@ifnextchar p{% - \pgfplots@addplotimpl@plot{#1}% - }{% - \pgfplots@addplotimpl@plot{#1}plot - }% -} -\def\pgfplots@addplotimpl@plot#1plot{% - \pgfutil@ifnextchar[{% - \pgfplots@addplotimpl@plot@withoptions{#1}% - }{% - \pgfplots@addplotimpl@plot@withoptions{#1}[]% - }% +\long\def\pgfplots@path#1;{% + \pgfplots@path@enqueue{#1;}% } -\def\pgfplots@addplotimpl@plot@withoptions#1[#2]{ - \pgfplots@start@plot@with@behavioroptions{#2}% - \pgfutil@ifnextchar c{% - \pgfplots@addplotimpl@coordinates{#1}plot - }{% - \pgfutil@ifnextchar f{% - \pgfplots@addplotimpl@f{#1}% - }{% - \pgfutil@ifnextchar t{% - \pgfplots@addplotimpl@table{#1}% - }{% - \pgfutil@ifnextchar ({% - \pgfplots@addplotimpl@expression{#1}% - }{% - \pgfplots@error{Sorry, the supplied plot command is unknown or unsupported by pgfplots! Ignoring it.}% - \pgfplots@gobble@until@semicolon - }% - }% - }% - }% +% This thing here shall be used to replace any '\path' where \axispath +% shall be used. +\long\def\pgfplots@replacement@for@tikz@path#1;{% + \axispath\path#1;% } -\def\pgfplots@gobble@until@semicolon#1;{} - -% Currently, plot expression is really inefficient: -% -% 1. it invokes the math parser to get all coordinates. Ok, that's -% what one expects. -% -% 2. It collects the result into one large list instead of calling -% pgfplots' stream methods. That's because \foreach encapsulates its -% code in at least one TeX-group. -% -% 3. It processes the collected list; applying any floating point -% parser routines - it does NOT know that any numbers are already in -% TeX-precision! -% -\long\def\pgfplots@addplotimpl@expression#1(#2,#3)#4;{% - \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% - % - \pgfplots@gettikzinternal@keyval{variable}{tikz@plot@var}{\x}% - \pgfplots@gettikzinternal@keyval{samples at}{tikz@plot@samplesat}{-5,-4.6,...,5}% - % - \edef\pgfplots@plot@data{\noexpand\foreach\expandafter\noexpand\tikz@plot@var in {\tikz@plot@samplesat}}% - \pgfplotsapplistXXglobalnewempty - \pgfplots@plot@data{% - \pgfmathparse{#2}% - \let\pgfplots@current@point@x=\pgfmathresult - \pgfmathparse{#3}% - \let\pgfplots@current@point@y=\pgfmathresult - \edef\pgfplots@loc@TMPa{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% - \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@loc@TMPa}% - }% - \pgfplotsapplistXXgloballet\pgfplots@loc@TMPa - \pgfplotsapplistXXglobalclear - \expandafter\pgfplots@coord@stream@foreach\expandafter{\pgfplots@loc@TMPa}% -}% - -\def\pgfplots@addplotimpl@f#1f{% - \pgfutil@ifnextchar i{\pgfplots@addplotimpl@file{#1}}{\pgfplots@addplotimpl@function{#1}}% -}% - -\let\pgfplots@backupof@pgfplotxyfile=\pgfplotxyfile - -% the following code -% results finally in -% -% set format "%.7e";; set samples <...>; plot ... -% -% The windows port of gnuplot doesn't run without the second semicolon -% - for whatever reason. { - \catcode`\%=12 - \catcode`\"=12 - \xdef\pgfplots@gnuplot@format{set format "%.7e";} -} - -% #1: args of \addplot[...] -% #2: file name -% #3: trailing path commands until ';' -\def\pgfplots@addplotimpl@function#1unction#2#3;{% - \pgfplots@gettikzinternal@keyval{prefix}{tikz@plot@prefix}{\jobname.}% - \pgfplots@gettikzinternal@keyval{id}{tikz@plot@id}{pgf-plot}% - \pgfplots@gettikzinternal@keyval{samples}{tikz@plot@samples}{25}% - \pgfplots@gettikzinternal@keyval{domain}{tikz@plot@domain}{-5:5}% - \pgfplots@gettikzinternal@keyval{raw gnuplot}{iftikz@plot@raw@gnuplot}{\iffalse}% - \pgfplots@gettikzinternal@keyval{parametric}{iftikz@plot@parametric}{\iffalse}% - % - \def\pgfplots@plot@filename{\tikz@plot@prefix\tikz@plot@id}% - \iftikz@plot@raw@gnuplot% - \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{#2}}% - \else% - \iftikz@plot@parametric% - \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{% - \pgfplots@gnuplot@format; - set samples \tikz@plot@samples; - set parametric; - plot [t=\tikz@plot@domain] #2}}% - \else% - \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{% - \pgfplots@gnuplot@format; - set samples \tikz@plot@samples; - plot [x=\tikz@plot@domain] #2}}% - \fi% - \fi% - \def\pgfplotxyfile{\pgfplots@addplotimpl@gnuplotresult{#1}{#3}}% - \pgfplots@plot@data - \let\pgfplotxyfile=\pgfplots@backupof@pgfplotxyfile -}% - -\def\pgfplots@addplotimpl@gnuplotresult#1#2#3{% - \begingroup - \openin1=#3 - \ifeof1 - \pgfplots@error{Sorry, the gnuplot-result file '#3' could not be found. Maybe you need to enable the shell-escape feature? For pdflatex, this is '>> pdflatex -shell-escape'. You can also invoke '>> gnuplot #3' manually.}% - \aftergroup\pgfplots@loop@CONTINUEfalse - \else - \aftergroup\pgfplots@loop@CONTINUEtrue - \fi - \closein1 - \endgroup - \ifpgfplots@loop@CONTINUE - \pgfplots@addplotimpl@file{#1}ile{#3}#2;% - \fi -} - -% #1: arguments to \addplot[...] -% #2: the file name -% #3: any additional path arguments -\def\pgfplots@addplotimpl@file#1ile{% - \pgfutil@ifnextchar[{% - \pgfplots@addplotimpl@file@opt{#1}% - }{% - \pgfplots@addplotimpl@file@opt{#1}[]% - }% -} - -% \addplot[#1] file[#2] {#3} #4; -\def\pgfplots@addplotimpl@file@opt#1[#2]#3#4;{% - \begingroup - \def\pgfplots@loc@TMPa{#2}% - \ifx\pgfplots@loc@TMPa\pgfutil@empty - \else - \pgfqkeys{/pgfplots/plot file}{#2}% - \fi - \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% - \pgfplots@coord@stream@start - \openin1=#3 - \ifeof1 - \pgfplots@warning{sorry, plot file{#3} could not be opened!?}% - \else - \pgfplots@addplotimpl@file@readall - \fi - \pgfplots@coord@stream@end - \endgroup -}% -\def\pgfplots@addplotimpl@file@readall{% - \read1 to\pgfplots@file@LINE - \expandafter\pgfplotstableread@checkspecial@line\pgfplots@file@LINE\pgfplotstable@EOI - \ifpgfplotstableread@skipline - \else - \ifpgfplots@plot@file@skipfirst - % Silently skip first data row, assuming it is a header. - \pgfplots@plot@file@skipfirstfalse - \else - \expandafter\pgfplots@addplotimpl@file@parsesingle\pgfplots@file@LINE\pgfplots@EOI - \fi - \fi - \ifeof1 - \else - \expandafter - \pgfplots@addplotimpl@file@readall - \fi -}% - -\def\pgfplots@addplotimpl@file@parsesingle#1 #2 #3\pgfplots@EOI{% - \pgfplots@coord@stream@coord{#1}{#2}{}{}% -}% - -\def\pgfplots@addplotimpl@table#1table{% - \pgfutil@ifnextchar[{% - \pgfplots@addplotimpl@table@getopts{#1}% - }{% - \pgfplots@addplotimpl@table@getopts{#1}[x index=0,y index=1]% - }% -}% - -\def\pgfplots@addplotimpl@table@getopts#1[#2]{% - \pgfutil@ifnextchar f{% - \pgfplots@addplotimpl@table@fromstructure{#1}{#2}% - }{% - \pgfplots@addplotimpl@table@fromfile{#1}{#2}% - }% -} - -% #1: arguments to \addplot[...] -% #2: arguments to table[...] -% #3: the argument of plot table{...} -% #4: trailing path arguments after plot table{...}#4; -\long\def\pgfplots@addplotimpl@table@fromstructure#1#2from#3#4;{% - \begingroup - % FIXME : this thing here has runtime O(N^2) ! - % I fear it is faster to simply reload the data .... !? - % - % well, for a lot of columns which are used in different contexts - % and few rows, this here IS more efficient. - \pgfplotstableset{#2}% - \pgfplotstablecopy#3\to\pgfplots@table - \ifx\pgfplots@plot@tbl@x\pgfutil@empty - \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@xindex\of\pgfplots@table\to\addplot@tbl@x - \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@x\of\pgfplots@table\to\addplot@tbl@x - \fi - \ifx\pgfplots@plot@tbl@y\pgfutil@empty - \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@yindex\of\pgfplots@table\to\addplot@tbl@y - \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@y\of\pgfplots@table\to\addplot@tbl@y - \fi + % A block which handles active semicolons. % - \ifpgfplots@errorbars@enabled - \let\addplot@tbl@error@x=\pgfutil@empty - \let\addplot@tbl@error@y=\pgfutil@empty - \pgfkeysgetvalue{/pgfplots/table/x error index}\pgfplots@plot@tbl@error@xindex - \pgfkeysgetvalue{/pgfplots/table/x error}\pgfplots@plot@tbl@error@x - \pgfkeysgetvalue{/pgfplots/table/y error index}\pgfplots@plot@tbl@error@yindex - \pgfkeysgetvalue{/pgfplots/table/y error}\pgfplots@plot@tbl@error@y - \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@xindex\pgfutil@empty - \else - \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@xindex\of\pgfplots@table\to\addplot@tbl@error@x - \fi - \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@x\of\pgfplots@table\to\addplot@tbl@error@x - \fi - \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@yindex\pgfutil@empty - \else - \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@yindex\of\pgfplots@table\to\addplot@tbl@error@y - \fi - \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@y\of\pgfplots@table\to\addplot@tbl@error@y - \fi - \fi + % ATTENTION: this block does only work if + % \pgfplots@addplotimpl.... changes are reflected here! % - \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% - \pgfplots@coord@stream@start - \loop - \pgfplotslistcheckempty\addplot@tbl@x - \ifpgfplotslistempty - \pgfplots@loop@CONTINUEfalse - \else - % This here is just for sanity checking: if the 'y' column is - % - for whatever reasons - invalid; provide good error - % recovery. - \pgfplotslistcheckempty\addplot@tbl@y - \ifpgfplotslistempty - \pgfplots@loop@CONTINUEfalse - \else - \pgfplots@loop@CONTINUEtrue - \fi - \fi - \ifpgfplots@loop@CONTINUE - \pgfplotslistpopfront\addplot@tbl@x\to\addplot@tbl@cur@x - \pgfplotslistpopfront\addplot@tbl@y\to\addplot@tbl@cur@y - \ifpgfplots@errorbars@enabled - \ifx\addplot@tbl@error@x\pgfutil@empty - \let\addplot@tbl@error@cur@x=\pgfutil@empty - \else - \pgfplotslistpopfront\addplot@tbl@error@x\to\addplot@tbl@error@cur@x - \fi - \ifx\addplot@tbl@error@y\pgfutil@empty - \let\addplot@tbl@error@cur@y=\pgfutil@empty - \else - \pgfplotslistpopfront\addplot@tbl@error@y\to\addplot@tbl@error@cur@y - \fi - \edef\pgfplots@loc@TMPa{{\addplot@tbl@cur@x}{\addplot@tbl@cur@y}{\addplot@tbl@error@cur@x}{\addplot@tbl@error@cur@y}}% - \expandafter\pgfplots@coord@stream@coord\pgfplots@loc@TMPa - \else - \edef\pgfplots@loc@TMPa{{\addplot@tbl@cur@x}{\addplot@tbl@cur@y}{}{}}% - \expandafter\pgfplots@coord@stream@coord\pgfplots@loc@TMPa - \fi - \repeat - \pgfplots@coord@stream@end - \endgroup -} - - -% #1: arguments to \addplot[...] -% #2: arguments to table[...] -% #3: the argument of plot table{...} -% #4: trailing path arguments after plot table{...}#4; -\long\def\pgfplots@addplotimpl@table@fromfile#1#2#3#4;{% - %-------------------------------------------------- - % \begingroup - % \pgfplotstableset{#2}% - % \pgfplotstableread{#3}\pgfplots@table - % \pgfplots@addplotimpl@table@fromstructure{#1}{}from{\pgfplots@table}{#4};% - % \endgroup - %-------------------------------------------------- - \pgfplotsapplistXXglobalnewempty - \begingroup - \pgfplotstableset{#2}% - \let\pgfplots@table@PTR@x=\pgfutil@empty - \let\pgfplots@table@PTR@y=\pgfutil@empty - \ifpgfplots@errorbars@enabled - \let\pgfplots@table@ERRPTR@x=\pgfutil@empty - \let\pgfplots@table@ERRPTR@y=\pgfutil@empty - \pgfkeysgetvalue{/pgfplots/table/x error index}\pgfplots@plot@tbl@error@xindex - \pgfkeysgetvalue{/pgfplots/table/x error}\pgfplots@plot@tbl@error@x - \pgfkeysgetvalue{/pgfplots/table/y error index}\pgfplots@plot@tbl@error@yindex - \pgfkeysgetvalue{/pgfplots/table/y error}\pgfplots@plot@tbl@error@y - \pgfplotstableread{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener@witherrors - \else - \pgfplotstableread{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener - \fi - \endgroup - % - \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% - \pgfplotsapplistXXgloballet\pgfplots@coordlist - \pgfplotsapplistXXglobalclear - \expandafter\pgfplots@coord@stream@foreach\expandafter{\pgfplots@coordlist}%% -} -\def\pgfplots@addplotimpl@table@fromfile@listener{% - \pgfplots@addplotimpl@table@fromfile@listener@ - \edef\pgfplots@current@point{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% - \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@current@point}% -} -\def\pgfplots@addplotimpl@table@fromfile@listener@{% - \ifx\pgfplots@table@PTR@x\pgfutil@empty - % this here is only evaluated ONCE. - \ifx\pgfplots@plot@tbl@x\pgfutil@empty - \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@xindex}{\pgfplots@table@PTR@x}% - \else - \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@x}{\pgfplots@table@PTR@x}% - \fi - \ifx\pgfplots@plot@tbl@y\pgfutil@empty - \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@yindex}{\pgfplots@table@PTR@y}% - \else - \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@y}{\pgfplots@table@PTR@y}% - \fi - \fi - \pgfplotstablereadevalptr\pgfplots@table@PTR@x\pgfplots@current@point@x - \pgfplotstablereadevalptr\pgfplots@table@PTR@y\pgfplots@current@point@y -}% -\def\pgfplots@addplotimpl@table@fromfile@listener@witherrors{% - \pgfplots@addplotimpl@table@fromfile@listener@ - % - \ifx\pgfplots@table@ERRPTR@x\pgfutil@empty - % this here is only evaluated ONCE. - \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@xindex\pgfutil@empty - \let\pgfplots@table@ERRPTR@x=\relax% - \else - \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@error@xindex}{\pgfplots@table@ERRPTR@x}% - \fi - \else - \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@error@x}{\pgfplots@table@ERRPTR@x}% - \fi - \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@yindex\pgfutil@empty - \let\pgfplots@table@ERRPTR@y=\relax% - \else - \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@error@yindex}{\pgfplots@table@ERRPTR@y}% - \fi - \else - \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@error@y}{\pgfplots@table@ERRPTR@y}% - \fi - \fi - \ifx\relax\pgfplots@table@ERRPTR@x - \let\addplot@tbl@error@cur@x=\pgfutil@empty - \else - \pgfplotstablereadevalptr\pgfplots@table@ERRPTR@x\addplot@tbl@error@cur@x - \fi - \ifx\relax\pgfplots@table@ERRPTR@y - \let\addplot@tbl@error@cur@y=\pgfutil@empty - \else - \pgfplotstablereadevalptr\pgfplots@table@ERRPTR@y\addplot@tbl@error@cur@y - \fi - \edef\pgfplots@current@point{(\pgfplots@current@point@x,\pgfplots@current@point@y)+-(\addplot@tbl@error@cur@x,\addplot@tbl@error@cur@y)}% - \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@current@point}% -}% - -% #1: arguments to \addplot plot[#1] -% -> these are called 'behavior' options in the manual; they are set -% immediately. -\def\pgfplots@start@plot@with@behavioroptions#1{% - \begingroup - \def\pgfplots@current@point@coordindex{0}% can be used inside of coordinate filters. - \def\coordindex{\pgfplots@current@point@coordindex}% valid inside of \addplot - \ifx\pgfplots@execute@at@begin@plot\pgfutil@empty - \else - \pgfplots@execute@at@begin@plot - \fi - \def\pgfplots@addplot@nonlegend@options{#1}% - \ifx\pgfplots@addplot@nonlegend@options\pgfutil@empty - \else - \pgfplotsset{#1}% - \fi - % these styles may contain behavior options (error bars, - % samples,... ) activate them! - \pgfplotsset{/pgfplots/every axis plot,/pgfplots/every axis plot no \the\pgfplots@numplots/.try}% -} - -% Initialises -% \pgfplots@coord@stream@start -% \pgfplots@coord@stream@coord -% \pgfplots@coord@stream@end -% such that a following coordinate stream is processed properly. The -% following coordinate stream may come from different input methods. -% -% Arguments: -% #1: all options of \addplot[...] (the plot style) -% #2: any trailing path commands after the 'plot' command as such, -% for example \addplot plot coordinates {...} -- (0,0); -% would yield #2 =' -- (0,0)' -% -\long\def\pgfplots@PREPARE@COORD@STREAM#1#2{% - \def\pgfplots@coord@stream@start@{% - \pgfplotsapplistXXnewempty - \ifpgfplots@errorbars@enabled - \pgfplots@streamerrorbar@recordto{\pgfplots@recordederrorbar}% - \pgfplots@streamerrorbarstart - \else - \let\pgfplots@recordederrorbar=\pgfutil@empty - \fi - \ifpgfplots@stackedmode - \pgfplots@stacked@beginplot - \fi - % - %\let\pgfplots@coord@stream@recorded=\pgfutil@empty - % - }% - \let\pgfplots@coord@stream@coord@=\pgfplots@process@one@point - \def\pgfplots@coord@stream@end@{% - \ifpgfplots@errorbars@enabled - \pgfplots@streamerrorbarend - \fi - \ifpgfplots@coord@stream@isfirst - \pgfplots@warning{Empty plot silently dropped.}% - \else - \ifpgfplots@stackedmode - \pgfplots@stacked@endplot - \fi - % Idea: use - % \scope[plot specification] - % <any paths for error bars> - % \endscope - % \draw plot coordinates {...}; - % to share plot specifications between error bars and plot - % coordinates. Unfortunately, it is NOT sufficient to use - % \tikzset{#1} - \edef\pgfplots@addplot@preoptionsTMP{/pgfplots/every axis plot,/pgfplots/every axis plot no \the\pgfplots@numplots/.try}% - \expandafter\pgfplots@rememberplotspec\expandafter{\pgfplots@addplot@preoptionsTMP,#1,/pgfplots/every axis plot post}% - % warning: rememberplotspec calls list macros which - % overwrite \t@pgfplots@toka - \t@pgfplots@toka=\expandafter{\pgfplots@addplot@preoptionsTMP,#1,/pgfplots/every axis plot post}% - \xdef\pgfplots@last@plot@style{\the\t@pgfplots@toka}% store it for \label commands. - % ATTENTION: do NOT call list macros from here on! - % - \ifpgfplots@datascaletrafo@initialised - \pgfplots@addplot@get@named@startendpoints@command\pgfplots@loc@TMPa - \t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPa}% - \else - \t@pgfplots@tokc={}% - \fi - \ifx\pgfplots@recordederrorbar\pgfutil@empty - \let\pgfplots@loc@TMPb=\pgfutil@empty% - \else - \t@pgfplots@tokb=\expandafter{\pgfplots@recordederrorbar}% - \def\pgfplots@loc@TMPb{% - \noexpand\pgfplots@errorbars@finishwithstyleoptions[current plot style]{\the\t@pgfplots@tokb}% - }% - \fi - % assembe a \pgfplots@addplot@enqueue@coords command ... - % BEGIN HERE ... - % vvvvvvvvvv - \xdef\pgfplots@glob@TMPa{% - \noexpand\pgfplots@addplot@enqueue@coords - {% precommand: - \noexpand\def\noexpand\plotnum{\the\pgfplots@numplots}% - \noexpand\pgfplots@initzerolevelhandler - \the\t@pgfplots@tokc% named start/end points (if already available) - \noexpand\pgfkeysdef{/tikz/current plot style}{\noexpand\pgfkeysalso{\the\t@pgfplots@toka}}% - \pgfplots@loc@TMPb% error bar commands - }% - {% draw command: - \noexpand\draw% - }% - }% - \pgfplotsapplistXXlet\pgfplots@coord@stream@recorded - \pgfplotsapplistXXclear - \t@pgfplots@tokc=\expandafter{\pgfplots@coord@stream@recorded}% - \t@pgfplots@tokb={#2;}% - \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}% - \xdef\pgfplots@glob@TMPa{% - \the\t@pgfplots@toka - {% coordinates which need to be processed in \endaxis: - plot coordinates {\the\t@pgfplots@tokc}\the\t@pgfplots@tokb - }% - {% postcommand - }% - }% - \pgfplots@glob@TMPa - %^^^^^^^^^^^^ ... END of \pgfplots@addplot@enqueue@coords HERE - \pgfplots@end@plot - \fi - }% -}% - -\def\pgfplots@end@plot{% - \global\advance\pgfplots@numplots by1\relax% - \ifx\pgfplots@execute@at@end@plot\pgfutil@empty - \else - \pgfplots@execute@at@end@plot - \fi - \global\let\pgfplots@glob@TMPa=\relax - \ifpgfplots@collect@firstplot@astick - \ifnum\pgfplots@numplots=1\relax - \t@pgfplots@toka=\expandafter{\pgfplots@firstplot@coords@x}% - \t@pgfplots@tokb=\expandafter{\pgfplots@firstplot@coords@y}% - \xdef\pgfplots@glob@TMPa{% - \noexpand\def\noexpand\pgfplots@firstplot@coords@x{\the\t@pgfplots@toka}% - \noexpand\def\noexpand\pgfplots@firstplot@coords@y{\the\t@pgfplots@tokb}% - }% - \fi - \fi - \endgroup - \pgfplots@glob@TMPa% see above -} - -% #1: arguments to \addplot[...] -% #2: the plot coordinates -% #3: any trailing path command before the final ';'. It will be used as-is. -\long\def\pgfplots@addplotimpl@coordinates#1plot coordinates#2#3;{% -%\tracingmacros=2\tracingcommands=2 -%\pgfplots@message{processing plots coords with trailing path '#3'}% - \pgfplots@PREPARE@COORD@STREAM{#1}{#3}% - \pgfplots@coord@stream@foreach{#2}% -}% - -\newif\ifpgfplots@update@limits@for@one@point@ISCLIPPED -\def\pgfplots@math@ONE{1.0}% - -\def\pgfplots@streamerrorbarstart{% -}% -\def\pgfplots@streamerrorbarend{% -}% -\def\pgfplots@streamerrorbarcoords#1#2{% -}% - -\def\pgfplots@streamerrorbar@recordto#1{% - \def\pgfplots@streamerrorbarstart{% - \pgfplotsapplistXnewempty\pgfplots@streamerrorbar@recordto@@ - }% - \def\pgfplots@streamerrorbarend{% - \pgfplotsapplistXlet#1=\pgfplots@streamerrorbar@recordto@@ - \pgfplotsapplistXnewempty\pgfplots@streamerrorbar@recordto@@% clear - }% - \def\pgfplots@streamerrorbarcoords##1##2{% - \pgfplotsapplistXpushback{\pgfplots@errorbar@draw{##1}{##2}}\to\pgfplots@streamerrorbar@recordto@@ - }% -} -\def\pgfplots@streamerrorbar@directdraw{% - \def\pgfplots@streamerrorbarstart{}% - \def\pgfplots@streamerrorbarend{}% - \def\pgfplots@streamerrorbarcoords##1##2{% - \pgfplots@errorbar@draw{##1}{##2}% - }% -} - - - -% Updates the current x and y limits for point (#1,#2). -% -% The point coordinates may be given in floating point format, see -% below. -% -% Please note that if user specified limits are given, automatic -% limits are only applied to points which fall into the user specified -% clipping region. -% -% PRECONDITIONS: -% - the input coordinates have been parsed correctly (floating point -% format for linear axis, log applied for logarithmic ones) -% -% #3= error for x coord (or empty) -% #4= error for y coord (or empty) -\long\def\pgfplots@update@limits@for@one@point#1#2#3#4{% -%\tracingmacros=2\tracingcommands=2 -%\pgfplots@message{Updating limits for (#1,#2) ...}% - \ifpgfplots@autocomputeanylimits - \pgfplots@update@limits@for@one@point@ISCLIPPEDfalse - \ifpgfplots@autocompute@all@limits - \else - % check whether we need to clip limits: - \ifpgfplots@clip@limits - \ifpgfplots@autocompute@xmin - \else - \ifpgfplots@xislinear - \pgfmathfloatlessthan@{#1}{\pgfplots@xmin}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \else - \pgfmathlessthan@{#1}{\pgfplots@xmin}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \fi - \fi - \ifpgfplots@autocompute@xmax - \else - \ifpgfplots@xislinear - \pgfmathfloatlessthan@{\pgfplots@xmax}{#1}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \else - \pgfmathlessthan@{\pgfplots@xmax}{#1}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \fi - \fi - \ifpgfplots@autocompute@ymin - \else - \ifpgfplots@yislinear - \pgfmathfloatlessthan@{#2}{\pgfplots@ymin}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \else - \pgfmathlessthan@{#2}{\pgfplots@ymin}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \fi - \fi - \ifpgfplots@autocompute@ymax - \else - \ifpgfplots@yislinear - \pgfmathfloatlessthan@{\pgfplots@ymax}{#2}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \else - \pgfmathlessthan@{\pgfplots@ymax}{#2}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \fi - \fi - \fi - \fi - % - % - % - % Update limits: - \ifpgfplots@update@limits@for@one@point@ISCLIPPED - \else - \ifpgfplots@autocompute@xmin - \ifpgfplots@xislinear - \pgfmathfloatmin@{\pgfplots@xmin}{#1}% - \global\let\pgfplots@xmin=\pgfmathresult - \else - \pgfmathmin@{\pgfplots@xmin}{#1}% - \global\let\pgfplots@xmin=\pgfmathresult - \fi - \fi - \ifpgfplots@autocompute@xmax - \ifpgfplots@xislinear - \pgfmathfloatmax@{\pgfplots@xmax}{#1}% - \global\let\pgfplots@xmax=\pgfmathresult - \else - \pgfmathmax@{\pgfplots@xmax}{#1}% - \global\let\pgfplots@xmax=\pgfmathresult - \fi - \fi - \ifpgfplots@autocompute@ymin - \ifpgfplots@yislinear - \pgfmathfloatmin@{\pgfplots@ymin}{#2}% - \global\let\pgfplots@ymin=\pgfmathresult - \else - \pgfmathmin@{\pgfplots@ymin}{#2}% - \global\let\pgfplots@ymin=\pgfmathresult - \fi - \fi - \ifpgfplots@autocompute@ymax - \ifpgfplots@yislinear - \pgfmathfloatmax@{\pgfplots@ymax}{#2}% - \global\let\pgfplots@ymax=\pgfmathresult - \else - \pgfmathmax@{\pgfplots@ymax}{#2}% - \global\let\pgfplots@ymax=\pgfmathresult - \fi - \fi - \fi - \fi - % - % Compute data range: - \ifpgfplots@autocompute@all@limits - \global\let\pgfplots@data@xmin=\pgfplots@xmin - \global\let\pgfplots@data@xmax=\pgfplots@xmax - \global\let\pgfplots@data@ymin=\pgfplots@ymin - \global\let\pgfplots@data@ymax=\pgfplots@ymax - \else - % Attention: it is only done for linear axis! - \ifpgfplots@xislinear - \pgfmathfloatmin@{\pgfplots@data@xmin}{#1}% - \global\let\pgfplots@data@xmin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@data@xmax}{#1}% - \global\let\pgfplots@data@xmax=\pgfmathresult - \fi - \ifpgfplots@yislinear - \pgfmathfloatmin@{\pgfplots@data@ymin}{#2}% - \global\let\pgfplots@data@ymin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@data@ymax}{#2}% - \global\let\pgfplots@data@ymax=\pgfmathresult - \fi - \fi -%\pgfplots@message{Updated limits: (\pgfplots@xmin,\pgfplots@ymin) rectangle (\pgfplots@xmax,\pgfplots@ymax).}% -%\tracingmacros=0\tracingcommands=0 -} -\let\pgfplots@update@limits@for@one@point@orig=\pgfplots@update@limits@for@one@point - -\def\pgfplots@invoke@filter#1#2{% - \pgfkeysvalueof{/pgfplots/#2 filter/.@cmd}#1\pgfeov% -}% - -% #3= error for x coord (or empty) -% #4= error for y coord (or empty) -\def\pgfplots@process@one@point#1#2#3#4{% - \pgfplots@prepare@xcoord{#1}% - \expandafter\pgfplots@invoke@filter\expandafter{\pgfmathresult}{x}% - \let\pgfplots@current@point@x=\pgfmathresult - % - \pgfplots@prepare@ycoord{#2}% - \expandafter\pgfplots@invoke@filter\expandafter{\pgfmathresult}{y}% - \let\pgfplots@current@point@y=\pgfmathresult - % - \ifpgfplots@xislinear - \ifx\pgfplots@current@point@x\pgfutil@empty - \else - \pgfmathfloatparsenumber{\pgfplots@current@point@x}% - \expandafter\pgfmathfloat@decompose@F\pgfmathresult\relax\c@pgf@counta - \ifnum\c@pgf@counta>2 - \let\pgfplots@current@point@x=\pgfutil@empty - \else - \let\pgfplots@current@point@x=\pgfmathresult - \fi - \fi - \fi - % - \ifpgfplots@yislinear - \ifx\pgfplots@current@point@y\pgfutil@empty - \else - \pgfmathfloatparsenumber{\pgfplots@current@point@y}% - \expandafter\pgfmathfloat@decompose@F\pgfmathresult\relax\c@pgf@counta - \ifnum\c@pgf@counta>2 - \let\pgfplots@current@point@y=\pgfutil@empty - \else - \let\pgfplots@current@point@y=\pgfmathresult - \fi - \fi - \fi - % - \ifx\pgfplots@current@point@x\pgfutil@empty - \ifpgfplots@warn@for@filter@discards - \pgfplots@message{NOTE: coordinate (#1,#2) has been dropped because of the x-coordinate filter.}% - \fi - \else - \ifx\pgfplots@current@point@y\pgfutil@empty - \ifpgfplots@warn@for@filter@discards - \pgfplots@message{NOTE: coordinate (#1,#2) has been dropped because of the y-coordinate filter.}% - \fi - \else - % - \ifpgfplots@apply@datatrafo - \ifpgfplots@datascaletrafo@initialised - % apply data transformation directly. - \ifpgfplots@apply@datatrafo@x - \pgfplots@datascaletrafo@x\pgfplots@current@point@x - \let\pgfplots@current@point@x=\pgfmathresult - \fi - \ifpgfplots@apply@datatrafo@y - \pgfplots@datascaletrafo@y\pgfplots@current@point@y - \let\pgfplots@current@point@y=\pgfmathresult - \fi - \fi - \fi - % All following routines (limit updating/stacking/error - % bars) will use float numerics if necessary (controlled - % by ifs). - \ifpgfplots@stackedmode - \pgfplots@stacked@preparepoint@inmacro{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \ifpgfplots@datascaletrafo@initialised% is also true if there is no scale trafo. - \pgfplots@stacked@finishpoint{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \else - % the finishpoint routine will be invoked at - % \endaxis. - \fi - \fi - % update also axis / data limits: - \pgfplots@update@limits@for@one@point{\pgfplots@current@point@x}{\pgfplots@current@point@y}{}{}% - \ifpgfplots@errorbars@enabled - \pgfplots@process@errorbar@for{\pgfplots@current@point@x}{\pgfplots@current@point@y}{#3}{#4}{#1}{#2}% - \fi - % - \edef\pgfplots@loc@TMPa{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% - \expandafter\pgfplotsapplistXXpushback\expandafter{\pgfplots@loc@TMPa}% - %\t@pgfplots@tokc=\expandafter{\pgfplots@coord@stream@recorded}% - %\edef\pgfplots@coord@stream@recorded{\the\t@pgfplots@tokc (\pgfplots@current@point@x,\pgfplots@current@point@y)}% - % - \ifpgfplots@collect@firstplot@astick - \ifnum\pgfplots@numplots=0 - \ifx\pgfplots@firstplot@coords@x\pgfutil@empty - \t@pgfplots@tokc=\expandafter{}% - \else - \t@pgfplots@tokc=\expandafter{\pgfplots@firstplot@coords@x,}% - \fi - \edef\pgfplots@firstplot@coords@x{\the\t@pgfplots@tokc\pgfplots@current@point@x}% - \ifx\pgfplots@firstplot@coords@y\pgfutil@empty - \t@pgfplots@tokc=\expandafter{}% - \else - \t@pgfplots@tokc=\expandafter{\pgfplots@firstplot@coords@y,}% - \fi - \edef\pgfplots@firstplot@coords@y{\the\t@pgfplots@tokc\pgfplots@current@point@y}% - \fi - \fi - \fi - \fi - % - % increase \pgfplots@current@point@coordindex: - \begingroup - \c@pgf@counta=\pgfplots@current@point@coordindex - \advance\c@pgf@counta by1\relax - \edef\pgfmathresult{\the\c@pgf@counta}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - \let\pgfplots@current@point@coordindex=\pgfmathresult -} - -% Internal stream methods. -% -% Please overwrite \pgfplots@coord@stream@start@, -% \pgfplots@coord@stream@end@ and \pgfplots@coord@stream@coord@ -% if you implement streams. -% -% FIXME: REPLACE THIS HERE WITH METHODS OF THE VISUALIZATION FRAMEWORK -\newif\ifpgfplots@coord@stream@isfirst -\def\pgfplots@coord@stream@start{% - \pgfplots@coord@stream@isfirsttrue - \pgfplots@coord@stream@start@}% -\def\pgfplots@coord@stream@end{\pgfplots@coord@stream@end@} - -% Will be invoked for every point coordinate. -% -% It invokes \pgfplots@coord@stream@coord@. -% It is expected to assign \pgfplots@current@point@x and -% \pgfplots@current@point@y -% -% It is expected to -% (#1,#2) : x, y coordinates -% (#3,#4) : any x, y errors (or empty) -\def\pgfplots@coord@stream@coord#1#2#3#4{% - \pgfplots@coord@stream@coord@{#1}{#2}{#3}{#4}% - \ifpgfplots@coord@stream@isfirst - \ifx\pgfplots@currentplot@firstcoord@x\pgfutil@empty - \else - \ifx\pgfplots@currentplot@firstcoord@y\pgfutil@empty - \else - \let\pgfplots@currentplot@firstcoord@x=\pgfplots@current@point@x - \let\pgfplots@currentplot@firstcoord@y=\pgfplots@current@point@y - \pgfplots@coord@stream@isfirstfalse - \fi - \fi - \fi - \ifx\pgfplots@current@point@x\pgfutil@empty - \else - \ifx\pgfplots@current@point@y\pgfutil@empty - \else - \let\pgfplots@currentplot@lastcoord@x=\pgfplots@current@point@x - \let\pgfplots@currentplot@lastcoord@y=\pgfplots@current@point@y - \fi - \fi -}% - -% A looping method which applies -% \pgfplots@coord@stream@start -% for each coordinate '(x,y)' or '(x,y) +- (ex,ey)', call -% \pgfplots@coord@stream@coord{x}{y}{ex}{ey} -% \pgfplots@coord@stream@end -% -% #1 a sequence of coordinates of the form -% '(x,y)' -% or -% '(x,y) +- (ex,ey)' -% separated by white-space. -\long\def\pgfplots@coord@stream@foreach#1{% - \pgfplots@coord@stream@start - \pgfplots@foreach@plot@coord@do% - \pgfplots@coord@stream@coord - \for - plot coordinates {#1};% - \pgfplots@EOI - \pgfplots@coord@stream@end -}% - -% this is a convenience macro to save storage in the long coordinate -% lists. -\def\pgfplots@stream#1#2{\pgfplotstreampoint{\pgfqpoint{#1}{#2}}} - -\newif\ifpgfplots@record@marker@stream -% Takes a sequence of PREPARED coordinates which are given in floating -% point representation and applies the data scaling trafo (if -% necessary). -% -% Any coordinate will be plotted with the selected PGF plot handler. -% -% This stream is designed to be done at the end of an axis. -% See \pgfplots@coord@stream@finalize@storedcoords@START -% -% #1 : a macro which will be filled with a pgf plot stream for the -% marker points. -\def\pgfplots@coord@stream@INIT@finalize@storedcoords#1{% - % - % Init the plot handlers: - \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler - \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% - % - \ifx\tikz@plot@mark\pgfutil@empty - % mark=none : no need to waste time collecting marker - % positions. - \pgfplots@record@marker@streamfalse - \else - \ifx\pgfplots@basiclevel@plothandler\pgfplothandlerdiscard - \ifpgfplots@clip@marker@paths - % only marks: draw markers directly; no need for the - % two-pass-approach. - \let\pgfplots@basiclevel@plothandler=\relax - \pgfplots@install@plotmark@handler - \pgfplots@record@marker@streamfalse - \else - % collect mark positions... they will be drawn after - % the clipped axis range. Clipping will only be - % applied to their *positions*, not their paths. - \pgfplots@record@marker@streamtrue - \fi - \else - % ok, mark!=none and we also have a plot handler. - % So, collect mark positions! - \pgfplots@record@marker@streamtrue - \fi - \fi - \gdef#1{}% - % - % Now, set up coordinate streams. - \def\pgfplots@coord@stream@start@{% - \ifpgfplots@apply@datatrafo - \ifpgfplots@stackedmode - \pgfplots@stacked@beginplot - \fi - \fi - \pgfplots@basiclevel@plothandler - \pgfplotstreamstart - \let\pgfplots@data@scaletrafo@result=\pgfutil@empty - \ifpgfplots@record@marker@stream - \pgfplotsapplistXXnewempty - \pgfplotsapplistXXpushback{\pgfplotstreamstart}% - %\gdef#1{\pgfplotstreamstart}% - \fi - }% - \def\pgfplots@coord@stream@end@{% - \ifpgfplots@apply@datatrafo - \ifpgfplots@stackedmode - \pgfplots@stacked@endplot - \fi - \pgfplots@addplot@get@named@startendpoints@command\pgfplots@loc@TMPa - \pgfplots@loc@TMPa - \fi - \pgfplotstreamend - \ifpgfplots@record@marker@stream - \pgfplotsapplistXXpushback{\pgfplotstreamend}% - \pgfplotsapplistXXflushbuffers% - \global\let#1=\pgfplotsapplistXX - \pgfplotsapplistXXclear - %\expandafter\gdef\expandafter#1\expandafter{#1\pgfplotstreamend}% - \fi - }% - \ifpgfplots@apply@datatrafo - \def\pgfplots@coord@stream@coord@##1##2##3##4{% - \pgfplots@apply@data@scaletrafo@to@one@point{##1}{##2}{##3}{##4}% - \pgfplots@coord@stream@finalize@currentpt - }% - \else - \def\pgfplots@coord@stream@coord@##1##2##3##4{% - \def\pgfplots@current@point@x{##1}% - \def\pgfplots@current@point@y{##2}% - \pgfplots@coord@stream@finalize@currentpt - }% - \fi - % - \def\pgfplots@coord@stream@finalize@currentpt{% - \pgfqpointxy{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \ifpgfplots@record@marker@stream - \ifdim\pgf@x<\pgfplots@xcoordminTEX - \else - \ifdim\pgf@x>\pgfplots@xcoordmaxTEX - \else - \ifdim\pgf@y<\pgfplots@ycoordminTEX - \else - \ifdim\pgf@y>\pgfplots@ycoordmaxTEX - \else - \edef\pgfmathresult{\noexpand\pgfplots@stream{\the\pgf@x}{\the\pgf@y}}% - \expandafter\pgfplotsapplistXXpushback\expandafter{\pgfmathresult}% - \fi - \fi - \fi - \fi - \fi - \pgfplotstreampoint{}% it will simply take \pgf@x and \pgf@y! - }% -} -\def\pgfplots@addplot@get@named@startendpoints@command#1{% - \edef#1{% - \noexpand\pgfcoordinate{current plot begin}{\noexpand\pgfqpointxy{\pgfplots@currentplot@firstcoord@x}{\pgfplots@currentplot@firstcoord@y}}% - \noexpand\pgfcoordinate{current plot end}{\noexpand\pgfqpointxy{\pgfplots@currentplot@lastcoord@x}{\pgfplots@currentplot@lastcoord@y}}% - }% -}% - -% INPUT: -% either floating point or fixed point coordinates (depending on the -% state of the \ifpgfplots@apply@datatrafo boolean) -% -\long\def\pgfplots@coord@stream@finalize@storedcoords@START plot coordinates #1#2;\pgfplots@EOI{% - \pgfplots@assert@tikzinternal@exists{tikz@make@last@position}% - \pgfplots@stored@current@cmd[current plot style] - \pgfextra - \tikzset{every plot/.try}% - \pgfplots@coord@stream@INIT@finalize@storedcoords\pgfplots@recorded@marker@stream% - \pgfplots@coord@stream@foreach{#1}% - \tikz@make@last@position{\pgfplotlastpoint}% - \endpgfextra - #2; - \ifx\pgfplots@recorded@marker@stream\pgfutil@empty - \else - \ifpgfplots@clip@marker@paths - % Draw markers on top of the plot lines: - % - % FIXME: inefficient! Use \scope to set variables of 'current plot style' !? - \pgfplots@stored@current@cmd[current plot style] - \pgfextra - \pgfplots@install@plotmark@handler - \pgfplots@recorded@marker@stream - \endpgfextra - ; - \else - % sigh... ok, store the marker list (once more again). - % They need to be drawn after the clipped area. - \pgfplots@stored@REMEMBER@MARK@COMMAND - \fi - \fi - \gdef\pgfplots@recorded@marker@stream{}% clear -}% - -% This method MUST be called while \pgfplots@stored@plotlist is -% evaluated, that means -% - \pgfplots@stored@* commands need to be valid, -% - the precommand has already been invoked. -% - pgfplots@recorded@marker@stream exists -% - current plot style is valid -\def\pgfplots@stored@REMEMBER@MARK@COMMAND{% - \pgfkeysgetvalue{/tikz/current plot style/.@cmd}{\pgfplots@loc@TMPa}% - \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa\pgfeov}% - \t@pgfplots@tokb=\expandafter{\pgfplots@stored@current@cmd[current plot style]}% - \t@pgfplots@tokc=\expandafter{\pgfplots@recorded@marker@stream}% - \edef\pgfplots@loc@TMPa{% - \noexpand\pgfkeysdef{/tikz/current plot style}{\the\t@pgfplots@toka}% - \the\t@pgfplots@tokb - \noexpand\pgfextra - \noexpand\pgfplots@install@plotmark@handler - \the\t@pgfplots@tokc - \noexpand\endpgfextra - ;}% - \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@loc@TMPa}\to\pgfplots@stored@markerlist -}% - -\def\pgfplots@install@plotmark@handler{% - \pgfplots@assert@tikzinternal@exists{tikz@options}% - % note: I can't check on tikz@transform because it can be - % '\relax'. - \pgfplots@gettikzinternal@keyval{mark indices}{tikz@mark@list}{}% - \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% - % - % do not reset \tikz@options: draw color may be acquired - % from 'current plot style' - %\let\tikz@options=\pgfutil@empty% - \let\tikz@transform=\pgfutil@empty% - \tikzset{every plot/.try,every mark}% - \tikz@options - \ifx\tikz@mark@list\pgfutil@empty% - \pgfplothandlermark{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}% - \else - \pgfplothandlermarklisted{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}{\tikz@mark@list}% - \fi -}% - -% A looping command to loop through plot coordinates. -% For every point, #1{X}{Y} will be invoked. -% -% No scoping is used during this operation, so you can access outer -% variables. -\long\def\pgfplots@foreach@plot@coord@do#1\for plot coordinates #2;\pgfplots@EOI{% - \def\pgfplots@foreach@plot@coord@do@CMD{#1}% - \pgfplots@foreach@plot@coord@ITERATE#2\pgfplots@EOI% -} - -\def\pgfplots@foreach@plot@coord@ITERATE{% - \pgfutil@ifnextchar\pgfplots@EOI{% - \pgfplots@foreach@plot@coord@FINISH% - }{% - \pgfplots@foreach@plot@coord@NEXT% + \catcode`\;=\active + \globaldefs=1 + % 'AS' == 'active semicolon' + \def\pgfplots@path@AS#1;{\pgfplots@path@enqueue{#1;}}% + \long\def\pgfplots@replacement@for@tikz@path@AS#1;{% + \axispath\path#1;% }% -} - -\def\pgfplots@foreach@plot@coord@NEXT(#1,#2){% - \pgfutil@ifnextchar+{% - \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE{#1}{#2}% - }{% - \pgfplots@foreach@plot@coord@do@CMD{#1}{#2}{}{}% - \pgfplots@foreach@plot@coord@ITERATE + \pgfplots@appendto@activesemicolon@switcher{% + \let\pgfplots@path=\pgfplots@path@AS + \let\pgfplots@replacement@for@tikz@path=\pgfplots@replacement@for@tikz@path@AS }% } -% processing something like '(x,y) +- (error_x,error_y)' -\def\pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE#1#2+-#3({% - \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@{#1}{#2}% -} -\def\pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@#1#2#3,#4){% - \pgfplots@foreach@plot@coord@do@CMD{#1}{#2}{#3}{#4}% - \pgfplots@foreach@plot@coord@ITERATE -} - -\def\pgfplots@foreach@plot@coord@FINISH\pgfplots@EOI{} - - -% #1= x coord -% #2= y coord -% #3= error for x coord (or empty) -% #4= error for y coord (or empty) -\def\pgfplots@apply@data@scaletrafo@to@one@point#1#2#3#4{% - \ifpgfplots@apply@datatrafo@x - \pgfplots@datascaletrafo@x{#1}% - \let\pgfplots@current@point@x=\pgfmathresult - \else - \def\pgfplots@current@point@x{#1}% - \fi - \ifpgfplots@apply@datatrafo@y - \pgfplots@datascaletrafo@y{#2}% - \let\pgfplots@current@point@y=\pgfmathresult - \else - \def\pgfplots@current@point@y{#2}% - \fi - \ifpgfplots@stackedmode - % all these calls work with pgfmath; no more floating point - % arithmetics are applied. - \pgfplots@stacked@getnextzerolevelpoint - \pgfplots@stacked@finishpoint{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \pgfplots@stacked@rememberzerolevelpoint@for@next@plot{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% - \fi -% \t@pgfplots@tokc=\expandafter{\pgfplots@data@scaletrafo@result}% -% \edef\pgfplots@data@scaletrafo@result{\the\t@pgfplots@tokc(\pgfplots@current@point@x,\pgfplots@current@point@y)}% -} - -% This thing here shall draw all error bar commands listed in '#2'. -% -% It will be invoked when any plotting commands take effect (that -% means all limits are computed; the axis has been drawn, -% transformations are set up...) -\def\pgfplots@errorbars@finishwithstyleoptions[#1]#2{% - \scope[/pgfplots/.cd,#1,/pgfplots/every error bar]% it used the /pgfplots/.unknown - #2% - \endscope -} - -\def\pgfplots@errorbar@draw@float(#1,#2)(#3,#4){% - \ifpgfplots@apply@datatrafo@x - \pgfplots@datascaletrafo@x{#1}% - \let\pgfplots@xarg=\pgfmathresult% - \pgfplots@datascaletrafo@x{#3}% - \let\pgfplots@error@xarg=\pgfmathresult% - \else - \def\pgfplots@xarg{#1}% - \def\pgfplots@error@xarg{#3}% - \fi - \ifpgfplots@apply@datatrafo@y - \pgfplots@datascaletrafo@y{#2}% - \let\pgfplots@yarg=\pgfmathresult% - \pgfplots@datascaletrafo@y{#4}% - \let\pgfplots@error@yarg=\pgfmathresult% - \else - \def\pgfplots@yarg{#2}% - \def\pgfplots@error@yarg{#4}% - \fi - \edef\pgfplots@loc@TMPa{{(\pgfplots@xarg,\pgfplots@yarg)}{(\pgfplots@error@xarg,\pgfplots@error@yarg)}}% - \def\pgfplots@loc@TMPb{\pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}}% - \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\pgfeov -} - -\def\pgfplots@errorbar@draw#1#2{% - \begingroup - \ifpgfplots@apply@datatrafo - \pgfplots@errorbar@draw@float#1#2 - \else - \pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}{#1}{#2}\pgfeov% - \fi - \endgroup -}% - -% Also provides UNFILTERED arguments x (#5) and y (#6). These are use -% in case of logplots, because we may need to compute log( x + e_x ) -% or log( y + e_y ). -\def\pgfplots@process@errorbar@for#1#2#3#4#5#6{% -% \begingroup - \edef\pgfplots@xarg{#1}% - \edef\pgfplots@yarg{#2}% - \def\pgfplots@xarg@unfiltered{#5}% - \def\pgfplots@yarg@unfiltered{#6}% - \edef\pgfplots@error@xarg{#3}% - \edef\pgfplots@error@yarg{#4}% - \def\pgfplots@loc@TMPa{0}% - \ifx\pgfplots@loc@TMPa\pgfplots@error@xarg - \let\pgfplots@error@xarg=\pgfutil@empty - \fi - \ifx\pgfplots@loc@TMPa\pgfplots@error@yarg - \let\pgfplots@error@yarg=\pgfutil@empty - \fi - % FIXME : INEFFICIENT! This code here does every computation - % multiple times! - \ifcase\pgfplots@errorbars@xdirection - \or - \pgfplots@process@errorbar@@for{x}{+}1% - \or - \pgfplots@process@errorbar@@for{x}{-}2% - \or - \pgfplots@process@errorbar@@for{x}{+}1% - \pgfplots@process@errorbar@@for{x}{-}2% - \fi - \ifcase\pgfplots@errorbars@ydirection - \or - \pgfplots@process@errorbar@@for{y}{+}1% - \or - \pgfplots@process@errorbar@@for{y}{-}2% - \or - \pgfplots@process@errorbar@@for{y}{+}1% - \pgfplots@process@errorbar@@for{y}{-}2% - \fi -% \endgroup -} - -% #1: either 'x' or 'y' -% #2: either '+' or '-' -% #3: an integer representing the argument #2. It is '1' if #2='+' -% and '2' is #2 = '-'. -\def\pgfplots@process@errorbar@@for#1#2#3{% - \csname ifpgfplots@#1islinear\endcsname - \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% - \ifcase\csname pgfplots@errorbars@#1mode\endcsname - % fixed absolute error. - \edef\pgfplots@error@coord{\csname pgfplots@errorbars@#1fixed\endcsname}% - \pgfmathfloatparsenumber{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \ifnum#3=1 - \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% - \fi - \let\pgfplots@error@coord=\pgfmathresult - \or% fixed relative error: - \pgfmathparse{(1#2\csname pgfplots@errorbars@#1rel\endcsname)}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatmultiplyfixed@{\pgfplots@error@src}{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \or% explicit absolute: - \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \pgfmathfloatparsenumber{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \ifnum#3=1 - \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% - \fi - \let\pgfplots@error@coord=\pgfmathresult - \fi - \or% explicit relative: - \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \pgfmathparse{(1#2\pgfplots@error@coord)}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatmultiplyfixed@{\pgfplots@error@src}{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \fi - \fi - \else - % LOGARITHMIC scaling. All errors are interpreted as - % log(x +- e_x) - % or - % log( x*(1+-e_x) ) - \ifcase\csname pgfplots@errorbars@#1mode\endcsname - % fixed absolute, log( x +- e_x ) - \edef\pgfplots@error@src{\csname pgfplots@#1arg@unfiltered\endcsname}% - \edef\pgfplots@error@coord{\csname pgfplots@errorbars@#1fixed\endcsname}% - \pgfmathfloatparsenumber{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatparsenumber{\pgfplots@error@src}% - \let\pgfplots@error@src=\pgfmathresult - \ifnum#3=1 - \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% - \fi - \pgfmathlog@float{\pgfmathresult}% - \let\pgfplots@error@coord=\pgfmathresult - \or% fixed relative, log( x ( 1+-e_x ) ) = log(x) + log(1+-e_x) - \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% - \pgfmathparse{\pgfplots@error@src + ln(1#2\csname pgfplots@errorbars@#1rel\endcsname)}% - \let\pgfplots@error@coord=\pgfmathresult% - \or% explicit absolute - \edef\pgfplots@error@src{\csname pgfplots@#1arg@unfiltered\endcsname}% - \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \pgfmathfloatparsenumber{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatparsenumber{\pgfplots@error@src}% - \let\pgfplots@error@src=\pgfmathresult - \ifnum#3=1 - \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% - \fi - \pgfmathlog@float{\pgfmathresult}% - \let\pgfplots@error@coord=\pgfmathresult - \fi - \or% explicit relative: - \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% - \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \pgfmathparse{\pgfplots@error@src + ln(1#2 \pgfplots@error@coord)}% - \let\pgfplots@error@coord=\pgfmathresult% - \fi - \fi - \fi - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \def\pgfplots@loc@TMPa{#1}% - \def\pgfplots@loc@TMPb{x}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \pgfplots@update@limits@for@one@point{\pgfplots@error@coord}{\pgfplots@yarg}{}{}% - \edef\pgfplots@loc@TMPa{% - {(\pgfplots@xarg,\pgfplots@yarg)}% - {(\pgfplots@error@coord,\pgfplots@yarg)}% - }% - \else - \pgfplots@update@limits@for@one@point{\pgfplots@xarg}{\pgfplots@error@coord}{}{}% - \edef\pgfplots@loc@TMPa{% - {(\pgfplots@xarg,\pgfplots@yarg)}% - {(\pgfplots@xarg,\pgfplots@error@coord)}% - }% - \fi - \expandafter\pgfplots@streamerrorbarcoords\pgfplots@loc@TMPa - \fi -} - -\long\def\pgfplots@path#1;{% - \pgfplots@path@enqueue{#1;}% -} - -% This thing here shall be used to replace any '\path' where \axispath -% shall be used. -\long\def\pgfplots@replacement@for@tikz@path#1;{% - \axispath\path#1;% -} - % Will be available as \closedcycle command inside of an axis. % @@ -3886,30 +2300,6 @@ \advance\pgfplots@numplots by-1 }} -% This routine is called at the begin of every plot. -% It initialised a zero level stream. -% -% The default is to use '0' as zero level streams. -% -% This method is called as "precommand"; before any Tikz drawing -% commands have been started. -\def\pgfplots@initzerolevelhandler{% - \ifpgfplots@stackedmode - % ATTENTION: this thing here says: - % "draw zero level coordinates from list XYZ." - % But at the time of this initialisation, the list will be EMPTY! - % - % It will be filled later. That's ok, because - % \pgfplots@initzerolevelhandler will be - % used as 'precommand', that means before Tikz sees any - % coordinates. - \pgfplots@stacked@initzerolevelhandler - \else - \pgfplotxzerolevelstreamconstant{\pgfplots@ZERO@x}% - \pgfplotyzerolevelstreamconstant{\pgfplots@ZERO@y}% - \fi -} - \def\pgfplots@try@mirror@plot@handler{% \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler % this method assigns '\tikz@plot@handler'. @@ -3998,7 +2388,7 @@ \curcolumnNum=0 \maxcolumnCount=\pgfplots@legend@columns\relax % - \loop + \pgfutil@loop \ifnum0<\pgfplots@numplots\relax \pgfplots@pop@next@legend \ifx\pgfplots@curlegend\pgfutil@empty @@ -4032,7 +2422,15 @@ \ifnum\curcolumnNum=\maxcolumnCount \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}% \else + \pgfplotslistcheckempty\pgfplots@legend \ifnum\pgfplots@numplots=0 + \pgfplotslistemptytrue + \fi + \ifpgfplotslistempty + % Ok, either the legend list is empty or + % there are no more plots. + % + % Finalize matrix: \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}% \else \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\pgfmatrixnextcell}% @@ -4048,7 +2446,7 @@ \fi \expandafter\t@pgfplots@toka\expandafter{\pgfplots@glob@TMPa}% \fi - \repeat + \pgfutil@repeat \t@pgfplots@tokb={\matrix[/pgfplots/every axis legend]}% \xdef\pgfplots@glob@TMPa{% \noexpand\def\noexpand\plotnum{0}% @@ -4064,90 +2462,7 @@ \pgfplots@already@computed@legend@node } -\newif\ifpgfplots@checkuniform@isfirst -% Checks whether the argument to xtick or ytick is a UNIFORM tick -% sequence. -% -% A uniform tick sequence is 0,...,10 and 3,4,5 and -5,-4,-2 but -% NOT 0,2,4 or 4,10. -% -% Furthermore, any NON-integer tick arguments are also assumed to be -% NOT uniform. -% -% INPUT: -% #1: a tick argument (i.e. something which can be put to -% \foreach \x in {#1}) -% -% OUTPUT: -% \pgfplots@isuniformticktrue -% or -% \pgfplots@isuniformtickfalse -% depending on the check. -% This variable will be set globally. -\def\pgfplots@checkisuniformLOGtick#1{% - \begingroup - \global\pgfplots@isuniformticktrue - \pgfplots@checkuniform@isfirsttrue - \foreach \x in {#1}{% - \pgfmathmultiply@\x\reciproclogten - \let\cur=\pgfmathresult - % check whether - % \cur - last == 1 (last = \pgfplots@glob@TMPb) - \ifpgfplots@checkuniform@isfirst - \global\pgfplots@checkuniform@isfirstfalse - \else - \pgfmathsubtract@\cur\pgfplots@glob@TMPb% - \pgfmathapproxequalto@\pgfmathresult{1.0}% - \ifpgfmathcomparison - \else - \global\pgfplots@isuniformtickfalse - \breakforeach - \fi - \fi - \global\let\pgfplots@glob@TMPb=\cur - }% - \endgroup -} - -% Checks whether the linear tick sequence #1 is a uniform tick. -% -% It also assigns pgfplots@tick@distance@#1 as the distance. -% -% see \pgfplots@checkisuniformLOGtick for details. -% -% #1: a tick sequence (expanded) -% #2: a macro which will be filled with the tick distance. This is -% only valid if \pgfplots@isuniformticktrue. -\def\pgfplots@checkisuniformLINEARtick#1#2{% - \begingroup - \global\pgfplots@isuniformticktrue - \pgfplots@checkuniform@isfirsttrue - \global\let\pgfplots@glob@TMPb=\pgfutil@empty - \global\def\pgfplots@glob@TMPa{1}% - \foreach \x in {#1}{% - \ifx\pgfplots@glob@TMPb\pgfutil@empty - \else - \pgfmathsubtract@\x\pgfplots@glob@TMPb - \ifpgfplots@checkuniform@isfirst - % remember first distance h = x_1 - x_0 - \global\let\pgfplots@glob@TMPa=\pgfmathresult - \global\pgfplots@checkuniform@isfirstfalse - \else - % check whether x_i - x_{i-1} = h - \pgfmathapproxequalto@\pgfmathresult\pgfplots@glob@TMPa% - \ifpgfmathcomparison - \else - \global\pgfplots@isuniformtickfalse - \breakforeach - \fi - \fi - \fi - \global\let\pgfplots@glob@TMPb=\x% - }% - \endgroup - \let#2=\pgfplots@glob@TMPa -} - +% DEPRECATED. \def\skipsuffixzero#1.#2|{ {% \def\pgfplots@loc@TMPa{#2}% @@ -4184,20 +2499,6 @@ \pgfmathresult } -% helper method which computes log10*\x foreach \x in {#1}. -% The result will be \xdef'ed into #2. -\def\pgfplots@compute@tick@times@logten#1\to#2{% - \global\let#2=\pgfutil@empty - \foreach \pgfplots@loc@TMPb in {#1} {% - \pgfmathmultiply@\pgfplots@loc@TMPb\logten% - \ifx#2\pgfutil@empty - \xdef#2{\pgfmathresult}% - \else - \xdef#2{#2,\pgfmathresult}% - \fi - }% -} - \def\pgfplots@enlarge@limit@ifconfigured#1{% \pgfplots@enlargelimits@autofalse \pgfplots@enlargelimitsfalse @@ -4297,423 +2598,8 @@ \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfplots@glob@TMPb } -% Computes tick positions using the current axis limits. -% -% Parameters: -% /pgfplots/max space between ticks -% Determines the maximum space which is not filled by at least one -% tick label (approximate, there is some rounding internally) -% /pgfplots/try min ticks -% see manual -% -% Idea: -% We want ticks at each -% { i*H, i in \Z }. -% Of course, there shouldn't be TOO MUCH ticks. -% -% Our heuristics is to set -% desirednumticks = round(ACTUAL WIDTH / (max space between ticks) ) -% and generate H = (axis range) / (desirednumticks). -% -% Since not all step sizes H look well, restrict H to a set of allowed -% step sizes such as -% { 1, 1/2, 1/5, 1/10 }, -% or, to be more precise: -% { 1*10^e, 2*10^e, 5*10^e } -% -> round to the nearest matching number! -% -% For log-plots, -% H in { j*log(10), j=1,2,3,... } -% where the usual case should be j = 1. -% -% Then, the resulting tick is -% TICK={MIN,MIN+H,...,MAX} -% where -% MIN = I*H -% is chosen such that -% axis minimum limit = I*H + rest; |rest| < H. -% -% Again, log plots follow a slightly different approach: here, -% MIN = I * log(10) -% is chosen such that -% axis minimum limit = I*log(10) + rest; |rest| < log(10) -% while H = j*log(10), j>=1. -% -% -% PRECONDITION: -% - limits are correct -% - axis width/height is set correctly -% -% POSTCONDITION: -% - Tick for axis #1 is assigned -% - \ifpgfplots@determinedefaultvalues@needs@check@uniformtick is set -% -% REMARKS: -% - this algorithms works also if the data range has been transformed -% with a LINEAR transformation. -% ATTENTION: as of 2008-05-15, the scaling trafo is AFFINE LINEAR. -% That means we have to eliminate the 'affine' shifting before the -% algorithms works correctly. -\def\pgfplots@assign@default@tick@foraxis#1{% - \begingroup - % Shortcut-names: - \expandafter\let\expandafter\ifpgfplots@is@datascaled\csname ifpgfplots@apply@datatrafo@#1\endcsname - % Attention here: use UNSHIFTET scalings, see remark above - \expandafter\let\expandafter\pgfplots@data@scale@trafo\csname pgfplots@datascaletrafo@#1@noshift\endcsname - \expandafter\let\expandafter\pgfplots@data@scale@inverse@trafo\csname pgfplots@inverse@datascaletrafo@#1@noshift\endcsname - \expandafter\let\expandafter\ifpgfplots@cur@is@linear\csname ifpgfplots@#1islinear\endcsname - % - \let\desirednumticks=\c@pgf@countd - \let\Wr=\pgf@xc - \Wr=\csname pgfplots@#1coordmaxTEX\endcsname - \advance\Wr by-\csname pgfplots@#1coordminTEX\endcsname - % r = max place without ticks in pt -> choose desirednumticks >= W/r - \expandafter\expandafter\divide\Wr\axisdefaulttickwidth - \pgfmathsetcount{\desirednumticks}{\Wr}% - \advance\desirednumticks by1 - \csname ifpgfplots@#1islinear\endcsname - \expandafter\ifnum\axisdefaulttryminticks>\desirednumticks - \desirednumticks=\axisdefaulttryminticks - \fi - \else - \expandafter\ifnum\pgfplots@default@try@minticks@log>\desirednumticks - \desirednumticks=\pgfplots@default@try@minticks@log\relax - \fi - \expandafter\ifx\csname pgfplots@#1tickten\endcsname\pgfutil@empty - \else - % log plot and tickten-option: provide special processing. - \edef\pgfplots@loc@TMPa{\csname pgfplots@#1tickten\endcsname}% - \expandafter\pgfplots@compute@tick@times@logten\pgfplots@loc@TMPa\to\pgfplots@glob@TMPa - \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@glob@TMPa - \fi - \fi - % - \expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfutil@empty - % Ok, we have either log or linear axis and need default - % ticks MIN,MIN+H,...,MAX. - \let\MINH=\pgf@xa - \let\H=\pgf@xb - \let\MAX=\pgf@ya - \let\MIN=\pgf@yb - % compute step size 'H': - \expandafter\MAX\csname pgfplots@#1max\endcsname pt - \advance\MAX by0.001pt% avoid round errors - %\expandafter\MIN\the\c@pgf@counta pt - \expandafter\MIN\csname pgfplots@#1min\endcsname pt - \H=\MAX - \advance\H by-\MIN -%\message{Axis limit #1: [\the\MIN:\the\MAX], diff = \the\H.}% - \c@pgf@counta=\desirednumticks - \advance\c@pgf@counta by-1 - \divide\H by\c@pgf@counta -%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% - % - % SEARCH for the NEXT FEASABLE H. - \edef\Hmacro{\pgf@sys@tonumber\H}% - \ifpgfplots@cur@is@linear - % CASE LINEAR AXIS - \ifpgfplots@is@datascaled - % This here works if the scaling trafo is linear. - \expandafter\pgfplots@data@scale@inverse@trafo\expandafter{\Hmacro}% - \let\Hmacro=\pgfmathresult - \else - \pgfmathfloatparsenumber{\Hmacro}% - \let\Hmacro=\pgfmathresult - \fi - \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\H\pgfmathfloat@a@E -%\message{Got T^{-1}(H#1) = \Hmacro}% - % modify the mantisse: - \ifdim\H<2pt - \ifdim\H<1.5pt - \H=1.0pt - \else - \H=2.0pt - \fi - \else - \ifdim\H<4.9999pt - \ifdim\H<3.5pt - \H=2.0pt\relax - \else - \H=5.0pt\relax - \fi - \else - \ifdim\H<7.5pt - \H=5.0pt\relax - \else - \H=1.0pt\relax - \advance\pgfmathfloat@a@E by1 - \fi - \fi - \fi -%\message{Computed H#1=\the\H [unscaled]; transforming ... }% - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgf@sys@tonumber{\H}}{\the\pgfmathfloat@a@E}% - \let\Hmacro=\pgfmathresult - \ifpgfplots@is@datascaled - \pgfplots@data@scale@trafo\Hmacro - \else - \pgfmathfloattofixed\Hmacro - \fi - \let\Hmacro=\pgfmathresult -%\message{got H#1=\Hmacro\ [transformed]}% - \expandafter\H\Hmacro pt - \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformtrue\endcsname - % - % Now, we want to activate the Tick set {i*H, i in \Z} - % compute I such that - % xmin = I * H + rest; |rest| < H - % -> I = round(xmin/H) - % -> MIN = I * H - % - % but first: eliminate any 'affine' data scaling! - \ifpgfplots@is@datascaled - \advance\MIN by\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname pt - \fi - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\MIN}% - {\pgf@sys@tonumber\H}% - }% - \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% - \ifdim\MIN<0pt - % the truncation rounds TOWARDS 0 which is not what I want. - \advance\c@pgf@counta by-1 - \fi - \MIN=\H - \multiply\MIN by\c@pgf@counta - \ifpgfplots@is@datascaled - \advance\MIN by-\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname pt - \fi - \else - % CASE LOG AXIS - % - % search for the "best" H= j* log(10), j an integer. - % - % And prefer j=1 if that is possible (otherwise minor - % ticks are not useful). - \pgfmathmultiply@{\Hmacro}{\reciproclogten}% - \let\Hmacrobaseten=\pgfmathresult - \expandafter\H\pgfmathresult pt -%\message{ [ H / log(10) = \pgfmathresult ]}% - \ifdim\H<2pt - \H=1pt - \else - \ifnum\H<1pt - \H=1pt - \else - \expandafter\pgfmathfloor\expandafter{\pgfmathresult}% - \expandafter\H\pgfmathresult pt - \fi - \fi - \ifdim\H=1pt - \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformtrue\endcsname - \pgfplots@isuniformticktrue - \else - \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformfalse\endcsname - \pgfplots@isuniformtickfalse - \fi -%\message{final H=\pgf@sys@tonumber{\H} * log(10)}% - \H=\logten\H\relax - % Now, we want to activate the Tick set - % {lowest, lowest+H, ..., highest} - % - % Where - % lowest = I * log(10) + rest, |rest| < log(10). - % this is conceptionally different from the approach for - % linear axes, because H = j*log(10). - % - % remember the original xmin in MINH: - \MINH=\MIN - % - % and compute I and I*log(10) here: - \expandafter\MIN\reciproclogten\MIN\relax - \edef\pgfmathresult{\pgf@sys@tonumber{\MIN}}% - \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% - \ifdim\MIN<0pt - % the truncation rounds TOWARDS 0 which is not what I want. - \advance\c@pgf@counta by-1 - \fi - \expandafter\MIN\logten pt - \multiply\MIN by\c@pgf@counta - \ifpgfplots@isuniformtick - \else - % This here is a special case to move the first tick - % near the lower axis limit. - % - % "Near" means either directly above or directly below ymin. - % - % My application example is as follows: - % Let H = 2*log(10). - % Furthermore, ymin = 3e-6, ymax= 8e-2. That means we can choose either - % 10^{-5}, 10^{-3}, 10^{-1} - % or - % 10^{-4}, 10^{-2} - % as ticks. Well, I prefer the first one. - % - % HEURISTICS: start as near to ymin as possible! - % - % We check here if we can come nearer to ymin if we - % shift the current tick by log(10): - % if( ymin - I * log(10) < 0.5*H -> use I+1, that means add log(10). - % - % that's equivalent to - % 2*(ymin - I * log(10)) - H < 0. - \advance\MINH by-\MIN - \multiply\MINH by2 - \advance\MINH by-\H - % - \ifdim\MINH<0pt - \expandafter\advance\expandafter\MIN\logten pt - \fi - \fi - \fi - \MINH=\MIN - \advance\MINH by\H - % Ok, now it can happen that only ONE tick label is placed in - % this range. - % That's useless, so check for it. - % - % That's the case if - % MIN < ORIGMIN && MAX < MIN+2 H - % MIN < ORIGMIN by construction (ok, MIN <= ORIGMIN by - % construction, but I don't care about this case). - % So: check only the second condition. - \pgfplots@tmpa=\MINH - \advance\pgfplots@tmpa by\H - \ifdim\MAX<\pgfplots@tmpa - \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformfalse\endcsname - % ok, do something special. - % - % The idea is now to place ticks at - % 10^{i*h} with properly choosen 'h'. - % - % So: apply basically the SAME code as above for linear - % axis, just everything log 10! And keep in mind that all - % coordinates are actually given as natural logarithms. - \expandafter\MIN\csname pgfplots@#1min\endcsname pt - \H=\MAX - \advance\H by-\MIN - \H=\reciproclogten\H -%\message{Axis limit #1: [\the\MIN:\the\MAX], diff/log(10) = \the\H.}% - \c@pgf@counta=\desirednumticks\relax - \advance\c@pgf@counta by-1 - \ifnum\c@pgf@counta>2 - % subtract one more. This algorithm here produces more - % ticks than the normal one which is designed for 10^i - \advance\c@pgf@counta by-1 - \fi - \divide\H by\c@pgf@counta\relax -%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% - % - % SEARCH for the NEXT FEASABLE H. - \edef\Hmacro{\pgf@sys@tonumber\H}% - \pgfmathfloatparsenumber{\Hmacro}% - \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\H\pgfmathfloat@a@E - % Determine properly snapped mantisse... - \ifdim\H<2pt - \ifdim\H<1.5pt - \H=1.0pt - \else - \H=2.0pt - \fi - \else - \ifdim\H<4.9999pt - \ifdim\H<3.5pt - \H=2.0pt\relax - \else - \H=5.0pt\relax - \fi - \else - \ifdim\H<7.5pt - \H=5.0pt\relax - \else - \H=1.0pt\relax - \advance\pgfmathfloat@a@E by1 - \fi - \fi - \fi - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgf@sys@tonumber{\H}}{\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% - \let\Hmacro=\pgfmathresult - \H=\Hmacro pt% - % Ok, our step size h for 10^{i*h} is ready! -%\message{determined step size 10^{\Hmacro}}% - % Now, we want to activate the Tick set {10^{i*H}, i in \Z} - % compute I such that - % 10^{min} = 10^{I * H + rest}; |rest| < H - % -> I = round(xmin/H) - % -> MIN = I * H - % BUT EVERYTHING to log(10) basis! - \MIN=\reciproclogten\MIN\relax - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\MIN}% - {\Hmacro}% - }% - \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% - \ifdim\MIN<0pt - % the truncation rounds TOWARDS 0 which is not what I want. - \advance\c@pgf@counta by-1 - \fi - \MIN=\H\relax - \multiply\MIN by\c@pgf@counta\relax - % - % convert back to basis 'e': - \MIN=\logten\MIN\relax - \H=\logten\H\relax - \MINH=\MIN\relax - \advance\MINH by\H\relax - \fi -%\pgfplots@message{final H=\the\H.}% - \xdef\pgfplots@glob@TMPa{\pgf@sys@tonumber{\MIN},\pgf@sys@tonumber{\MINH},...,\pgf@sys@tonumber{\MAX}}% - \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\H}}% - \aftergroup\pgfplots@determinedefaultvalues@needs@check@uniformtickfalse - \else - \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@#1tick\endcsname - \gdef\pgfplots@glob@TMPb{}% will be computed later, in 'check uniform tick' - \aftergroup\pgfplots@determinedefaultvalues@needs@check@uniformticktrue - \fi - \endgroup - \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@glob@TMPa - \expandafter\let\csname pgfplots@tick@distance@#1\endcsname=\pgfplots@glob@TMPb -%\pgfplots@message{pgfplots.sty: #1tick set to \csname pgfplots@#1tick\endcsname [#1min=\csname pgfplots@#1min\endcsname, #1max=\csname pgfplots@#1max\endcsname].}% -} -% Helper method for -% \pgfplots@apply@data@scale@trafo@to@options@for -% #1: the ticks -% #2: the trafo macro name -% #3: the output macro name -\long\def\pgfplots@apply@data@scale@trafo@to@user@ticks#1#2\to#3{% - \let#3=\pgfutil@empty - \foreach \pgfplots@loc@TMPb in {#1} {% - \pgfmathfloatparsenumber{\pgfplots@loc@TMPb}% - \expandafter#2\expandafter{\pgfmathresult}% - \ifx#3\pgfutil@empty - \xdef#3{\pgfmathresult}% - \else - \xdef#3{#3,\pgfmathresult}% - \fi - }% - % -}% - -% Helper method for -% \pgfplots@apply@data@scale@trafo@to@options@for -% #1: the ticks ALREADY IN FLOAT FORMAT -% #2: the trafo macro name -% #3: the output macro name -\long\def\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat#1#2\to#3{% - \let#3=\pgfutil@empty - \foreach \pgfplots@loc@TMPb in {#1} {% - #2{\pgfplots@loc@TMPb}% - \ifx#3\pgfutil@empty - \xdef#3{\pgfmathresult}% - \else - \xdef#3{#3,\pgfmathresult}% - \fi - }% - % -}% - -% helper for \pgfplots@apply@data@scale@trafo@to@options@for. +% helper for \pgfplots@check@and@apply@datatrafo@for. \def\pgfplots@compute@number@order@for@trafo@isdimen#1\tocount#2{% \edef\pgfplots@loc@TMPa{\pgf@sys@tonumber{#1}}% \pgfmathfloatparsenumber{\pgfplots@loc@TMPa}% @@ -4721,7 +2607,7 @@ \advance#2 by1\relax } -% helper for \pgfplots@apply@data@scale@trafo@to@options@for. +% helper for \pgfplots@check@and@apply@datatrafo@for. % \def\pgfplots@compute@number@order@for@trafo@isfloat#1\tocount#2{% \expandafter\pgfmathfloat@decompose@E#1\relax#2\relax @@ -4738,210 +2624,235 @@ % - the scaling transformation is set up, % - all axis limits are transformed, % - any user input (like ticks and tick labels) -% will reflect the changes. -\def\pgfplots@apply@data@scale@trafo@to@options@for#1{% - % initialise data scale transformation - % T(x) = 10^{q-m} * x - % - \begingroup - \let\data@max@order=\c@pgf@counta - \let\data@cur@order=\c@pgf@countb - \let\data@dimen=\pgf@xa - \let\data@tmp=\pgf@xb - \let\data@dimen@order=\c@pgf@countc - \let\data@EXPONENT=\c@pgf@countd - \expandafter\let\expandafter\pgfplots@display@min@float\csname pgfplots@#1min\endcsname - \expandafter\let\expandafter\pgfplots@display@max@float\csname pgfplots@#1max\endcsname - \expandafter\let\expandafter\pgfplots@data@min@float\csname pgfplots@data@#1min\endcsname - \expandafter\let\expandafter\pgfplots@data@max@float\csname pgfplots@data@#1max\endcsname - \expandafter\let\expandafter\pgfplots@actual@trafo\csname pgfplots@datascaletrafo@#1\endcsname - \ifpgfplots@autocompute@all@limits - \else - \pgfmathfloatmax@{\pgfplots@display@max@float}{\pgfplots@data@max@float}% - \let\pgfplots@data@max@float=\pgfmathresult - \pgfmathfloatmin@{\pgfplots@display@min@float}{\pgfplots@data@min@float}% - \let\pgfplots@data@min@float=\pgfmathresult - \fi - % - % Step 1: compute 'm', the data order - \pgfplots@compute@number@order@for@trafo@isfloat - \pgfplots@data@min@float - \tocount\data@cur@order - % - \data@max@order=\data@cur@order - % - \pgfplots@compute@number@order@for@trafo@isfloat - \pgfplots@data@max@float - \tocount\data@cur@order - % - \ifnum\data@cur@order>\data@max@order - \data@max@order=\data@cur@order - \fi - % - % Step 2: compute 'q', the #1-size of the axis. - \expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty - % We have 'width' or 'height'. +% EXCEPT unit vectors will reflect the changes. +% +% Unit vectors will be scaled later. +\def\pgfplots@check@and@apply@datatrafo@for#1{% + \expandafter\let\expandafter\if@datascaled@cur\csname ifpgfplots@apply@datatrafo@#1\endcsname + \if@datascaled@cur + \pgfplots@letcsname pgfplots@#1min@unscaled@as@float={pgfplots@#1min}% + \pgfplots@letcsname pgfplots@#1max@unscaled@as@float={pgfplots@#1max}% + % initialise data scale transformation + % T(x) = 10^{q-m} * x % - % Use the order of these parameters. - \def\pgfplots@loc@TMPa{#1}% - \def\pgfplots@loc@TMPb{x}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \data@dimen=\pgfplots@width\relax + \begingroup + \let\data@max@order=\c@pgf@counta + \let\data@cur@order=\c@pgf@countb + \let\data@dimen=\pgf@xa + \let\data@tmp=\pgf@xb + \let\data@dimen@order=\c@pgf@countc + \let\data@EXPONENT=\c@pgf@countd + \expandafter\let\expandafter\pgfplots@display@min@float\csname pgfplots@#1min\endcsname + \expandafter\let\expandafter\pgfplots@display@max@float\csname pgfplots@#1max\endcsname + \expandafter\let\expandafter\pgfplots@data@min@float\csname pgfplots@data@#1min\endcsname + \expandafter\let\expandafter\pgfplots@data@max@float\csname pgfplots@data@#1max\endcsname + \expandafter\let\expandafter\pgfplots@actual@trafo\csname pgfplots@datascaletrafo@#1\endcsname + \ifpgfplots@autocompute@all@limits \else - \def\pgfplots@loc@TMPb{y}% + \pgfplotsmathfloatmax{\pgfplots@display@max@float}{\pgfplots@data@max@float}% + \let\pgfplots@data@max@float=\pgfmathresult + \pgfplotsmathfloatmin{\pgfplots@display@min@float}{\pgfplots@data@min@float}% + \let\pgfplots@data@min@float=\pgfmathresult + \fi + % + % Step 1: compute 'm', the data order + \pgfplots@compute@number@order@for@trafo@isfloat + \pgfplots@data@min@float + \tocount\data@cur@order + % + \data@max@order=\data@cur@order + % + \pgfplots@compute@number@order@for@trafo@isfloat + \pgfplots@data@max@float + \tocount\data@cur@order + % + \ifnum\data@cur@order>\data@max@order + \data@max@order=\data@cur@order + \fi + % + % Step 2: compute 'q', the #1-size of the axis. + \expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty + % We have 'width' or 'height'. + % + % Use the order of these parameters. + \def\pgfplots@loc@TMPa{#1}% + \def\pgfplots@loc@TMPb{x}% \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \data@dimen=\pgfplots@height\relax + \data@dimen=\pgfplots@width\relax + \else + \def\pgfplots@loc@TMPb{y}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \data@dimen=\pgfplots@height\relax + \fi \fi + \pgfplots@compute@number@order@for@trafo@isdimen + \data@dimen + \tocount\data@dimen@order + % This here is to avoid inaccuracies in the final + % axis rectangle size, see \pgfplots@initsizes: + %\advance\data@dimen@order by-1 + \else + % FIXME: + % we have either the 'x=1cm' or 'y=1cm' option! + % How should I initialise the trafo!? + \data@dimen@order=3 \fi - \pgfplots@compute@number@order@for@trafo@isdimen - \data@dimen - \tocount\data@dimen@order - % This here is to avoid inaccuracies in the final - % axis rectangle size, see \pgfplots@initsizes: - %\advance\data@dimen@order by-1 - \else - % FIXME: - % we have either the 'x=1cm' or 'y=1cm' option! - % How should I initialise the trafo!? - \data@dimen@order=3 - \fi - % -%\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }% - \data@EXPONENT=\data@dimen@order - \advance\data@EXPONENT by-\data@max@order - % Now, I introduce a loop which shall avoid cancellation of - % significant digits. - % - % Harmless Example: - % if we have data shift = -3 and - % max = 2e6, min = 1e6, then max-min = 1e6; T(max)-T(min) = 1e3 which is ok. - % In this case, the loop won't change anything. - % - % Critical Example: - % if we have data shift = -3 and - % max = 1980, min = 1930 then - % T(max) = 1.98 and T(min) = 1.93 - % and thus T(max)-T(min) = 0.05 . - % Considering that this is the axis range - % in which tick labels and plot points need to be computed, we - % only have two or three digits left! That happens because the - % prefix '19' is common and is cancelled in the subtraction. - % Idea: while T(max)-T(min) < O(10^2) -> increase shift by +1 - % (and make sure that T(max) < MAX_VALID_TEX_NUMBER). - % - \pgfplots@loop@CONTINUEtrue - \expandafter\edef\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname{0}% - \loop - \expandafter\edef\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname{\the\data@EXPONENT}% - \pgfplots@actual@trafo{\pgfplots@data@min@float}% - \let\pgfplots@min@fixed=\pgfmathresult - \ifpgfplots@loop@CONTINUE - \pgfplots@actual@trafo{\pgfplots@data@max@float}% - \let\pgfplots@max@fixed=\pgfmathresult - \expandafter\data@tmp\pgfplots@max@fixed pt -%\message{Current trafo EXPONENT for #1 direction: \the\data@EXPONENT; original #1 data limits: [\pgfplots@data@min@float:\pgfplots@data@max@float]; current transformed #1 limits: [\pgfplots@min@fixed:\pgfplots@max@fixed]; cancellation check max-min running...}% - \ifdim\data@tmp<0pt - % I need absolute values here: - \multiply\data@tmp by-1\relax - \fi - \pgfmathsubtract@{\pgfplots@max@fixed}{\pgfplots@min@fixed}% - \expandafter\data@dimen\pgfmathresult pt - \pgfplots@loop@CONTINUEfalse - \ifdim\data@tmp<1500pt% a multiplication with '10' results in max = 15000 which is the upper limit. - \ifdim\data@dimen<100pt% I guess if max-min = O(100), we have quite good accuracy - \ifdim\data@dimen<0.0001pt - \else - \advance\data@EXPONENT by1 - \pgfplots@loop@CONTINUEtrue + % + %\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }% + \data@EXPONENT=\data@dimen@order + \advance\data@EXPONENT by-\data@max@order + % Now, I introduce a loop which shall avoid cancellation of + % significant digits. + % + % Harmless Example: + % if we have data shift = -3 and + % max = 2e6, min = 1e6, then max-min = 1e6; T(max)-T(min) = 1e3 which is ok. + % In this case, the loop won't change anything. + % + % Critical Example: + % if we have data shift = -3 and + % max = 1980, min = 1930 then + % T(max) = 1.98 and T(min) = 1.93 + % and thus T(max)-T(min) = 0.05 . + % Considering that this is the axis range + % in which tick labels and plot points need to be computed, we + % only have two or three digits left! That happens because the + % prefix '19' is common and is cancelled in the subtraction. + % Idea: while T(max)-T(min) < O(10^2) -> increase shift by +1 + % (and make sure that T(max) < MAX_VALID_TEX_NUMBER). + % + \pgfplots@loop@CONTINUEtrue + \expandafter\edef\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname{0}% + \pgfutil@loop + \expandafter\edef\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname{\the\data@EXPONENT}% + \pgfplots@actual@trafo{\pgfplots@data@min@float}% + \let\pgfplots@min@fixed=\pgfmathresult + \ifpgfplots@loop@CONTINUE + \pgfplots@actual@trafo{\pgfplots@data@max@float}% + \let\pgfplots@max@fixed=\pgfmathresult + \expandafter\data@tmp\pgfplots@max@fixed pt + %\message{Current trafo EXPONENT for #1 direction: \the\data@EXPONENT; original #1 data limits: [\pgfplots@data@min@float:\pgfplots@data@max@float]; current transformed #1 limits: [\pgfplots@min@fixed:\pgfplots@max@fixed]; cancellation check max-min running...}% + \ifdim\data@tmp<0pt + % I need absolute values here: + \multiply\data@tmp by-1\relax + \fi + \pgfmathsubtract@{\pgfplots@max@fixed}{\pgfplots@min@fixed}% + \expandafter\data@dimen\pgfmathresult pt + \pgfplots@loop@CONTINUEfalse + \ifdim\data@tmp<1500pt % a multiplication with '10' results in max = 15000 which is the upper limit. + \ifdim\data@dimen<100pt % I guess if max-min = O(100), we have quite good accuracy + \ifdim\data@dimen<0.0001pt + \else + \advance\data@EXPONENT by1 + \pgfplots@loop@CONTINUEtrue + \fi \fi \fi + %-------------------------------------------------- + % \ifdim\data@dimen>1200pt% FIXME : is this here ok!? CHECK IT! + % \ifdim\data@dimen>7999pt + % \advance\data@EXPONENT by-2 + % \else + % \advance\data@EXPONENT by-1 + % \fi + % \pgfplots@loop@CONTINUEfalse + % \fi + %-------------------------------------------------- + \pgfutil@repeat + \xdef\pgfplots@glob@TMPa{\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname}% + \xdef\pgfplots@glob@TMPb{\pgfplots@min@fixed}% + \endgroup + %\message{Initialising the data scale transformation in direction #1 to 10^\pgfplots@glob@TMPa*#1 - \pgfplots@glob@TMPb...}% + % COMPLETE INITIALISATION: + \ifpgfplots@disabledatascaling + % this here is a waste of time, I know it. One could really + % safe a lot of CPU time when disabledatascaling is enabled... + % but it requires so much extra cases; I really don't want + % that! + \gdef\pgfplots@glob@TMPa{0}% + \gdef\pgfplots@glob@TMPb{0}% + \fi + \expandafter\let\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname\pgfplots@glob@TMPa + \expandafter\let\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname\pgfplots@glob@TMPb% + % + % ... and apply transformation to any user input + % + % Transform axis limits: + %\message{#1- display limits BEFORE data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% + \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1min\endcsname}% + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult + % + \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1max\endcsname}% + \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult + %\message{#1- display limits after data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% + % Transform tick limits (if they are set): + %\message{#1- display tick limits BEFORE data transformation: [\csname pgfplots@#1tickmin\endcsname:\csname pgfplots@#1tickmax\endcsname]}% + \expandafter\ifx\csname pgfplots@#1tickmin\endcsname\pgfutil@empty + \else + \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1tickmin\endcsname}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult \fi - %-------------------------------------------------- - % \ifdim\data@dimen>1200pt% FIXME : is this here ok!? CHECK IT! - % \ifdim\data@dimen>7999pt - % \advance\data@EXPONENT by-2 - % \else - % \advance\data@EXPONENT by-1 - % \fi - % \pgfplots@loop@CONTINUEfalse - % \fi - %-------------------------------------------------- - \repeat - \xdef\pgfplots@glob@TMPa{\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname}% - \xdef\pgfplots@glob@TMPb{\pgfplots@min@fixed}% - \endgroup -%\message{Initialising the data scale transformation in direction #1 to 10^\pgfplots@glob@TMPa*#1 - \pgfplots@glob@TMPb...}% - % COMPLETE INITIALISATION: - \ifpgfplots@disabledatascaling - % this here is a waste of time, I know it. One could really - % safe a lot of CPU time when disabledatascaling is enabled... - % but it requires so much extra cases; I really don't want - % that! - \gdef\pgfplots@glob@TMPa{0}% - \gdef\pgfplots@glob@TMPb{0}% - \fi - \expandafter\let\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname\pgfplots@glob@TMPa - \expandafter\let\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname\pgfplots@glob@TMPb% - % - % ... and apply transformation to any user input - % - % Transform axis limits: -%\message{#1- display limits BEFORE data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% - \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1min\endcsname}% - \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult - % - \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1max\endcsname}% - \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult -%\message{#1- display limits after data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% - % - % Convert any user-specified ticks: - \edef\pgfplots@loc@TMPa{\csname pgfplots@#1tick\endcsname}% - % this here should also work with 'xtick=\pgfutil@empty', the "No tick" command. - \ifx\pgfplots@loc@TMPa\pgfutil@empty - \else - \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% - \def\pgfplots@loc@TMPb{data}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - % we have #1tick = data - % - % Since we have entered this method, we know that these - % coordinate ARE ALREADY in floating point representation. - \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@firstplot@coords@#1\endcsname - \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% - \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% - \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + % + \expandafter\ifx\csname pgfplots@#1tickmax\endcsname\pgfutil@empty + \else + \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1tickmax\endcsname}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult + \fi + %\message{#1- display tick limits after data transformation: [\csname pgfplots@#1tickmin\endcsname:\csname pgfplots@#1tickmax\endcsname]}% + % + % Convert any user-specified ticks: + \edef\pgfplots@loc@TMPa{\csname pgfplots@#1tick\endcsname}% + % this here should also work with 'xtick=\pgfutil@empty', the "No tick" command. + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% + \def\pgfplots@loc@TMPb{data}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + % we have #1tick = data + % + % Since we have entered this method, we know that these + % coordinate ARE ALREADY in floating point representation. + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@firstplot@coords@#1\endcsname + \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% + \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + % clear structure: + \expandafter\global\expandafter\let\csname pgfplots@firstplot@coords@#1\endcsname=\pgfutil@empty + \else + \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% + %\message{Converting #1tick='\csname pgfplots@#1tick\endcsname'}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% + \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + \fi + \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@loc@TMPc + \fi + % + % Convert any extra-ticks, see above. + \edef\pgfplots@loc@TMPa{\csname pgfplots@extra@#1tick\endcsname}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% -%\message{Converting #1tick='\csname pgfplots@#1tick\endcsname'}% - \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% + \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% + \edef\pgfplots@loc@TMPa{{\csname pgfplots@extra@#1tick\endcsname}\the\t@pgfplots@tokc}% \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + \expandafter\let\csname pgfplots@extra@#1tick\endcsname=\pgfplots@loc@TMPc \fi - \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@loc@TMPc - \fi - % - % Convert any extra-ticks, see above. - \edef\pgfplots@loc@TMPa{\csname pgfplots@extra@#1tick\endcsname}% - \ifx\pgfplots@loc@TMPa\pgfutil@empty - \else - \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% - \edef\pgfplots@loc@TMPa{{\csname pgfplots@extra@#1tick\endcsname}\the\t@pgfplots@tokc}% - \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc - \expandafter\let\csname pgfplots@extra@#1tick\endcsname=\pgfplots@loc@TMPc - \fi - % - % Transform any explicit axis unit scalings: - \expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty + % + % Transform any explicit axis unit scalings: + % WILL BE DONE LATER! \else -%\message{Converting #1 unit scale='\csname pgfplots@#1\endcsname' ... }% - \expandafter\pgfmathparse\expandafter{\csname pgfplots@#1\endcsname}% - \expandafter\expandafter\csname pgfplots@inverse@datascaletrafo@tofixed@#1@noshift\endcsname\expandafter{\pgfmathresult}% - \expandafter\edef\csname pgfplots@#1\endcsname{\pgfmathresult pt}% -%\message{to #1='\csname pgfplots@#1\endcsname'.}% + \expandafter\def\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname{0}% + \def\pgfplots@loc@TMPb{data}% + \expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfplots@loc@TMPb + \pgfplots@letcsname pgfplots@#1tick={pgfplots@firstplot@coords@#1}% + % clear structure: + \expandafter\global\expandafter\let\csname pgfplots@firstplot@coords@#1\endcsname=\pgfutil@empty + \fi + \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfutil@empty + \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfutil@empty \fi } -\newif\ifpgfplots@determinedefaultvalues@xisuniform -\newif\ifpgfplots@determinedefaultvalues@yisuniform +\newif\ifpgfplots@determinedefaultvalues@isuniform \newif\ifpgfplots@determinedefaultvalues@needs@check@uniformtick \newif\ifpgfplots@limits@are@computed @@ -4959,6 +2870,8 @@ \gdef\pgfplots@xmin{0}% \gdef\pgfplots@xmax{1}% \fi + % unnecessary? they will be reset anyway because empty plots are + % recognised before any other axis limit routine \ifpgfplots@yislinear \pgfmathfloatcreate{0}{0.0}{0}% \global\let\pgfplots@ymin=\pgfmathresult @@ -4970,6 +2883,7 @@ \gdef\pgfplots@ymin{0}% \gdef\pgfplots@ymax{1}% \fi + \pgfplots@threedimfalse \def\pgfplots@xtick{}% \def\pgfplots@ytick{}% \def\pgfplots@extra@xtick{}% @@ -4984,15 +2898,23 @@ \ifx\pgfplots@xmin\pgfplots@invalidrange@xmin \pgfplots@limits@are@computedfalse \fi - \ifx\pgfplots@xmin\pgfplots@invalidrange@xmax + \ifx\pgfplots@xmax\pgfplots@invalidrange@xmax \pgfplots@limits@are@computedfalse \fi \ifx\pgfplots@ymin\pgfplots@invalidrange@ymin \pgfplots@limits@are@computedfalse \fi - \ifx\pgfplots@ymin\pgfplots@invalidrange@ymax + \ifx\pgfplots@ymax\pgfplots@invalidrange@ymax \pgfplots@limits@are@computedfalse \fi + \ifpgfplots@threedim + \ifx\pgfplots@zmin\pgfplots@invalidrange@zmin + \pgfplots@limits@are@computedfalse + \fi + \ifx\pgfplots@zmax\pgfplots@invalidrange@zmax + \pgfplots@limits@are@computedfalse + \fi + \fi \ifpgfplots@limits@are@computed \ifx\pgfplots@data@xmin\pgfplots@invalidrange@xmin \global\let\pgfplots@data@xmin=\pgfplots@xmin @@ -5006,19 +2928,32 @@ \ifx\pgfplots@data@ymin\pgfplots@invalidrange@ymax \global\let\pgfplots@data@ymax=\pgfplots@ymax \fi + \ifx\pgfplots@data@zmin\pgfplots@invalidrange@zmin + \global\let\pgfplots@data@zmin=\pgfplots@zmin + \fi + \ifx\pgfplots@data@zmin\pgfplots@invalidrange@zmax + \global\let\pgfplots@data@zmax=\pgfplots@zmax + \fi \ifpgfplots@clip@limits \else % there is a rare change that min > max. % Handle that ... - \pgfmathfloatmin@{\pgfplots@xmin}{\pgfplots@xmax}% + \pgfplotsmathfloatmin{\pgfplots@xmin}{\pgfplots@xmax}% \global\let\pgfplots@xmin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@xmin}{\pgfplots@xmax}% + \pgfplotsmathfloatmax{\pgfplots@xmin}{\pgfplots@xmax}% \global\let\pgfplots@xmax=\pgfmathresult % - \pgfmathfloatmin@{\pgfplots@ymin}{\pgfplots@ymax}% + \pgfplotsmathfloatmin{\pgfplots@ymin}{\pgfplots@ymax}% \global\let\pgfplots@ymin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@ymin}{\pgfplots@ymax}% + \pgfplotsmathfloatmax{\pgfplots@ymin}{\pgfplots@ymax}% \global\let\pgfplots@ymax=\pgfmathresult + % + \ifpgfplots@threedim + \pgfplotsmathfloatmin{\pgfplots@zmin}{\pgfplots@zmax}% + \global\let\pgfplots@zmin=\pgfmathresult + \pgfplotsmathfloatmax{\pgfplots@zmin}{\pgfplots@zmax}% + \global\let\pgfplots@zmax=\pgfmathresult + \fi \fi \else \pgfplots@handle@invalid@range @@ -5026,31 +2961,45 @@ }% +% This method finishes the accumulated information of axis limits and +% all internal flag fields. +% +% PRECONDITION: +% - all plots are finally finished; axis and data limits are known. +% +% POSTCONDITION: +% - the scaling transformation is set-up and applied to all user +% inputs and axis limits. +% - the \pgfplots@[xy][min,max] variables and associated TeX +% registers are set up and final. They should not be changed +% afterwards. +% - any tick lists etc. are final. +% \def\pgfplots@determinedefaultvalues{% \pgfplots@check@invalid@range % %-------------------------------------------------- %FIXME % \ifpgfplots@float@numerics@mode@x - % \pgfmathfloatmin@{\pgfplots@xmin}{\pgfplots@xmax}% + % \pgfplotsmathfloatmin{\pgfplots@xmin}{\pgfplots@xmax}% % \let\pgfplots@xmin=\pgfmathresult - % \pgfmathfloatmax@{\pgfplots@xmin}{\pgfplots@xmax}% + % \pgfplotsmathfloatmax{\pgfplots@xmin}{\pgfplots@xmax}% % \let\pgfplots@xmax=\pgfmathresult % \else - % \pgfmathmin@{\pgfplots@xmin}{\pgfplots@xmax}% + % \pgfplotsmathmin{\pgfplots@xmin}{\pgfplots@xmax}% % \let\pgfplots@xmin=\pgfmathresult - % \pgfmathmax@{\pgfplots@xmin}{\pgfplots@xmax}% + % \pgfplotsmathmax{\pgfplots@xmin}{\pgfplots@xmax}% % \let\pgfplots@xmax=\pgfmathresult % \fi % \ifpgfplots@float@numerics@mode@y - % \pgfmathfloatmin@{\pgfplots@ymin}{\pgfplots@ymax}% + % \pgfplotsmathfloatmin{\pgfplots@ymin}{\pgfplots@ymax}% % \let\pgfplots@ymin=\pgfmathresult - % \pgfmathfloatmax@{\pgfplots@ymin}{\pgfplots@ymax}% + % \pgfplotsmathfloatmax{\pgfplots@ymin}{\pgfplots@ymax}% % \let\pgfplots@ymax=\pgfmathresult % \else - % \pgfmathmin@{\pgfplots@ymin}{\pgfplots@ymax}% + % \pgfplotsmathmin{\pgfplots@ymin}{\pgfplots@ymax}% % \let\pgfplots@ymin=\pgfmathresult - % \pgfmathmax@{\pgfplots@ymin}{\pgfplots@ymax}% + % \pgfplotsmathmax{\pgfplots@ymin}{\pgfplots@ymax}% % \let\pgfplots@ymax=\pgfmathresult % \fi %-------------------------------------------------- @@ -5060,36 +3009,16 @@ \pgfplots@set@default@size@options % % - \ifpgfplots@apply@datatrafo@x - \let\pgfplots@xmin@unscaled@as@float=\pgfplots@xmin - \let\pgfplots@xmax@unscaled@as@float=\pgfplots@xmax - \pgfplots@apply@data@scale@trafo@to@options@for x% - \else - \def\pgfplots@loc@TMPb{data}% - \ifx\pgfplots@xtick\pgfplots@loc@TMPb - \let\pgfplots@xtick=\pgfplots@firstplot@coords@x - \fi - \let\pgfplots@xmin@unscaled@as@float=\pgfutil@empty - \let\pgfplots@xmax@unscaled@as@float=\pgfutil@empty - \fi - \ifpgfplots@apply@datatrafo@y - \let\pgfplots@ymin@unscaled@as@float=\pgfplots@ymin - \let\pgfplots@ymax@unscaled@as@float=\pgfplots@ymax - \pgfplots@apply@data@scale@trafo@to@options@for y% - \else - \def\pgfplots@loc@TMPb{data}% - \ifx\pgfplots@ytick\pgfplots@loc@TMPb - \let\pgfplots@ytick=\pgfplots@firstplot@coords@y - \fi - \let\pgfplots@ymin@unscaled@as@float=\pgfutil@empty - \let\pgfplots@ymax@unscaled@as@float=\pgfutil@empty + \pgfplots@check@and@apply@datatrafo@for x% + \pgfplots@check@and@apply@datatrafo@for y% + \ifpgfplots@threedim + \pgfplots@check@and@apply@datatrafo@for z% \fi \pgfplots@datascaletrafo@initialisedtrue % % From now on, we can always work with pgfmath. % We simply need to apply the data scaling trafo before doing so. \pgfkeysgetvalue{/pgfplots/minor x tick num}\pgfplots@minor@xtick@num - \pgfkeysgetvalue{/pgfplots/minor y tick num}\pgfplots@minor@ytick@num \ifpgfplots@xislinear \ifnum\pgfplots@minor@xtick@num=0\relax \pgfplots@xminorticksfalse @@ -5098,6 +3027,11 @@ \pgfplots@xminortickstrue \fi \fi + % + \pgfplots@enlarge@limit@ifconfigured x + \pgfplots@avoid@empty@axis@range@for x% + % + \pgfkeysgetvalue{/pgfplots/minor y tick num}\pgfplots@minor@ytick@num \ifpgfplots@yislinear \ifnum\pgfplots@minor@ytick@num=0\relax \pgfplots@yminorticksfalse @@ -5106,17 +3040,27 @@ \pgfplots@yminortickstrue \fi \fi - % - \pgfplots@enlarge@limit@ifconfigured x \pgfplots@enlarge@limit@ifconfigured y - % - \pgfplots@avoid@empty@axis@range@for x% \pgfplots@avoid@empty@axis@range@for y% + + \ifpgfplots@threedim + \pgfkeysgetvalue{/pgfplots/minor z tick num}\pgfplots@minor@ztick@num + \ifpgfplots@zislinear + \ifnum\pgfplots@minor@ztick@num=0\relax + \pgfplots@zminorticksfalse + \pgfplots@zminorgridsfalse + \else + \pgfplots@zminortickstrue + \fi + \fi + \pgfplots@enlarge@limit@ifconfigured y + \pgfplots@avoid@empty@axis@range@for y% + \fi + % % \pgfplots@initsizes % - \pgfplots@determinedefaultvalues@xisuniformtrue - \pgfplots@determinedefaultvalues@yisuniformtrue + \pgfplots@isuniformticktrue \pgfplots@determinedefaultvalues@needs@check@uniformticktrue \ifx\pgfplots@xtick\pgfutil@empty \pgfplots@assign@default@tick@foraxis{x}% @@ -5124,27 +3068,52 @@ \ifpgfplots@determinedefaultvalues@needs@check@uniformtick \ifpgfplots@xislinear \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@xtick}{\pgfplots@tick@distance@x}% - \ifpgfplots@isuniformtick - \pgfplots@determinedefaultvalues@xisuniformtrue - \else - \pgfplots@determinedefaultvalues@xisuniformfalse - \fi \else \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@xtick}% - \ifpgfplots@isuniformtick - \pgfplots@determinedefaultvalues@xisuniformtrue - \else - \pgfplots@determinedefaultvalues@xisuniformfalse - \fi \fi \fi - \ifpgfplots@determinedefaultvalues@xisuniform + \ifpgfplots@isuniformtick \else \pgfplots@xminorticksfalse + \pgfplots@xminorgridsfalse + \fi + % + \ifx\pgfplots@xticklabelaxisspec\pgfutil@empty + \ifnum\pgfplots@xtickposnum=3 % right + \def\pgfplots@xticklabelaxisspec{v10}% + \else + \def\pgfplots@xticklabelaxisspec{v00}% + \fi + \fi + \ifx\pgfplots@yticklabelaxisspec\pgfutil@empty + \ifnum\pgfplots@ytickposnum=3 % right + \def\pgfplots@yticklabelaxisspec{1v0}% + \else + \def\pgfplots@yticklabelaxisspec{0v0}% + \fi + \fi + \ifx\pgfplots@zticklabelaxisspec\pgfutil@empty + \ifnum\pgfplots@ztickposnum=3 % right + \def\pgfplots@zticklabelaxisspec{01v}% + \else + \def\pgfplots@zticklabelaxisspec{00v}% + \fi + \fi + % + \ifx\pgfplots@xticklabel\pgfutil@empty + \ifpgfplots@xislinear + \def\pgfplots@xticklabel{\axisdefaultticklabel}% + \else + \def\pgfplots@xticklabel{\axisdefaultticklabellog}% + \fi + \fi + \ifx\pgfplots@extra@xticklabel\pgfutil@empty + \let\pgfplots@extra@xticklabel=\pgfplots@xticklabel \fi % % % + \pgfplots@isuniformticktrue \pgfplots@determinedefaultvalues@needs@check@uniformticktrue \ifx\pgfplots@ytick\pgfutil@empty \pgfplots@assign@default@tick@foraxis{y}% @@ -5152,35 +3121,16 @@ \ifpgfplots@determinedefaultvalues@needs@check@uniformtick \ifpgfplots@yislinear \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@ytick}{\pgfplots@tick@distance@y}% - \ifpgfplots@isuniformtick - \pgfplots@determinedefaultvalues@yisuniformtrue - \else - \pgfplots@determinedefaultvalues@yisuniformfalse - \fi \else \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@ytick}% - \ifpgfplots@isuniformtick - \pgfplots@determinedefaultvalues@yisuniformtrue - \else - \pgfplots@determinedefaultvalues@yisuniformfalse - \fi \fi \fi - \ifpgfplots@determinedefaultvalues@yisuniform + \ifpgfplots@isuniformtick \else \pgfplots@yminorticksfalse + \pgfplots@yminorgridsfalse \fi % - \ifx\pgfplots@xticklabel\pgfutil@empty - \ifpgfplots@xislinear - \def\pgfplots@xticklabel{\axisdefaultticklabel}% - \else - \def\pgfplots@xticklabel{\axisdefaultticklabellog}% - \fi - \fi - \ifx\pgfplots@extra@xticklabel\pgfutil@empty - \let\pgfplots@extra@xticklabel=\pgfplots@xticklabel - \fi \ifx\pgfplots@yticklabel\pgfutil@empty \ifpgfplots@yislinear \def\pgfplots@yticklabel{\axisdefaultticklabel}% @@ -5192,49 +3142,40 @@ \let\pgfplots@extra@yticklabel=\pgfplots@yticklabel \fi % - % - \pgfplots@prepare@ZERO@coordinates -} - -% This code is mainly interesting for bar plots. -% -% It precomputes x = 0 and y = 0 - which is not necessarily -% trivial in case of data scaling. Furthermore, it applies -% coordinate clipping to the resulting values and multiplies them -% with x- and y scale vectors. -\def\pgfplots@prepare@ZERO@coordinates{% - \ifpgfplots@xislinear - \ifpgfplots@apply@datatrafo@x - \pgfplots@datascaletrafo@fromfixed@x{0}% - \global\let\pgfplots@ZERO@x=\pgfmathresult - \else - \gdef\pgfplots@ZERO@x{0}% + \ifpgfplots@threedim + \pgfplots@isuniformticktrue + \pgfplots@determinedefaultvalues@needs@check@uniformticktrue + \ifx\pgfplots@ztick\pgfutil@empty + \pgfplots@assign@default@tick@foraxis{z}% \fi - \pgfmathmax@{\pgfplots@ZERO@x}{\pgfplots@xmin}% - \global\let\pgfplots@ZERO@x=\pgfmathresult - \else - \global\let\pgfplots@ZERO@x=\pgfplots@xmin% - \fi - % - \ifpgfplots@yislinear - \ifpgfplots@apply@datatrafo@y - \pgfplots@datascaletrafo@fromfixed@y{0}% - \global\let\pgfplots@ZERO@y=\pgfmathresult + \ifpgfplots@determinedefaultvalues@needs@check@uniformtick + \ifpgfplots@zislinear + \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@ztick}{\pgfplots@tick@distance@z}% + \else + \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@ztick}% + \fi + \fi + \ifpgfplots@isuniformtick \else - \gdef\pgfplots@ZERO@y{0}% + \pgfplots@zminorticksfalse + \pgfplots@zminorgridsfalse + \fi + % + \ifx\pgfplots@zticklabel\pgfutil@empty + \ifpgfplots@zislinear + \def\pgfplots@zticklabel{\axisdefaultticklabel}% + \else + \def\pgfplots@zticklabel{\axisdefaultticklabellog}% + \fi + \fi + \ifx\pgfplots@extra@zticklabel\pgfutil@empty + \let\pgfplots@extra@zticklabel=\pgfplots@zticklabel \fi - \pgfmathmax@{\pgfplots@ZERO@y}{\pgfplots@ymin}% - \global\let\pgfplots@ZERO@y=\pgfmathresult - \else - \global\let\pgfplots@ZERO@y=\pgfplots@ymin% \fi % - \pgfinterruptboundingbox% - \pgfpointxy{\pgfplots@ZERO@x}{\pgfplots@ZERO@y}% - \xdef\pgfplots@ZERO@x{\the\pgf@x}% - \xdef\pgfplots@ZERO@y{\the\pgf@y}% - \endpgfinterruptboundingbox% -}% + % + \pgfplots@prepare@ZERO@coordinates +} % Helper method for initsizes. @@ -5244,13 +3185,12 @@ % The actual width is % c + x*(xmax-xmin) % based on -% - x*xmax = \pgfplots@xcoordmaxTEX -% - x*xmin = \pgfplots@xcoordminTEX % - c = estimated, a constant for the axis label/tick labels % % Arguments: -% #1: the output argument for the SCALE. -\def\pgfplots@initsizes@getXscale\into#1{% +% #1: is expected to be x*(xmax-xmin) measured in pt. +% #2: the output argument for the SCALE. +\def\pgfplots@initsizes@getXscale#1\into#2{% \begingroup \pgf@xa=\pgfplots@width\relax % EXPECTED WIDTH = X = \pgfplots@width @@ -5268,8 +3208,7 @@ \pgf@xa=0pt \fi % \pgf@xb := x*(xmax-xmin): - \pgf@xb=\pgfplots@xcoordmaxTEX - \advance\pgf@xb by-\pgfplots@xcoordminTEX + \pgf@xb=#1\relax \pgfmathlog@invoke@expanded\pgfmathdivide@{% {\pgf@sys@tonumber\pgf@xa}% {\pgf@sys@tonumber\pgf@xb}% @@ -5278,14 +3217,14 @@ % c=estimated, % width-c =\the\pgf@xa, % x*(xmax[=\the\pgfplots@xcoordmaxTEX] - xmin[=\the\pgfplots@xcoordminTEX)]) = \the\pgf@xb -% -> x-scale =#1 }% +% -> x-scale =#2 }% \pgfmath@smuggleone\pgfmathresult \endgroup - \let#1=\pgfmathresult + \let#2=\pgfmathresult } % The same as \pgfplots@initsizes@getXscale, just for the height. -\def\pgfplots@initsizes@getYscale\into#1{% +\def\pgfplots@initsizes@getYscale#1\into#2{% \begingroup \expandafter\pgf@xa\pgfplots@height\relax % EXPECTED WIDTH = X = \pgfplots@width @@ -5302,9 +3241,8 @@ \pgfplots@error{Error: Plot height `\pgfplots@height' is too small. This can't be realised while maintaining constant height for x-labels. Sorry, label heights are only approximate. You will need to adjust your height.}% \pgf@xa=0pt \fi - % \pgf@xb := x*(xmax-xmin): - \pgf@xb=\pgfplots@ycoordmaxTEX - \advance\pgf@xb by-\pgfplots@ycoordminTEX + % \pgf@xb := y*(ymax-ymin): + \pgf@xb=#1% \pgfmathlog@invoke@expanded\pgfmathdivide@{% {\pgf@sys@tonumber\pgf@xa}% {\pgf@sys@tonumber\pgf@xb}% @@ -5314,10 +3252,10 @@ % c=estimated, % height-c =\the\pgf@xa, % y*(ymax[=\the\pgfplots@ycoordmaxTEX] - ymin[=\the\pgfplots@ycoordminTEX)]) = \the\pgf@xb -% -> y-scale =#1 }% +% -> y-scale =#2 }% \pgfmath@smuggleone\pgfmathresult \endgroup - \let#1=\pgfmathresult + \let#2=\pgfmathresult } @@ -5335,8 +3273,8 @@ \let\min@d=\pgf@xa \let\max@d=\pgf@xb \let\diff=\pgf@xc - \expandafter\min@d\pgfplots@@min pt - \expandafter\max@d\pgfplots@@max pt + \expandafter\min@d\pgfplots@@min pt % + \expandafter\max@d\pgfplots@@max pt % \diff=\max@d \advance\diff by-\min@d % FIXME : I need a RELATIVE check here! @@ -5359,20 +3297,20 @@ % the case \pgfplots@@min ~= \pgfplots@@max % % enlarge \pgfplots@@max and shrink \min: - \ifdim\max@d<0pt - \ifdim\max@d<-1pt + \ifdim\max@d<0pt% + \ifdim\max@d<-1pt% \max@d=0.8\max@d \min@d=1.2\min@d \else - \advance\max@d by-1pt - \advance\min@d by1pt + \advance\max@d by-1pt% + \advance\min@d by1pt% \fi \else - \ifdim\max@d>1pt + \ifdim\max@d>1pt% \max@d=1.2\max@d \min@d=0.8\min@d \else - \ifdim\max@d=0pt + \ifdim\max@d=0pt% \if@cur@is@scaled \expandafter\let\expandafter\min@unscaled\csname pgfplots@#1min@unscaled@as@float\endcsname \expandafter\let\expandafter\max@unscaled\csname pgfplots@#1max@unscaled@as@float\endcsname @@ -5465,6 +3403,10 @@ % the plot will be resized; keeping the aspect ratio. % \let\pgfplots@default@aspect@ratio=\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/x}{\pgfplots@x}% + \pgfkeysgetvalue{/pgfplots/y}{\pgfplots@y}% + \pgfkeysgetvalue{/pgfplots/z}{\pgfplots@z}% + % % CASES: % hasx := 'x' option non-empty % hasy := 'y' option non-empty @@ -5535,6 +3477,320 @@ \fi } +% A helper method for \pgfplots@initsizes which +% - applies the data scaling trafo to user arguments +% - sets calls pgfset#1vec +% - computes \pgfplots@#1@veclength +% - computes \pgfplots@#1@inverseveclength +% +% #1: the vector to set (either 'x' or 'y') +% #2: the index of the vector to set (either 0 or 1) +% #3: the already precomputed temporary scale (see pgfplots@initsizes) +% #4: an output argument. It is a macro name which will be defined to +% '1' if and only if the finally set vector is parallel to the #1 axis +% of PGF, that means (x,0) for #1=x and (0,y) for #2=y. +\def\pgfplots@initsizes@setunitvector#1#2#3#4{% + \expandafter\let\expandafter\pgfplots@loc@TMPb\csname pgfplots@#1\endcsname + \expandafter\let\expandafter\if@cur@is@scaled\csname ifpgfplots@apply@datatrafo@#1\endcsname + \ifx\pgfplots@loc@TMPb\pgfutil@empty + \def#4{1}% we have (#1,0) or (0,#1) + % +%\message{Setting unitvector(#1) to auto-computed multiple of e_#2 ...}% + \edef\pgfplots@loc@TMPa{#3}% + \begingroup + \pgf@xa=#3\relax + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% + \endgroup +% FIXME : '\pgfplots@loc@TMPa' contains 'pt' leading to missing +% character warning! + \ifcase#2\relax + \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPa}{0pt}}% + \pgfmathabs@{\pgfplots@glob@TMPb}% + \or + \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@loc@TMPa}}% + \pgfmathabs@{\pgfplots@glob@TMPb}% + \or + \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPa}}% + \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \fi + % The numbers 1/||e_x|| and 1/||e_y|| are used by the tick + % placement code to convert between logical and physical + % coordinates. FIXME is that accurate enough!? + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + \else + % Ok, we have a user-defined unit vector. + % + % That means we also need to apply the scaling trafo! + % + % + % 1. Check whether we have a complete vector of type (x,y): + \expandafter\pgfutil@in@\expandafter(\expandafter{\pgfplots@loc@TMPb}% + \ifpgfutil@in@ + % YES: we have (x,y): + % + \def#4{0}% we DON'T have (#1,0) or (0,#1). At least I think so. + % +%\message{Setting unitvector(#1) to non-standard \csname pgfplots@#1\endcsname ...}% + \def\pgfplots@loc@TMPa(##1,##2){% + \pgfmathparse{##1}% + \ifpgfplots@apply@datatrafo@x + \expandafter\pgfplots@inverse@datascaletrafo@tofixed@x@noshift\expandafter{\pgfmathresult}% + \fi + \let\pgfplots@loc@TMPb=\pgfmathresult + % + \pgfmathparse{##2}% + \ifpgfplots@apply@datatrafo@y + \expandafter\pgfplots@inverse@datascaletrafo@tofixed@y@noshift\expandafter{\pgfmathresult}% + \fi + \let\pgfplots@loc@TMPc=\pgfmathresult + \csname pgfset#1vec\endcsname{\pgfqpoint{\pgfplots@loc@TMPb pt}{\pgfplots@loc@TMPc pt}}% + }% + \expandafter\pgfplots@loc@TMPa\pgfplots@loc@TMPb% + % + \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + \else + % NO we simply have a scalar value. + \def#4{1}% we have (#1,0) or (0,#1) +%\message{Setting unitvector(#1) to \csname pgfplots@#1\endcsname * e_{#2}...}% + \if@cur@is@scaled + \pgfmathparse{\csname pgfplots@#1\endcsname}% + \expandafter\expandafter\csname pgfplots@inverse@datascaletrafo@tofixed@#1@noshift\endcsname\expandafter{\pgfmathresult}% + \edef\pgfplots@loc@TMPb{\pgfmathresult pt}% + \fi + \begingroup + \pgf@xa=\pgfplots@loc@TMPb\relax + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% + \endgroup + \ifcase#2\relax + \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPb}{0pt}}% + \pgfmathabs@{\pgfplots@glob@TMPb}% + \or + \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@loc@TMPb}}% + \pgfmathabs@{\pgfplots@glob@TMPb}% + \or + \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPb}}% + \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \fi + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + \fi + \fi +}% + +% Applies the 'axis equal' feature. +% +% PRECONDITION: +% - final unit vectors have been set +% - final axis limits are given in transformed range +% - \pgfplots@set@default@size@options has been invoked before +% +% POSTCONDITION: +% - unit vectors have been set to equal length, +% - axis limits have been rescaled such that the axis dimensions +% remain fixed +% +% There is just one algorithmic difficulty: the data scaling +% transformation. All unit vector length above are only meaningful in +% the UNTRANSFORMED range, so we have to mingle with the scaling +% transformation. +\def\pgfplots@axis@equal@apply{% + % Step 1: compute the unit vector which STAYS CONSTANT. + % + % All other ones will be scaled to fit its length. + \ifpgfplots@threedim + \def\pgfplots@axis@equal@apply@reference{x}% + \pgfplots@if@unitveclenlessthan@untransformed xy{% + \pgfplots@if@unitveclenlessthan@untransformed xz{% + \def\pgfplots@axis@equal@apply@reference{x}% + }{}% + }{}% + \pgfplots@if@unitveclenlessthan@untransformed yx{% + \pgfplots@if@unitveclenlessthan@untransformed yz{% + \def\pgfplots@axis@equal@apply@reference{y}% + }{}% + }{}% + \pgfplots@if@unitveclenlessthan@untransformed zx{% + \pgfplots@if@unitveclenlessthan@untransformed zy{% + \def\pgfplots@axis@equal@apply@reference{z}% + }{}% + }{}% + \else + \pgfplots@if@unitveclenlessthan@untransformed xy{% + \def\pgfplots@axis@equal@apply@reference{x}% + }{% + \def\pgfplots@axis@equal@apply@reference{y}% + }% + \fi +%\message{USING REFERENCE UNIT VECTOR FROM \pgfplots@axis@equal@apply@reference.}% + \if x\pgfplots@axis@equal@apply@reference + \else + \pgfplots@axis@equal@apply@for x + \fi + \if y\pgfplots@axis@equal@apply@reference + \else + \pgfplots@axis@equal@apply@for y + \fi + \ifpgfplots@threedim + \if z\pgfplots@axis@equal@apply@reference + \else + \pgfplots@axis@equal@apply@for z + \fi + \fi +}% + +% Scales unit vector '#1' such that it has the same length as the unit +% vector in direction \pgfplots@axis@equal@apply@reference. +% +% The data limits for '#1' will be enlarged as well (for 'axis +% equal'). +\def\pgfplots@axis@equal@apply@for#1{% + \pgfmathmultiply@ + {\csname pgfplots@\pgfplots@axis@equal@apply@reference @veclength\endcsname} + {\csname pgfplots@#1@inverseveclength\endcsname}% + \global\let\pgfplots@glob@TMPa=\pgfmathresult + \pgfmathmultiply@ + {\csname pgfplots@\pgfplots@axis@equal@apply@reference @inverseveclength\endcsname} + {\csname pgfplots@#1@veclength\endcsname}% + \global\let\pgfplots@glob@TMPb=\pgfmathresult + % + % If the datascaling transformation is active (which is almost + % every the case here), we need to respect it here. + % + % We only need to respect the SCALING, translations (shifts) are + % not interesting. + % + % We want that || T^{-1} e_ref || = || T^{-1} E_#1 ||. + % + % So: T^{-1} E_#1 := s* T^{-1} e_#1 where + % s = ||T^{-1} e_ref|| / || T^{-1} e_#1 || + % = |10^{scale_ref}| / |10^{scale_#1}| * || e_ref|| / ||e_#1||. + % + % Then, E_#1 = T ( T^{-1} E_#1 ) = s * e_#1. + % + % -> compute 's'! We already have the quotient of unit vectors. + % Now, acquire the scale quotients. + % + \begingroup + \def\pgfplots@tmp@exponentref{0}% + \def\pgfplots@tmp@exponentK{0}% + \pgfplots@if{pgfplots@apply@datatrafo@\pgfplots@axis@equal@apply@reference}{% + \pgfplots@letcsname{pgfplots@tmp@exponentref}={pgfplots@data@scale@trafo@EXPONENT@\pgfplots@axis@equal@apply@reference}% + }{}% + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \pgfplots@letcsname{pgfplots@tmp@exponentK}={pgfplots@data@scale@trafo@EXPONENT@#1}% + }{}% + \c@pgf@counta=\pgfplots@tmp@exponentref + \advance\c@pgf@counta by-\pgfplots@tmp@exponentK + \ifnum\c@pgf@counta=0 + \else + \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPa}{\c@pgf@counta}% + \global\let\pgfplots@glob@TMPa=\pgfmathresult + \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPb}{-\c@pgf@counta}% + \global\let\pgfplots@glob@TMPb=\pgfmathresult + \fi + \xdef\pgfplots@glob@TMPc{\the\c@pgf@counta}% + \endgroup + % + \if x#1 + \pgfsetxvec{\pgfplotsqpointxy{\pgfplots@glob@TMPa}{0}}% + \else + \if y#1 + \pgfsetyvec{\pgfplotsqpointxy{0}{\pgfplots@glob@TMPa}}% + \else + \if z#1 + \pgfsetzvec{\pgfplotsqpointxyz{0}{0}{\pgfplots@glob@TMPa}}% + \fi + \fi + \fi + % + % + % Update auxiliary data members: + % This is only complicated due to the scaling transformation. If we would not have the scaling trafo, the following + % code would simply copy the vector length and inverse vectors length from the reference axis. + \pgfplotsmathmultiplypowten@{\csname pgfplots@\pgfplots@axis@equal@apply@reference @veclength\endcsname}{\pgfplots@glob@TMPc}% + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + \pgfplotsmathmultiplypowten@{\csname pgfplots@\pgfplots@axis@equal@apply@reference @inverseveclength\endcsname}{-\pgfplots@glob@TMPc}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + % + % + \ifpgfplots@axis@equal@image + \else + % + % Ok, now update the axis limits such that the axis' dimensions + % stay the same. + % + % My idea is to add half of the new range to 'max' and + % subtract the other half from 'min': + % 1/s( xmax - xmin) = (xmax+0.5d) - (xmin-0.5d) = xmax - xmin +d + % with d = 1/s (xmax-xmin) - (xmax-xmin) = (1/s - 1) (xmax-xmin) + % +%\message{'axis equal': Resizing data range for #1: from \csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname\ to}% + \pgfmathsubtract@{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#1min\endcsname}% + \begingroup + \pgf@xa=\pgfmathresult pt + \pgfmathsubtract@{\pgfplots@glob@TMPb}{1.0}% + \pgf@xa=\pgfmathresult \pgf@xa + \divide\pgf@xa by2 + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% + \endgroup + \pgfmathsubtract@{\csname pgfplots@#1min\endcsname}{\pgfplots@glob@TMPb}% + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult + \pgfmathadd@{\csname pgfplots@#1max\endcsname}{\pgfplots@glob@TMPb}% + \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult +%\message{\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname. [+- \pgfplots@glob@TMPb]}% + % + % Update auxiliary data members: + \csname pgfplots@#1min@reg\endcsname=\csname pgfplots@#1min\endcsname pt % + \csname pgfplots@#1max@reg\endcsname=\csname pgfplots@#1max\endcsname pt % + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1min\endcsname}% + \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfmathresult + \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1max\endcsname}% + \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfmathresult + }{}% + \fi +} + +% Invokes #3 if +% ( 10^{s1} * veclen1 < 10^{s2} * veclen2 ) +% <=> +% ( 10^{s1-s2} * veclen1 < veclen2 ). +% +% If the condition is false, '#4' is invoked. +\def\pgfplots@if@unitveclenlessthan@untransformed#1#2#3#4{% + \def\pgfplots@loc@TMPa{0}% + \def\pgfplots@loc@TMPb{0}% + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \pgfplots@letcsname{pgfplots@loc@TMPa}={pgfplots@data@scale@trafo@EXPONENT@#1}% + }{}% + \pgfplots@if{pgfplots@apply@datatrafo@#2}{% + \pgfplots@letcsname{pgfplots@loc@TMPb}={pgfplots@data@scale@trafo@EXPONENT@#2}% + }{}% + \begingroup + \pgf@xb=\csname pgfplots@#2@veclength\endcsname pt + \c@pgf@counta=\pgfplots@loc@TMPa + \advance\c@pgf@counta by-\pgfplots@loc@TMPb + \ifnum\c@pgf@counta=0 + \pgf@xa=\csname pgfplots@#1@veclength\endcsname pt + \else + \pgfplotsmathmultiplypowten@{\csname pgfplots@#1@veclength\endcsname}{\c@pgf@counta}% + \pgf@xa=\pgfmathresult pt + \fi + \ifdim\pgf@xa<\pgf@xb + \gdef\pgfplots@glob@TMPc{1}% + \else + \gdef\pgfplots@glob@TMPc{0}% + \fi + \endgroup + \if1\pgfplots@glob@TMPc #3\else #4\fi +}% + % PRECONDITION: % - final axis limits are given in transformed range % - \pgfplots@set@default@size@options has been invoked before @@ -5546,12 +3802,22 @@ % INIT. % % - \pgfqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% - \pgfplots@xcoordminTEX=\pgf@x - \pgfplots@ycoordminTEX=\pgf@y - \pgfqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% - \pgfplots@xcoordmaxTEX=\pgf@x - \pgfplots@ycoordmaxTEX=\pgf@y + \pgfplots@xmin@reg=\pgfplots@xmin pt % + \pgfplots@xmax@reg=\pgfplots@xmax pt % + \pgfplots@ymin@reg=\pgfplots@ymin pt % + \pgfplots@ymax@reg=\pgfplots@ymax pt % + \ifpgfplots@threedim + \pgfplots@zmin@reg=\pgfplots@zmin pt % + \pgfplots@zmax@reg=\pgfplots@zmax pt % + \fi + % + \pgfpointdiff + {\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}} + {\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}% + % only used temporarily in this macro to compute the correct + % length for unit vectors: + \edef\pgfplots@initsizes@axisdiag@x{\the\pgf@x}% + \edef\pgfplots@initsizes@axisdiag@y{\the\pgf@y}% % % %----------------------------------------- @@ -5567,7 +3833,7 @@ \ifx\pgfplots@width\pgfutil@empty \pgfplots@error{INTERNAL LOGIC ERROR! WIDTH NOT SET}% \fi - \pgfplots@initsizes@getXscale\into\pgfplots@tmpXscale + \pgfplots@initsizes@getXscale\pgfplots@initsizes@axisdiag@x\into\pgfplots@tmpXscale \ifpgfplots@scale@only@axis \let\pgfplots@rectangle@width=\pgfplots@width \fi @@ -5579,7 +3845,7 @@ \ifx\pgfplots@height\pgfutil@empty \pgfplots@error{INTERNAL LOGIC ERROR! HEIGHT NOT SET}% \fi - \pgfplots@initsizes@getYscale\into\pgfplots@tmpYscale + \pgfplots@initsizes@getYscale\pgfplots@initsizes@axisdiag@y\into\pgfplots@tmpYscale \ifpgfplots@scale@only@axis \let\pgfplots@rectangle@height=\pgfplots@height \fi @@ -5590,19 +3856,35 @@ % % assert( \pgfplots@tmpXscale != \pgfutil@empty && \pgfplots@tmpYscale != \pgfutil@empty ) % - % Apply scaling: - \pgfpointxy{\pgfplots@tmpXscale}{\pgfplots@tmpYscale}% - \edef\pgfplots@tmpscale@x{\the\pgf@x}% - \edef\pgfplots@tmpscale@y{\the\pgf@y}% - \ifx\pgfplots@x\pgfutil@empty - \pgfsetxvec{\pgfqpoint{\pgfplots@tmpscale@x}{0pt}}% + \pgfplotsqpointxy{\pgfplots@tmpXscale}{\pgfplots@tmpYscale}% + \edef\pgfplots@tmpXscale{\the\pgf@x}% + \edef\pgfplots@tmpYscale{\the\pgf@y}% + \def\pgfplots@tmpZscale{1pt}% + \ifx\pgfplots@view@pitch\pgfutil@empty + \pgfplots@initsizes@setunitvector{x}{0}{\pgfplots@tmpXscale}{\pgfplots@tmp@xisaxisparallel}% + \pgfplots@initsizes@setunitvector{y}{1}{\pgfplots@tmpYscale}{\pgfplots@tmp@yisaxisparallel}% + \pgfplots@initsizes@setunitvector{z}{2}{\pgfplots@tmpZscale}{\pgfplots@loc@TMPc}% \else - \pgfsetxvec{\pgfpoint{\pgfplots@x}{0pt}}% + \pgfplotssetaxesfrompitchyaw{\pgfplots@view@pitch}{\pgfplots@view@yaw}{\pgfplots@tmp@xisaxisparallel}% + \if1\pgfplots@tmp@xisaxisparallel% + \def\pgfplots@tmp@yisaxisparallel{1}% + \fi \fi - \ifx\pgfplots@y\pgfutil@empty - \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@tmpscale@y}}% + \ifpgfplots@threedim \else - \pgfsetyvec{\pgfpoint{0pt}{\pgfplots@y}}% + \if1\pgfplots@tmp@xisaxisparallel% + \if1\pgfplots@tmp@yisaxisparallel% + % Optimize for axis-parallel case! + % puh. Did not make any measureable difference!? Ok... + \let\pgfplotsqpointxy=\pgfplotsqpointxy@orthogonal + \fi + \fi + \fi + \ifpgfplots@axis@equal@image + \pgfplots@axis@equaltrue + \fi + \ifpgfplots@axis@equal + \pgfplots@axis@equal@apply \fi % % Determine final rectangle dimensions. @@ -5625,12 +3907,19 @@ % 3. The user supplied 'x' and or 'y'. Simply use them, its % accurate. % - \pgfqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \begingroup + \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \xdef\pgfplotspointsouthwest{\noexpand\pgf@x=\the\pgf@x\noexpand\relax\noexpand\pgf@y=\the\pgf@y}% + % ATTENTION: I re-use registers here! Make sure they won't be + % overwritten! \pgfpointdiff and \pgfplotsqpointxy are ok in this respect. + \let\pgfplots@xcoordminTEX=\pgf@xb + \let\pgfplots@ycoordminTEX=\pgf@yb \pgfplots@xcoordminTEX=\pgf@x \pgfplots@ycoordminTEX=\pgf@y - \pgfqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% + % + \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% \ifx\pgfplots@rectangle@width\pgfutil@empty - \pgfplots@xcoordmaxTEX=\pgf@x + \def\pgfplots@tmp@xmax@ymin{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}% \else % this 'if' here should only make a difference of about % 1-2pt, not more. @@ -5638,22 +3927,40 @@ % and I am quite sure that this inaccuracy (and this % work-around) only affects the % final size, not the relative plot accuracy. - \pgfplots@xcoordmaxTEX=\pgfplots@xcoordminTEX - \expandafter\advance\expandafter\pgfplots@xcoordmaxTEX\pgfplots@width + \pgf@x=\pgfplots@xcoordminTEX + \advance\pgf@x by\pgfplots@width + \edef\pgfplots@tmp@xmax@ymin{\noexpand\pgfqpoint{\the\pgf@x}{\noexpand\pgfplots@ycoordminTEX}}% \fi \ifx\pgfplots@rectangle@height\pgfutil@empty - \pgfplots@ycoordmaxTEX=\pgf@y + \def\pgfplots@tmp@xmin@ymax{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}% \else - \pgfplots@ycoordmaxTEX=\pgfplots@ycoordminTEX - \expandafter\advance\expandafter\pgfplots@ycoordmaxTEX\pgfplots@height + \pgf@x=\pgfplots@ycoordminTEX + \advance\pgf@x\pgfplots@height + \edef\pgfplots@tmp@xmin@ymax{\noexpand\pgfqpoint{\noexpand\pgfplots@xcoordminTEX}{\the\pgf@x}}% + \fi + \pgfpointdiff + {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} + {\pgfplots@tmp@xmax@ymin}% + \xdef\pgfplotspointxaxis{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}% + \pgfmathveclen{\pgf@x}{\pgf@y}% + \xdef\pgfplotspointxaxislength{\pgfmathresult pt}% + % + \pgfpointdiff + {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} + {\pgfplots@tmp@xmin@ymax}% + \xdef\pgfplotspointyaxis{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}% + \pgfmathveclen{\pgf@x}{\pgf@y}% + \xdef\pgfplotspointyaxislength{\pgfmathresult pt}% + % + \ifpgfplots@threedim + \pgfpointdiff + {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} + {\pgfplotsqpointxy{\pgfplots@zmin}{\pgfplots@zmax}}% + \xdef\pgfplotspointzaxis{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}% + \pgfmathveclen{\pgf@x}{\pgf@y}% + \xdef\pgfplotspointzaxislength{\pgfmathresult pt}% \fi -%-------------------------------------------------- -% \begingroup -% \pgf@x=\pgfplots@xcoordmaxTEX\advance\pgf@x by-\pgfplots@xcoordminTEX -% \pgf@y=\pgfplots@ycoordmaxTEX\advance\pgf@y by-\pgfplots@ycoordminTEX -% \message{Axis scaling x=\pgfplots@tmpXscale, y=\pgfplots@tmpYscale\ yields lower-left-corner (\pgfplots@xmin,\pgfplots@ymin) = (\the\pgfplots@xcoordminTEX,\the\pgfplots@ycoordminTEX) and upper right (\pgfplots@xmax,\pgfplots@ymax) = (\the\pgfplots@xcoordmaxTEX,\the\pgfplots@ycoordmaxTEX). Axis dimensions are width=\the\pgf@x, height=\the\pgf@y.}% -% \endgroup -%-------------------------------------------------- + \endgroup } % This here is a low-weight node. It can ONLY be used during axis @@ -5678,17 +3985,41 @@ \anchor{west}{\pgfqpointxy{0}{0.5}}% \anchor{north west}{\pgfqpointxy{0}{1}}% %% - \anchor{origin}{\pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ZERO@y\relax}}% - \anchor{above origin}{\pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ycoordmaxTEX}}% - \anchor{left of origin}{\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ZERO@y\relax}}% - \anchor{right of origin}{\pgfqpoint{\pgfplots@xcoordmaxTEX}{\pgfplots@ZERO@y\relax}}% - \anchor{below origin}{\pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ycoordminTEX}}% + \anchor{origin}{\pgfplotspointORIGIN@tmp}% + \anchor{above origin}{% + \pgfpointintersectionoflines + {\pgfplotspointORIGIN@tmp} + {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfplotspointyaxis}} + {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointyaxis}} + {\pgfpointadd{\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointyaxis}}{\pgfplotspointxaxis}}% + }% + \anchor{left of origin}{% + \pgfpointintersectionoflines + {\pgfplotspointORIGIN@tmp} + {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfpointscale{-1}{\pgfplotspointxaxis}}} + {\pgfqpointxy{0}{0}} + {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointyaxis}}% + }% + \anchor{right of origin}{% + \pgfpointintersectionoflines + {\pgfplotspointORIGIN@tmp} + {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfplotspointxaxis}} + {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointxaxis}} + {\pgfpointadd{\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointxaxis}}{\pgfplotspointyaxis}}% + }% + \anchor{below origin}{% + \pgfpointintersectionoflines + {\pgfplotspointORIGIN@tmp} + {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfpointscale{-1}{\pgfplotspointyaxis}}} + {\pgfqpointxy{0}{0}} + {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointxaxis}}% + }% %% %% %% %% \anchorborder{}% - \backgroundpath{}%\pgfpathrectangle{\pgfpointorigin}{\upperrightinnercorner}}% + \backgroundpath{}% \foregroundpath{}% \behindbackgroundpath{}% \beforebackgroundpath{}% @@ -5701,6 +4032,7 @@ % It has one node part, which is the complete image. It provides a lot % of anchors. \pgfdeclareshape{pgfplots@low@level@shape}{% + % The '(0,0)' point is the LOWER LEFT OUTER CORNER. \savedanchor\upperrightcorner{ \pgf@x=\wd\pgfnodepartimagebox \pgf@y=\ht\pgfnodepartimagebox @@ -5708,107 +4040,91 @@ \savedanchor\lowerleftinnercorner{% \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}% }% - \savedanchor\upperrightinnercorner{% - \pgfqpoint{\pgfplots@savedanchor@inner@upperright@x\relax}{\pgfplots@savedanchor@inner@upperright@y\relax}% - }% + \savedanchor\xaxisvec{\pgfplotspointxaxis}% + \savedanchor\yaxisvec{\pgfplotspointyaxis}% \savedanchor\origin{% \pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ZERO@y\relax}% }% % \nodeparts{image}% \anchor{image}{% - \pgf@x=0pt - \pgf@y=0pt + \pgf@x=0pt % + \pgf@y=0pt % }% % % \anchor{center}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \advance\pgf@xa by\pgf@x - \pgf@x=.5\pgf@xa - \advance\pgf@xb by\pgf@y - \pgf@y=.5\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\pgfpointadd{\xaxisvec}{\yaxisvec}}}% }% \anchor{north}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \advance\pgf@xa by\pgf@x - \pgf@x=.5\pgf@xa + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}% + }% + \anchor{north east}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\xaxisvec}}% }% - \anchor{north east}{\upperrightinnercorner}% \anchor{east}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \advance\pgf@xb by\pgf@y - \pgf@y=.5\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}% }% \anchor{south east}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \pgf@y=\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\xaxisvec}% }% \anchor{south}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \advance\pgf@xa by\pgf@x - \pgf@x=.5\pgf@xa - \pgf@y=\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\xaxisvec}}% }% \anchor{south west}{\lowerleftinnercorner}% \anchor{west}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \pgf@x=\pgf@xa - \advance\pgf@xb by\pgf@y - \pgf@y=.5\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\yaxisvec}}% }% \anchor{north west}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \pgf@x=\pgf@xa + \pgfpointadd + {\lowerleftinnercorner}% + {\yaxisvec}% }% %% \anchor{origin}{% \origin }% \anchor{above origin}{% - \origin - \pgf@xa=\pgf@x - \upperrightinnercorner - \pgf@x=\pgf@xa + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\yaxisvec}} + {\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}} + {\pgfpointadd{\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}}{\xaxisvec}}% }% \anchor{left of origin}{% - \origin - \pgf@xa=\pgf@y - \lowerleftinnercorner - \pgf@y=\pgf@xa + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\pgfpointscale{-1}{\xaxisvec}}} + {\lowerleftinnercorner} + {\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}}% }% \anchor{right of origin}{% - \origin - \pgf@xa=\pgf@y - \upperrightinnercorner - \pgf@y=\pgf@xa + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\xaxisvec}} + {\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}} + {\pgfpointadd{\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}}{\yaxisvec}}% }% \anchor{below origin}{% - \origin - \pgf@xa=\pgf@x - \lowerleftinnercorner - \pgf@x=\pgf@xa + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\pgfpointscale{-1}{\yaxisvec}}} + {\lowerleftinnercorner} + {\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}}% }% % %% @@ -5855,53 +4171,55 @@ %% \anchor{above north}{% \upperrightcorner - \pgf@xa=\pgf@y - \lowerleftinnercorner - \pgf@xb=\pgf@x - \upperrightinnercorner - \advance\pgf@xb by\pgf@x - \pgf@x=.5\pgf@xb - \pgf@y=\pgf@xa + \pgfutil@tempdima=\pgf@y + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}% + \pgf@y=\pgfutil@tempdima }% \anchor{above north east}{% \upperrightcorner - \pgf@xa=\pgf@y - \upperrightinnercorner - \pgf@y=\pgf@xa + \pgfutil@tempdima=\pgf@y + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\xaxisvec}}% + \pgf@y=\pgfutil@tempdima }% \anchor{right of north east}{% \upperrightcorner - \pgf@xa=\pgf@x - \upperrightinnercorner - \pgf@x=\pgf@xa + \pgfutil@tempdima=\pgf@x + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\xaxisvec}}% + \pgf@x=\pgfutil@tempdima }% \anchor{right of east}{% \upperrightcorner - \pgf@xa=\pgf@x - \upperrightinnercorner - \pgf@xb=\pgf@y - \lowerleftinnercorner - \advance\pgf@xb by\pgf@y - \pgf@x=\pgf@xa - \pgf@y=.5\pgf@xb + \pgfutil@tempdima=\pgf@x + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}% + \pgf@x=\pgfutil@tempdima }% \anchor{right of south east}{% \upperrightcorner - \pgf@xa=\pgf@x - \lowerleftinnercorner - \pgf@x=\pgf@xa + \pgfutil@tempdima=\pgf@x + \pgfpointadd + {\lowerleftinnercorner}% + {\xaxisvec}% + \pgf@x=\pgfutil@tempdima }% \anchor{below south east}{% - \upperrightinnercorner + \pgfpointadd + {\lowerleftinnercorner}% + {\xaxisvec}% \pgf@y=0pt }% \anchor{below south}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \upperrightinnercorner + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\xaxisvec}}% \pgf@y=0pt - \advance\pgf@xa by\pgf@x - \pgf@x=.5\pgf@xa }% \anchor{below south west}{% \lowerleftinnercorner @@ -5912,22 +4230,24 @@ \pgf@x=0pt }% \anchor{left of west}{% - \lowerleftinnercorner - \pgf@xa=\pgf@y - \upperrightinnercorner - \advance\pgf@xa by\pgf@y - \pgf@y=.5\pgf@xa + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\yaxisvec}}% \pgf@x=0pt }% \anchor{left of north west}{% - \upperrightinnercorner + \pgfpointadd + {\lowerleftinnercorner}% + {\yaxisvec}% \pgf@x=0pt }% \anchor{above north west}{% \upperrightcorner - \pgf@xa=\pgf@y - \lowerleftinnercorner - \pgf@y=\pgf@xa + \pgfutil@tempdima=\pgf@y + \pgfpointadd + {\lowerleftinnercorner}% + {\yaxisvec}% + \pgf@y=\pgfutil@tempdima }% %% %% @@ -5935,13 +4255,16 @@ % Call a function that computes a border point. Since this % function will modify dimensions like \pgf@x, we must move them to % other dimensions. - \@tempdima=\pgf@x - \@tempdimb=\pgf@y + \pgfutil@tempdima=\pgf@x + \pgfutil@tempdimb=\pgf@y \pgfpointborderrectangle% - {\pgfpoint{\@tempdima}{\@tempdimb}}% - {\pgfpointadd{\upperrightcorner}{\pgfpoint{\width}{\height}}} + {\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdimb}}% + {\upperrightcorner}% + }% + \backgroundpath{% + \pgfkeysvalueof{/pgfplots/@backgroundpath@hook/.@cmd}\pgfeov + \pgfpathrectangle{\pgfpointorigin}{\upperrightcorner}% }% - \backgroundpath{\pgfpathrectangle{\pgfpointorigin}{\upperrightcorner}}% \foregroundpath{}% \behindbackgroundpath{}% \beforebackgroundpath{}% @@ -5950,47 +4273,359 @@ } \def\pgfplots@draw@axis{% - \ifpgfplots@hide@x\else - % compute tick position lists - % \pgfplots@prepared@tick@positions@minor@x - % and - % \pgfplots@prepared@tick@positions@major@x - \expandafter\pgfplots@prepare@ticks@for\expandafter{\pgfplots@xtick}{x}{0}% - \pgfplots@drawgridlines@for{x}{0}% - \fi - \ifpgfplots@hide@y\else - \expandafter\pgfplots@prepare@ticks@for\expandafter{\pgfplots@ytick}{y}{1}% - \pgfplots@drawgridlines@for{y}{1}% - \fi % - \ifpgfplots@hide@x\else - \pgfplots@drawticklines@for{x}{0}% + % Preparation for axis lines and discontinuities: + \pgfplots@drawaxis@lines@preparediscont@for{x}% + \pgfplots@drawaxis@lines@preparediscont@for{y}% + \ifpgfplots@threedim + \pgfplots@drawaxis@lines@preparediscont@for{z}% \fi - \ifpgfplots@hide@y\else - \pgfplots@drawticklines@for{y}{1}% + \ifpgfplots@threedim + \pgfplots@separate@axis@linestrue + \else + \ifnum\pgfplots@xaxislinesnum>0 + \pgfplots@separate@axis@linestrue + \fi + \ifnum\pgfplots@yaxislinesnum>0 + \pgfplots@separate@axis@linestrue + \fi \fi % - \pgfplots@drawaxis@lines + \pgfplots@decide@which@figure@surfaces@are@drawn % + % compute tick position lists + % \pgfplots@prepared@tick@positions@minor@x + % and + % \pgfplots@prepared@tick@positions@major@x \ifpgfplots@hide@x\else - \pgfplots@drawticklabels@for{x}{0}% + \expandafter\pgfplots@prepare@tick@coordlists@for\expandafter x\expandafter{\pgfplots@xtick}% \fi \ifpgfplots@hide@y\else - \pgfplots@drawticklabels@for{y}{1}% + \expandafter\pgfplots@prepare@tick@coordlists@for\expandafter y\expandafter{\pgfplots@ytick}% \fi + \ifpgfplots@threedim + \ifpgfplots@hide@z\else + \expandafter\pgfplots@prepare@tick@coordlists@for\expandafter z\expandafter{\pgfplots@ztick}% + \fi + \ifcase\pgfplots@zaxislinesnum\relax + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmin}{0}% + \pgfplots@draw@axis@insurface@symmetric xyz0 + % + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmax}{1}% + \pgfplots@draw@axis@insurface@symmetric xyz1 + \or + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmin}{0}% + \pgfplots@draw@axis@insurface@symmetric xyz2 + \or + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@logical@ZERO@z}{2}% + \pgfplots@draw@axis@insurface@symmetric xyz2 + \or + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmax}{1}% + \pgfplots@draw@axis@insurface@symmetric xyz2 + \fi % - \ifpgfplots@hide@x\else - \ifx\pgfplots@extra@xtick\pgfutil@empty - \else - \expandafter\pgfplots@draw@extra@ticks@for\expandafter x\expandafter0\expandafter{\pgfplots@extra@xtick}% + \ifcase\pgfplots@xaxislinesnum\relax + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx0 + % + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx1 + \or + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx0 + \or + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@logical@ZERO@x}{2}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx1 + \or + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx1 \fi + % + \ifcase\pgfplots@yaxislinesnum\relax + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + % + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + \or + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + \or + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@logical@ZERO@y}{2}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + \or + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + \fi + \else + % Just use the 2d-point commands (assuming Z=0) + \let\pgfplotspointonorientedsurfaceabsetupforxyz=\pgfplotspointonorientedsurfaceabsetupforxy + \let\pgfplotspointonorientedsurfaceabsetupforyxz=\pgfplotspointonorientedsurfaceabsetupforyx + \pgfplots@draw@axis@insurface@symmetric xyz2 \fi - \ifpgfplots@hide@y\else - \ifx\pgfplots@extra@ytick\pgfutil@empty +}% + +% Defines booleans for every surface of the axis cube indicating +% whether they shall be drawn or not. +% +% For 2D, the only available surface is 'vv0' (x=variing; y=variing; z=zmin) +% For 3D, there are surfaces +% - 'vv0' 'vv1' +% - 'v0v' 'v1v' +% ' '0vv' '1vv' +% +% @see \pgfplotspointonorientedsurfaceabmatchaxisline for details +% about those three-character ids. +% +% @PRECONDITION +% +% @POSTCONDITION +% for every available surface, a macro '\pgfplots@surfenabled@CCC' +% is defined to be either '0' or '1'. +% Thus, we don't have real TeX booleans, "only" those one-character +% strings. +% +% ABOUT THE ALGORITHM: +% I find it really hard to decide exactly which surfaces shall be drawn. After +% all, PGF is 2D and notions like "above" are not possible. +% So, I resorted to an heuristic approach which will (hopefully) prove +% to be a good idea: +% +% ASSUMPTION: +% 1. We have a right-handed-coordinate system. The heuristics here +% WILL fail in every other case. +% 2. The z-axis points to the top of the paper. +% Again, the heuristics WILL fail if that is not the case. +% Both assumptions happen to be reasonable for most cases. +% I will have to think about those cases where they are not +% reasonable. +% +% Now, the heuristics ONLY CHECKS THE 'y' components of the the three +% basis vectors. Since per assumption (1.), z_y > 0, there remain only +% a handful of cases for x_y > 0, x_y <0, y_y > 0 and y_y <0. I have +% hard-coded good approaches for each of them below. +\def\pgfplots@decide@which@figure@surfaces@are@drawn{% + \ifpgfplots@threedim + \begingroup + \gdef\pgfplots@glob@TMPa{% + % This here is the "fall-back" solution: simple enable + % every axis. + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{1}% + }% + \let\xaxisy=\pgf@ya + \let\yaxisy=\pgf@yb + \let\zaxisy=\pgf@yc + \pgfplotspointxaxis + \xaxisy=\pgf@y + \pgfplotspointyaxis + \yaxisy=\pgf@y + \pgfplotspointzaxis + \zaxisy=\pgf@y + \ifdim\zaxisy>0pt + % CASE I : + \ifdim\xaxisy>0pt + \else + \ifdim\yaxisy>0pt + \else + \gdef\pgfplots@glob@TMPa{% + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{0}% + % + \def\pgfplots@xticklabelaxisspec{v00}% + \def\pgfplots@yticklabelaxisspec{1v0}% + \def\pgfplots@zticklabelaxisspec{00v}% + }% + \fi + \fi + % CASE II: + \ifdim\xaxisy<0pt + \else + \ifdim\yaxisy<0pt + \else + \gdef\pgfplots@glob@TMPa{% + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{1}% + % + \def\pgfplots@xticklabelaxisspec{v00}% + \def\pgfplots@yticklabelaxisspec{0v0}% + \def\pgfplots@zticklabelaxisspec{01v}% + }% + \fi + \fi + % CASE III: + \ifdim\xaxisy<0pt + \else + \ifdim\yaxisy>0pt + \else + \gdef\pgfplots@glob@TMPa{% + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{1}% + % + \def\pgfplots@xticklabelaxisspec{v10}% + \def\pgfplots@yticklabelaxisspec{0v0}% + \def\pgfplots@zticklabelaxisspec{11v}% + }% + \fi + \fi + % CASE IV: + \ifdim\xaxisy>0pt + \else + \ifdim\yaxisy>0pt + \else + \gdef\pgfplots@glob@TMPa{% + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{0}% + % + \def\pgfplots@xticklabelaxisspec{v10}% + \def\pgfplots@yticklabelaxisspec{1v0}% + \def\pgfplots@zticklabelaxisspec{10v}% + }% + \fi + \fi + \fi + \endgroup + % and activate the macro: + \pgfplots@glob@TMPa + \else + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn##1##2##3{##2}% ALWAYS TRUE + \fi +} + +% Processes every tick mark in direction #1 and draws tick lines, tick +% labels, grid lines, axis lines and extra ticks. +% +% #1 : the direction into which tick positions are processed. +% #2 : the direction in which tick lines and grid lines shall be drawn. +% #3 : the direction which is currently fixed. +% #4 : an integer used to decide whether tick LABELS shall be drawn. +% The following values are accepted: +% 0 : we are on the "left". So, draw tick labels if '#3ticklabel pos==left' +% 1 : we are on the "right". So, draw tick labels if '#3ticklabel pos==right' +% 2 : draw tick labels anyway. +% +\def\pgfplots@draw@axis@insurface#1#2#3#4{% + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawgridlines@onorientedsurf + % + \pgfplots@drawticklines@onorientedsurf + % + \pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2% + \pgfplots@drawaxis@innerlines@onorientedsurf#1#2#3% + % + \pgfplots@drawticklabels@onorientedsurf + % + \expandafter\ifx\csname pgfplots@extra@#1tick\endcsname\pgfutil@empty \else - \expandafter\pgfplots@draw@extra@ticks@for\expandafter y\expandafter1\expandafter{\pgfplots@extra@ytick}% + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@extra@xtick}% \fi + }% +}% + +% A variant of \pgfplots@draw@axis@insurface which is equivalent to +% \pgfplots@draw@axis@insurface #1#2#3#4 +% \pgfplots@draw@axis@insurface #2#1#3#4 +% with slightly optimized execution sequence. +\def\pgfplots@draw@axis@insurface@symmetric#1#2#3#4{% + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawgridlines@onorientedsurf + }% + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplots@drawgridlines@onorientedsurf + }% + % + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawticklines@onorientedsurf + }% + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplots@drawticklines@onorientedsurf + }% + % + \ifpgfplots@separate@axis@lines + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2% + \pgfplots@drawaxis@innerlines@onorientedsurf#1#2#3% + }% + % + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplots@drawaxis@outerlines@separate@onorientedsurf#2#1% + \pgfplots@drawaxis@innerlines@onorientedsurf#2#1#3% + }% + \else + % this happens if and only if d=2 and the axis lines are drawn + % as box. + \pgfplots@drawaxis@outerlines@cycledpath \fi + % + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawticklabels@onorientedsurf + }% + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplots@drawticklabels@onorientedsurf + }% + % + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \expandafter\ifx\csname pgfplots@extra@#1tick\endcsname\pgfutil@empty + \else + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@extra@xtick}% + \fi + }% + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \expandafter\ifx\csname pgfplots@extra@#2tick\endcsname\pgfutil@empty + \else + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@extra@ytick}% + \fi + }% +}% + +\def\pgfplots@draw@axis@insurface@onlyticksandgrid#1#2#3{% + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawgridlines@onorientedsurf + \pgfplots@drawticklines@onorientedsurf + }% }% \def\pgfplots@BEGIN@init@and@draw@axis{% @@ -5998,7 +4633,6 @@ \setbox\pgfnodepartimagebox=\hbox\bgroup\bgroup \pgfinterruptpicture \tikzpicture[/pgfplots/every axis]% - %\pgfqkeys{/tikz}{every axis}% % set baseline for sub-picture to default value. % the baseline option will be applied to the OUTER picture. \pgfsetbaseline{\pgf@picminy}% @@ -6008,11 +4642,48 @@ \else \pgfplots@draw@axis \fi - \clip - (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) - rectangle (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX); + % CLIPPING: + \pgfplots@clippath@prepare + \pgfplots@clippath@install } +% Defines \pgfplots@clippath@install. +% @PRECONDITION the axis limits must be ready. +\def\pgfplots@clippath@prepare{% + \ifpgfplots@threedim + % FIXME : this can't be done in three dimensions. :-( + % -> for 3d, I need to clip at least the 2d projection. + % FIXME : which path(s) do I need for 3d? + \let\pgfplots@clippath@install=\pgfutil@empty + \else + \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \edef\pgfplots@loc@TMPa{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}% + \edef\pgfplots@loc@TMPb{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% + \edef\pgfplots@loc@TMPc{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}% + \edef\pgfplots@loc@TMPd{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \begingroup + \toks0=\expandafter{\pgfplots@loc@TMPa}% + \toks1=\expandafter{\pgfplots@loc@TMPb}% + \toks2=\expandafter{\pgfplots@loc@TMPc}% + \toks3=\expandafter{\pgfplots@loc@TMPd}% + \xdef\pgfplots@glob@TMPa{% + \noexpand\pgfpathmoveto{\the\toks0 }% + \noexpand\pgfpathlineto{\the\toks1 }% + \noexpand\pgfpathlineto{\the\toks2 }% + \noexpand\pgfpathlineto{\the\toks3 }% + \noexpand\pgfusepath{clip}% + }% + \endgroup + \let\pgfplots@clippath@install=\pgfplots@glob@TMPa + \fi +}% + +\def\pgfplots@clippath@install{% + \pgfplots@error{Can't install a clippath here - the command has not yet been prepared.}% +}% \def\pgfplots@END@init@and@draw@axis{% \endscope% @@ -6027,7 +4698,9 @@ \ifpgfplots@clip@marker@paths \else \pgfplotslistforeach\pgfplots@stored@markerlist\as\pgfplots@loc@TMPa{% + \scope% make sure that 'fill opacity' and 'dotted' styles remain local! \pgfplots@loc@TMPa + \endscope }% \global\pgfplotslistnewempty\pgfplots@stored@markerlist% clear. \fi @@ -6080,17 +4753,17 @@ \expandafter\pgfplots@loc@TMPc\expandafter{\pgfmathresult}\pgfeov \fi \let\pgfplots@loc@TMPc=\pgfmathresult% FIXME: is that necessary? I doubt it... but just to make sure... - \expandafter\let\expandafter\if@datascaled@cur\csname ifpgfplots@apply@datatrafo@#1\endcsname \csname ifpgfplots@#1islinear\endcsname - \if@datascaled@cur + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% \csname pgfplots@datascaletrafo@fromfixed@#1\endcsname{\pgfplots@loc@TMPc}% - \fi + }{}% \else \pgfmathlog@{\pgfplots@loc@TMPc}% \fi } \long\def\pgfplots@evalute@tikz@coord@system@interface#1,#2\pgfplots@coord@end{% + \global\let\pgfplots@glob@TMPc=\pgfutil@empty \begingroup \pgfplots@evalute@tikz@coord@system@interface@for{x}{#1}% \let\pgfplots@evaluate@tikz@coord@x=\pgfmathresult @@ -6098,7 +4771,11 @@ \xdef\pgfplots@glob@TMPa{\pgfplots@evaluate@tikz@coord@x}% \xdef\pgfplots@glob@TMPb{\pgfmathresult}% \endgroup - \pgfqpointxy{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}% + \ifx\pgfplots@glob@TMPc\pgfutil@empty + \pgfplotsqpointxy{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}% + \else + \pgfplotsqpointxyz{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}{\pgfplots@glob@TMPc}% FIXME: read 3D! + \fi } % In case of (semi-) logplots, this command will @@ -6116,7 +4793,7 @@ % - coordinate filters to compute logs are installed % % See also: -% \pgfplots@apply@data@scale@trafo@to@options@for +% \pgfplots@check@and@apply@datatrafo@for \def\pgfplots@prepare@coord@filtering@for#1{% \pgfkeysgetvalue{/pgfplots/#1 coord trafo/.@cmd}\pgfplots@loc@TMPc \expandafter\let\csname pgfplots@highlevel@trafo@#1\endcsname=\pgfplots@loc@TMPc @@ -6124,12 +4801,12 @@ % no high-level external coord trafos. % Simply use identity: \expandafter\def\csname pgfplots@prepare@#1coord\endcsname##1{% - \def\pgfmathresult{##1}% + \edef\pgfmathresult{##1}% }% \else % Apply external coordinate trafo to all input values: \expandafter\edef\csname pgfplots@prepare@#1coord\endcsname##1{% - \noexpand\def\noexpand\pgfmathresult{##1}% + \noexpand\edef\noexpand\pgfmathresult{##1}% \expandafter\noexpand\csname pgfplots@highlevel@trafo@#1\endcsname{##1}\noexpand\pgfeov }% % @@ -6149,6 +4826,20 @@ \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi % + % any user-specified tick limits: + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmin\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@loc@TMPc\expandafter{\pgfplots@loc@TMPa}\pgfeov% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult + \fi + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmax\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@loc@TMPc\expandafter{\pgfplots@loc@TMPa}\pgfeov% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult + \fi + % % any user specified axis ticks: \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tick\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -6194,13 +4885,25 @@ \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi + % Check for any existing tick limits: + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmin\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult + \fi + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmax\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult + \fi \fi \else % This here could be done using a high level coord trafo as % well! However, I don't want to risk accidentally overwritten % keys, so I replicate it here. - \ifpgfplots@disablelogfilter - \else + \pgfplots@if{pgfplots@disablelogfilter@#1}{\relax}{% % any user-specified axis limits: \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1min\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -6215,6 +4918,20 @@ \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi % + % any user-specified tick limits: + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmin\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfmathlog@\expandafter{\pgfplots@loc@TMPa}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult + \fi + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmax\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfmathlog@\expandafter{\pgfplots@loc@TMPa}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult + \fi + % % any user specified axis ticks: \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tick\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -6238,16 +4955,37 @@ \pgfkeysgetvalue{/pgfplots/#1 coord trafo/.@cmd}\pgfplots@loc@TMPc \ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key \expandafter\def\csname pgfplots@prepare@#1coord\endcsname##1{% - \pgfmathlog@{##1}% + \edef\pgfmathresult{##1}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfplots@if{pgfplots@disablelogfilter@#1}{% + \pgfmathfloatparsenumber{##1}% + \pgfmathfloattofixed{\pgfmathresult}% + }{% + \pgfmathlog@{##1}% + }% + \fi }% \else % This is a bit complicated... but it works. - \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfplots@prepare@#1coord\endcsname{##1}\expandafter\pgfmathlog@\expandafter{\pgfmathresult}}% + \t@pgfplots@toka=\expandafter\expandafter\expandafter{% + \csname pgfplots@prepare@#1coord\endcsname{##1}% + \edef\pgfmathresult{##1}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfplots@if{pgfplots@disablelogfilter@#1}{% + \pgfmathfloatparsenumber{##1}% + \pgfmathfloattofixed{\pgfmathresult}% + }{% + \expandafter\pgfmathlog@\expandafter{\pgfmathresult}% + }% + \fi + }% \edef\pgfplots@loc@TMPa{\the\t@pgfplots@toka}% \expandafter\def\expandafter\pgfplots@loc@TMPa\expandafter##\expandafter1\expandafter{\pgfplots@loc@TMPa}% \expandafter\let\csname pgfplots@prepare@#1coord\endcsname=\pgfplots@loc@TMPa \fi - \fi + }% \fi } @@ -6268,6 +5006,16 @@ \pgfplots@show@label{y}{\pgfplots@label@}% \fi \fi + \ifpgfplots@threedim + \ifpgfplots@hide@z + \else + \pgfkeysgetvalue{/pgfplots/zlabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty + \else + \pgfplots@show@label{z}{\pgfplots@label@}% + \fi + \fi + \fi % \pgfkeysgetvalue{/pgfplots/title}\pgfplots@loc@TMPa \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -6289,6 +5037,12 @@ \def\pgfplots@datascaletrafo@redoshift@y#1{% \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@y}% }% +\def\pgfplots@datascaletrafo@undoshift@z#1{% + \pgfmathsubtract@{#1}{\pgfplots@data@scale@trafo@SHIFT@z}% +}% +\def\pgfplots@datascaletrafo@redoshift@z#1{% + \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@z}% +}% % DATA TRANSFORMATION T(x) = X - xmin % @@ -6331,6 +5085,19 @@ \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@y}% \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } +\def\pgfplots@datascaletrafo@z#1{% + \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@z}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@SHIFT@z}% +} +\def\pgfplots@datascaletrafo@fromfixed@z#1{% + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfplots@datascaletrafo@z\expandafter{\pgfmathresult}% +} +\def\pgfplots@datascaletrafo@z@noshift#1{% + \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@z}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} % INVERSE transformation x = T^{-1}( X ) % Input: @@ -6403,6 +5170,36 @@ \endgroup } +\def\pgfplots@inverse@datascaletrafo@z#1{% + \begingroup + \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@z}% + \let\pgfplots@inverse@datascaletrafo@@shifted=\pgfmathresult + \pgfmathapproxequalto@{\pgfplots@inverse@datascaletrafo@@shifted}{0.0}% + \ifpgfmathcomparison + \pgfmathfloatcreate{0}{0.0}{0}% + \else + \pgfmathfloatparsenumber{\pgfplots@inverse@datascaletrafo@@shifted}% + \edef\pgfplots@data@scale@trafo@EXPONENT@z{-\pgfplots@data@scale@trafo@EXPONENT@z}% + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@z}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +% Overloaded function. This one does only apply the scaling, no shift. +\def\pgfplots@inverse@datascaletrafo@z@noshift#1{% + \begingroup + \pgfmathapproxequalto@{#1}{0.0}% + \ifpgfmathcomparison + \pgfmathfloatcreate{0}{0.0}{0}% + \else + \pgfmathfloatparsenumber{#1}% + \edef\pgfplots@data@scale@trafo@EXPONENT@z{-\pgfplots@data@scale@trafo@EXPONENT@z}% + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@z}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + % Overloaded function. % % In contrast to \pgfplots@inverse@datascaletrafo@x, this method @@ -6416,6 +5213,10 @@ \pgfplots@inverse@datascaletrafo@y{#1}% \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } +\def\pgfplots@inverse@datascaletrafo@tofixed@z#1{% + \pgfplots@inverse@datascaletrafo@z{#1}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} % Overloaded function. % @@ -6428,6 +5229,10 @@ \pgfplots@inverse@datascaletrafo@y@noshift{#1}% \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } +\def\pgfplots@inverse@datascaletrafo@tofixed@z@noshift#1{% + \pgfplots@inverse@datascaletrafo@z@noshift{#1}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} % Parses all options in #1 which are known in the currently active families. % @@ -6501,6 +5306,9 @@ \let\prettyprintnumber=\pgfmathprintnumber% \def\pgfplots@set@options#1{% + \pgfplots@bb@isactivetrue + \pgfplots@curplot@threedimfalse + \global\pgfplots@threedimfalse \pgfutil@ifundefined{tikz@lastx}{% % no warning. Its not that important anyway, I think. \def\pgfplots@at{\pgfpointorigin}% @@ -6512,16 +5320,8 @@ % This allows to get the names - they should not be appended to % 'every axis'! \pgfkeys{% - /tikz/domain/.belongs to family=/pgfplots, - /pgfplots/domain/.code={\pgfkeysalso{/tikz/domain=##1}}, /tikz/name/.belongs to family=/pgfplots/naming commands, /tikz/alias/.belongs to family=/pgfplots/naming commands, - % and provide aliases in the '/pgfplots/' tree to avoid - % search path problems just for these two options: - /pgfplots/name/.belongs to family=/pgfplots/naming commands, - /pgfplots/alias/.belongs to family=/pgfplots/naming commands, - /pgfplots/name/.code={\pgfkeysalso{/tikz/name=##1}}, - /pgfplots/alias/.code={\pgfkeysalso{/tikz/alias=##1}}, % % /pgf/key filter handlers/append filtered to/.install key filter handler=\pgfplots@rmopts, @@ -6569,6 +5369,9 @@ \fi \fi \pgfplots@deactivefamiliescmd + \pgfkeysdef{/pgfplots/xmode}{\pgfplots@error{You can't set 'xmode' in this context, sorry.}}% + \pgfkeysdef{/pgfplots/ymode}{\pgfplots@error{You can't set 'ymode' in this context, sorry.}}% + \pgfkeysdef{/pgfplots/zmode}{\pgfplots@error{You can't set 'zmode' in this context, sorry.}}% % % Acquire style commands and nameing commands from direct input % options '#1' BEFORE the 'every' styles are processed: @@ -6662,6 +5465,14 @@ \global\pgfkeysgetvalue{/pgfplots/xmax}{\pgfplots@xmax}% \global\pgfkeysgetvalue{/pgfplots/ymin}{\pgfplots@ymin}% \global\pgfkeysgetvalue{/pgfplots/ymax}{\pgfplots@ymax}% + \global\pgfkeysgetvalue{/pgfplots/zmin}{\pgfplots@zmin}% + \global\pgfkeysgetvalue{/pgfplots/zmax}{\pgfplots@zmax}% + \pgfkeysgetvalue{/pgfplots/xtickmin}{\pgfplots@xtickmin}% + \pgfkeysgetvalue{/pgfplots/xtickmax}{\pgfplots@xtickmax}% + \pgfkeysgetvalue{/pgfplots/ytickmin}{\pgfplots@ytickmin}% + \pgfkeysgetvalue{/pgfplots/ytickmax}{\pgfplots@ytickmax}% + \pgfkeysgetvalue{/pgfplots/ztickmin}{\pgfplots@ztickmin}% + \pgfkeysgetvalue{/pgfplots/ztickmax}{\pgfplots@ztickmax}% % \def\pgfplots@loc@TMPa{data}% \pgfplots@collect@firstplot@astickfalse @@ -6671,13 +5482,17 @@ \ifx\pgfplots@ytick\pgfplots@loc@TMPa \pgfplots@collect@firstplot@asticktrue \fi + \ifx\pgfplots@ztick\pgfplots@loc@TMPa + \pgfplots@collect@firstplot@asticktrue + \fi \ifpgfplots@collect@firstplot@astick - \let\pgfplots@firstplot@coords@x=\pgfutil@empty - \let\pgfplots@firstplot@coords@y=\pgfutil@empty + \global\let\pgfplots@firstplot@coords@x=\pgfutil@empty + \global\let\pgfplots@firstplot@coords@y=\pgfutil@empty + \global\let\pgfplots@firstplot@coords@z=\pgfutil@empty \fi \pgfkeysdef{/pgfplots/.unknown}{% \let\pgfplots@searchname=\pgfkeyscurrentname - \pgfkeysalso{/tikz/\pgfplots@searchname=##1}% + \pgfkeysalso{/tikz/\pgfplots@searchname={##1}}% }% } @@ -6727,14 +5542,16 @@ }% % temporary (local) variables inside of axis -\newif\ifpgfplots@autocomputeanylimits \newif\ifpgfplots@autocompute@all@limits \newif\ifpgfplots@autocompute@xmin \newif\ifpgfplots@autocompute@xmax \newif\ifpgfplots@autocompute@ymin \newif\ifpgfplots@autocompute@ymax +\newif\ifpgfplots@autocompute@zmin +\newif\ifpgfplots@autocompute@zmax \newif\ifpgfplots@apply@datatrafo@x \newif\ifpgfplots@apply@datatrafo@y +\newif\ifpgfplots@apply@datatrafo@z \newif\ifpgfplots@apply@datatrafo \newif\ifpgfplots@datascaletrafo@initialised \newif\ifpgfplots@draw@at@end @@ -6793,6 +5610,12 @@ \t@pgfplots@toka=\expandafter{\pgfplots@curlegendcode current plot style\pgfeov}% \t@pgfplots@tokb=\expandafter{\pgfplots@label@tikzopts}% \t@pgfplots@tokc=\expandafter{\pgfplots@crossref@pic\pgfeov}% + % 1. prepare /pgfplots/refstyle={#1}: + \immediate\write\@auxout{% + \noexpand\expandafter\noexpand\gdef + \noexpand\csname pgfplots@labelstyle@#1\noexpand\endcsname{\the\t@pgfplots@tokb}% + }% + % 2. prepare \ref{#1} and \pageref{#1}: \edef\pgfplots@loc@TMPa{% \noexpand\begingroup \noexpand\pgfkeysdef{/tikz/current plot style}{\noexpand\pgfkeysalso{\the\t@pgfplots@tokb}}% @@ -6808,15 +5631,121 @@ \fi }% -\def\pgfplots@interruptdatabb{% - \def\pgfplots@update@limits@for@one@point##1##2##3##4{}% -}% -\def\endpgfplots@interruptdatabb{% - \let\pgfplots@update@limits@for@one@point=\pgfplots@update@limits@for@one@point@orig -}% +\def\pgfplots@interruptdatabb{\pgfplots@bb@isactivefalse} +\def\endpgfplots@interruptdatabb{\pgfplots@bb@isactivetrue} + +% +% \begin{axis}[#1] : +% +% This command prepares the axis for collection. NOTHING will be drawn +% until \end{axis}. During the collect phase, axis limits will be +% computed. +% +% The following variables are accummulated between +% \begin{axis} +% and +% \end{axis}: +% +% - \pgfplots@[xyz]min +% \pgfplots@[xyz]max +% - These denote the axis limits. +% - They are always assigned globally. +% - For linear axes, they will be computed in floating point. +% - For log axes, they will be computed using pgf math engine. +% - \pgfplots@[xyz]min@reg +% - A register containing the value of macro \pgfplots@[xyz]min +% in pt. It is only valid during \end{axis}. +% - \pgfplots@[xyz]max@reg +% - The same for 'max'. +% - \pgfplots@invalidrange@[xyz]min +% \pgfplots@invalidrange@[xyz]max +% A value which is used for the axis limits before the +% limit computation starts. +% - \pgfplots@data@[xyz]min +% \pgfplots@data@[xyz]max +% - DATA limits. These limits are not affected by limit +% restrictions +% - They are used to initialise the data scaling trafo. +% - They WON'T be assigned for log axes. +% - Assigned globally. +% - \pgfplots@[xyz]min@unscaled@as@float +% - Assigned during \end{axis} (local variables). +% - Contain the value of axis limits as floating point numbers +% in the original data range. +% - \pgfplots@metamin +% \pgfplots@metamax +% - if meta data is active, these macros will contain the upper +% and lower bound for meta data. +% - will be assigned globally. +% - \pgfplots@numplots +% - A count register indexing the current plot counter. Assigned +% globally. +% - \ifpgfplots@apply@datatrafo +% A boolean which indicates whether any scaling trafo is +% active. +% - \ifpgfplots@apply@datatrafo@[xyz] +% Booleans indicating whether for which axes the scaling trafo +% is active. +% - \pgfplots@stored@plotlist +% - An instance of pgfplotslist. +% - It is assigned globally. +% - Every \addplot or tikz path command is collected into this +% structure. +% - The element type is a compound object containing everything +% needed to process the plot during \end{axis}. +% - \pgfplots@plotspeclist +% - instance of pgfplotslist +% - collects every line specification for \addplot. +% - Used to assemble legends. +% - Assigned globally. +% - \pgfplots@legend +% - instance of pgfplotslist +% - collects every legend entry. +% - Used to assemble legends. +% - Assigned globally. +% - \pgfplots@data@scale@trafo@SHIFT@[xyz] +% \pgfplots@data@scale@trafo@EXPONENT@[xyz] +% - For any direction for which the scaling trafo is active, +% these macros contain the two parameters for the affine scaling +% trafo. +% - \pgfplots@firstplot@coords@[xyz] +% - A macro containing a comma separated list +% - It is collected if and only if [xyz]tick = 'data'. +% - Contains a list of coordinates in floating point +% representation if the axis is linear. +% - The coordinates are in pgf math notation for log axes. +% - Assigned globally. +% - \pgfplots@[xyz]@veclength +% - A macro containing the vector length of the [xyz] unit +% vector. +% - Assigned in \end{axis} +% - \pgfplots@[xyz]@inverseveclength +% - A macro containing the INVERSE vector length of the [xyz] +% unit vector. +% - Assigned in \end{axis} +% - \pgfplotspoint[xyz]axis +% - A macro which sets 'pgf@x' and 'pgf@y' to the [xyz] axis. +% - \pgfplotspoint[xyz]axislength +% - A macro containing the vector length of the [xyz] axis +% (including the 'pt' suffix). +% +% - \ifpgfplots@curplot@threedim +% - valid during an '\addplot' preparation step. +% - \ifpgfplots@threedim +% - whether the axis shall be threedimensional. +% +% - \pgfplots@currentplot@firstcoord@[xyz] +% - \pgfplots@currentplot@lastcoord@[xyz] +% - contains the first/last coordinate of the current plot. +% - assigned globally. +% - \ifpgfplots@coord@stream@isfirst +% - assigned globally during \addplot. +% +% \def\pgfplots@environment@opt[#1]{% \begingroup + \pgfplots@checkandpreparefor@active@semicolon \pgfplots@install@abbrev@commands \pgfplots@stacked@initialise % @@ -6830,6 +5759,7 @@ % '1pt' here as well. \pgfsetxvec{\pgfqpoint{1pt}{0pt}}% \pgfsetyvec{\pgfqpoint{0pt}{1pt}}% + \pgfsetzvec{\pgfqpoint{1.2pt}{1.2pt}}% % \pgfplots@set@options{#1}% % @@ -6843,6 +5773,7 @@ % -------------------- \pgfplots@prepare@coord@filtering@for x \pgfplots@prepare@coord@filtering@for y + \pgfplots@prepare@coord@filtering@for z \ifpgfplots@apply@datatrafo \pgfplots@datascaletrafo@initialisedfalse \else @@ -6867,48 +5798,63 @@ \def\pgfplots@invalidrange@ymin{16300}% \def\pgfplots@invalidrange@ymax{-16300}% \fi + \ifpgfplots@zislinear + \pgfmathfloatcreate{1}{1.0}{2147483645}% + \let\pgfplots@invalidrange@zmin=\pgfmathresult + \pgfmathfloatcreate{2}{1.0}{2147483645}% + \let\pgfplots@invalidrange@zmax=\pgfmathresult + \else + \def\pgfplots@invalidrange@zmin{16300}% + \def\pgfplots@invalidrange@zmax{-16300}% + \fi % % These numbers will ONLY be filled for linear axis! \global\let\pgfplots@data@xmin=\pgfplots@invalidrange@xmin \global\let\pgfplots@data@xmax=\pgfplots@invalidrange@xmax \global\let\pgfplots@data@ymin=\pgfplots@invalidrange@ymin \global\let\pgfplots@data@ymax=\pgfplots@invalidrange@ymax + \global\let\pgfplots@data@zmin=\pgfplots@invalidrange@zmin + \global\let\pgfplots@data@zmax=\pgfplots@invalidrange@zmax % \pgfplots@autocompute@all@limitstrue \ifx\pgfplots@xmin\pgfutil@empty \pgfplots@autocompute@xmintrue \global\let\pgfplots@xmin=\pgfplots@invalidrange@xmin - \pgfplots@autocomputeanylimitstrue \else \pgfplots@autocompute@all@limitsfalse \fi \ifx\pgfplots@xmax\pgfutil@empty \pgfplots@autocompute@xmaxtrue \global\let\pgfplots@xmax=\pgfplots@invalidrange@xmax - \pgfplots@autocomputeanylimitstrue \else \pgfplots@autocompute@all@limitsfalse \fi \ifx\pgfplots@ymin\pgfutil@empty \pgfplots@autocompute@ymintrue \global\let\pgfplots@ymin=\pgfplots@invalidrange@ymin - \pgfplots@autocomputeanylimitstrue \else \pgfplots@autocompute@all@limitsfalse \fi \ifx\pgfplots@ymax\pgfutil@empty \pgfplots@autocompute@ymaxtrue \global\let\pgfplots@ymax=\pgfplots@invalidrange@ymax - \pgfplots@autocomputeanylimitstrue \else \pgfplots@autocompute@all@limitsfalse \fi - % - % autocomputelimits := at least one limit needs to be updated. - \ifpgfplots@autocomputeanylimits - \pgfplots@draw@at@endtrue + \ifx\pgfplots@zmin\pgfutil@empty + \pgfplots@autocompute@zmintrue + \global\let\pgfplots@zmin=\pgfplots@invalidrange@zmin + \else + \global\pgfplots@threedimtrue + \pgfplots@autocompute@all@limitsfalse + \fi + \ifx\pgfplots@zmax\pgfutil@empty + \pgfplots@autocompute@zmaxtrue + \global\let\pgfplots@zmax=\pgfplots@invalidrange@zmax + \else + \global\pgfplots@threedimtrue + \pgfplots@autocompute@all@limitsfalse \fi - % % % -------------------- % Start axis: @@ -6916,7 +5862,8 @@ % -------------------- % % Since I've introduced a public \numplots macro, I should - % make sure it's filled correctly: + % make sure it's filled correctly. + % All versions from now on will store plots until \end{axis}: \pgfplots@draw@at@endtrue % \ifpgfplots@collect@firstplot@astick @@ -6949,12 +5896,16 @@ \let\path=\pgfplots@replacement@for@tikz@path \let\closedcycle=\pgfplots@path@closed@cycle \ifpgfplots@draw@at@end - \let\pgfplots@nextcommand=\relax \else - \def\pgfplots@nextcommand{\pgfplots@BEGIN@init@and@draw@axis}% + \expandafter% remove the '\fi' + \pgfplots@BEGIN@init@and@draw@axis \fi - \pgfplots@nextcommand } + +% \end{axis} : +% +% This command actually takes all collected (global) variables, +% creates an axis and performs all postponed drawing operations. \def\endpgfplots@environment@opt{% \xdef\numplots{\the\pgfplots@numplots}% \pgfkeysvalueof{/pgfplots/before end axis/.@cmd}\pgfeov% @@ -6968,6 +5919,10 @@ % All plotting commands have been read. % -> apply postponed drawing commands! % -------------------- + + + + \ifpgfplots@draw@at@end% ALWAYS TRUE - this is obsolete \def\pgfplots@nextcommand{% \pgfplots@BEGIN@init@and@draw@axis @@ -6981,13 +5936,21 @@ \pgfplotslistforeach\pgfplots@stored@plotlist\as\pgfplots@loc@TMPa{% \expandafter\pgfplots@stored@plotlist@EXTRACTENTRY\pgfplots@loc@TMPa %\message{Processing stored plot with precommand '\meaning\pgfplots@stored@current@precmd'; pgfplots@plotcmd '\meaning\pgfplots@stored@current@cmd' postcommand '\meaning\pgfplots@stored@current@postcmd'}% - % The precmd processed any error bars. - \pgfplots@stored@current@precmd + % The precmd sets all required variables needed to + % finalize a plot. + % @see the stream preparation routines. \ifx\pgfplots@stored@current@cmd\pgfutil@empty + \pgfplots@stored@current@precmd \pgfplots@stored@current@data% \else % this code here means we REALLY have a plotting % command! + \pgfplots@stored@current@precmd + % de-activate the FPU here! I fear its number + % format may cause errors when used in low-level + % routines. + \pgfkeys{/pgf/fpu=false}% + % \ifpgfplots@stacked@reverse % has already been processed above, in \pgfplots@stacked@finalize@stored@plots. \pgfplots@stacked@draw@reversed@plot @@ -7009,20 +5972,22 @@ % \begingroup % set coordinate system to (0,0) rectangle (1,1) for descriptions: - \pgftransformxshift{\pgfplots@xcoordminTEX}% - \pgftransformyshift{\pgfplots@ycoordminTEX}% + \pgftransformshift{\pgfplotspointsouthwest}% + % This here is a preparation macro for \pgfplots@low@level@shape@INNER. + % It applies the shift to the ORIGIN as well. + % It will ONLY be expanded if someone uses origin-anchors + % inside of axis descriptions. + \def\pgfplotspointORIGIN@tmp{% + \pgfpointdiff + {\pgfplotspointsouthwest}% + {\pgfqpoint{\pgfplots@ZERO@x}{\pgfplots@ZERO@y}}% + }% + \pgfsetxvec{\pgfplotspointxaxis}% + \pgfsetyvec{\pgfplotspointyaxis}% % - % create a 'current axis' node for anchor references. + % create a leight-weight 'current axis' node for anchor references. \pgfmultipartnode{pgfplots@low@level@shape@INNER}{south west}{current axis}{\pgfusepath{discard}}% % - \pgfplots@tmpa=\pgfplots@xcoordmaxTEX - \advance\pgfplots@tmpa by-\pgfplots@xcoordminTEX - \pgfsetxvec{\pgfqpoint{\pgfplots@tmpa}{0cm}}% - % - \pgfplots@tmpa=\pgfplots@ycoordmaxTEX - \advance\pgfplots@tmpa by-\pgfplots@ycoordminTEX - \pgfsetyvec{\pgfqpoint{0cm}{\pgfplots@tmpa}}% - % \pgfplots@create@axis@descriptions \pgfkeysvalueof{/pgfplots/extra description/.@cmd}\pgfeov% \endgroup @@ -7041,19 +6006,12 @@ \xdef\pgfplots@saveddimen@picminx{\the\pgf@picminx}% \xdef\pgfplots@saveddimen@picminy{\the\pgf@picminy}% % - \pgf@xa=\pgfplots@xcoordmaxTEX - \advance\pgf@xa by-\pgf@picminx - \xdef\pgfplots@savedanchor@inner@upperright@x{\the\pgf@xa}% - % - \pgf@xa=\pgfplots@xcoordminTEX + \pgfplotspointsouthwest + \pgf@xa=\pgf@x \advance\pgf@xa by-\pgf@picminx \xdef\pgfplots@savedanchor@inner@lowerleft@x{\the\pgf@xa}% % - \pgf@xa=\pgfplots@ycoordmaxTEX - \advance\pgf@xa by-\pgf@picminy - \xdef\pgfplots@savedanchor@inner@upperright@y{\the\pgf@xa}% - % - \pgf@xa=\pgfplots@ycoordminTEX + \pgf@xa=\pgf@y \advance\pgf@xa by-\pgf@picminy \xdef\pgfplots@savedanchor@inner@lowerleft@y{\the\pgf@xa}% % @@ -7124,6 +6082,7 @@ \pgfutil@for\pgfplots@child@node@name:=\pgfplots@named@child@node@list\do{% \ifx\pgfplots@child@node@name\pgfutil@empty \else +%\message{Attempting to correct '\pgfplots@child@node@name' position (it is inside of an axis).}% \expandafter\ifx\csname pgfplots@child@node@visited@\pgfplots@child@node@name\endcsname\relax% \pgfutil@ifundefined{pgf@sh@nt@\pgfplots@child@node@name}{% \pgfplots@warning{could not adjust coordinates of named node '\pgfplots@child@node@name' for reasons I do not understand! After finishing the image, it did no longer exist!? Sorry.}% @@ -7190,3 +6149,6 @@ \tikzaddtikzonlycommandshortcutlet\loglogaxis\pgfplots@environment@loglogaxis \tikzaddtikzonlycommandshortcutlet\endloglogaxis\endpgfplots@environment@loglogaxis + + +\catcode`\;=\pgfplots@oldcatcodesemicolon |