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 | 4743 |
1 files changed, 3585 insertions, 1158 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex index d386b2195a3..a5ba73ca4ad 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex @@ -7,7 +7,7 @@ % % It is based on Till Tantau's PGF package. % -% Copyright 2007/2008 by Christian Feuersänger. +% Copyright 2007/2008/2009 by Christian Feuersänger. % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -28,24 +28,30 @@ \catcode`\;=12 \input pgfplotscore.code.tex +\input pgfplotslibrary.code.tex \input pgfplotsoldpgfsupp_loader.code.tex \input pgfplotsutil.code.tex \input pgfplotscolormap.code.tex -\input pgfplots.stackedplots.code.tex +\input pgfplotsstackedplots.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@has@label@information \newif\ifpgfplots@yislinear \newif\ifpgfplots@zislinear \newif\ifpgfplots@axis@equal \newif\ifpgfplots@axis@equal@image +\newif\ifpgfplots@reverse@legend +\newif\ifpgfplots@allow@reversal@of@rel@axis@cs +\newif\ifpgfplots@scanline@verbose \newcount\pgfplots@numplots \newdimen\pgfplots@xmin@reg \newdimen\pgfplots@xmax@reg @@ -57,6 +63,8 @@ \newif\ifpgfplots@isuniformtick \newif\ifpgfplots@clip@limits \newif\ifpgfplots@clip +\newif\ifpgfplots@plot@coords@mathparser +\pgfplots@plot@coords@mathparsertrue \pgfplots@cliptrue \newif\ifpgfplots@enlargelimits \newif\ifpgfplots@enlargelimits@rel@thresh @@ -86,6 +94,9 @@ \newif\ifpgfplots@hide@x \newif\ifpgfplots@hide@y \newif\ifpgfplots@hide@z +\newif\ifpgfplots@shownothingof@x +\newif\ifpgfplots@shownothingof@y +\newif\ifpgfplots@shownothingof@z \newif\ifpgfplots@is@old@list@format \newif\ifpgfplots@errorbars@enabled \newif\ifpgfplots@scale@only@axis @@ -97,11 +108,16 @@ \newif\ifpgfplots@stacked@plus \newif\ifpgfplots@plot@file@skipfirst \newif\ifpgfplots@threedim +\newif\ifpgfplotsthreedim \newif\ifpgfplots@curplot@isirrelevant -\newif\ifpgfplots@perpointmeta@usesfloat +\newif\ifpgfplots@colorbar +\newif\ifpgfplots@deprecated@anchors +\newif\ifpgfplots@translategnuplot +\pgfplots@translategnuplottrue \let\pgfnodepartimagebox=\pgfnodeparttextbox \newif\ifpgfplots@collect@firstplot@astick +\newif\ifpgfplots@units@use \def\pgfplots@errorbars@xdirection{0}% pre-init, see below \def\pgfplots@errorbars@ydirection{0}% @@ -111,7 +127,10 @@ \def\axisdefaultheight{207pt} - +% Invokes '#2' if a cycle list named '#1' exists and '#3' if not. +\long\def\pgfplotsifcyclelistexists#1#2#3{% + \pgfutil@ifundefined{pgfp@cyclist@\string#1@}{#3}{#2}% +}% % Creates a named plot cycle list. % @@ -146,6 +165,20 @@ 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{linestyles}{solid,dashed,dotted} +\pgfplotscreateplotcyclelist{color list}{red,blue,black,yellow,brown,teal,orange,violet,cyan,green!70!black,magenta,gray} +\pgfplotscreateplotcyclelist{mark list}{% + every mark/.append style={fill=.!80!black},mark=*\\% + every mark/.append style={fill=.!80!black},mark=square*\\% + every mark/.append style={fill=.!80!black},mark=triangle*\\% + mark=star\\% + every mark/.append style={fill=.!80!black},mark=diamond*\\% + every mark/.append style={fill=.!80!black},mark=otimes*\\% + mark=|\\% + every mark/.append style={fill=.!80!black},mark=pentagon*\\% + mark=text,text mark=p\\% + mark=text,text mark=a\\% +} \pgfplotscreateplotcyclelist{exotic}{% teal,every mark/.append style={fill=teal!80!black},mark=*\\% orange,every mark/.append style={fill=orange!80!black},mark=square*\\% @@ -207,27 +240,177 @@ } } -% 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 +% Sets the keys for /pgfplots/[xyz]ticklabel anchor. +% #1: one of [xyz] +% #2: the value +\def\pgfplots@setticklabel@anchor@for#1#2{% + \def\pgfplots@loc@TMPa{#2}% + \def\pgfplots@loc@TMPb{auto}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \expandafter\def\csname pgfplots@ticklabel@anchor@#1\endcsname{0}% + \else + \def\pgfplots@loc@TMPb{near ticklabel}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \expandafter\def\csname pgfplots@ticklabel@anchor@#1\endcsname{1}% + \else + \def\pgfplots@loc@TMPb{tikz}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \expandafter\def\csname pgfplots@ticklabel@anchor@#1\endcsname{2}% + \else + \pgfplots@error{Sorry, I got an unexpected value for '#1ticklabel anchor': '#2'. Expected one of 'auto', 'near ticklabel' or 'tikz'.}% + \fi + \fi + \fi +}% + +% Does the work for '[xyz]ticklabel pos'. +% +% #1: the axis (x,y or z). +% #2: the key argument. Accepts +% 'lower', +% 'upper', +% 'default' -> depends on 'tick pos' +% 'left' = 'lower', +% 'bottom' = 'lower', +% 'right' = 'upper' +% 'top' = 'upper'. +% +\def\pgfplots@setkey@ticklabelpos#1#2{% + \def\pgfplots@loc@TMPa{#2}% + \def\pgfplots@loc@TMPb{lower}% + \expandafter\def\csname pgfplots@#1ticklabel@pos\endcsname{l}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \else + \def\pgfplots@loc@TMPb{upper}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \expandafter\def\csname pgfplots@#1ticklabel@pos\endcsname{u}% + \else + \def\pgfplots@loc@TMPb{default}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \expandafter\def\csname pgfplots@#1ticklabel@pos\endcsname{}% + \else + \def\pgfplots@loc@TMPb{left}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \else + \def\pgfplots@loc@TMPb{right}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \expandafter\def\csname pgfplots@#1ticklabel@pos\endcsname{u}% + \else + \expandafter\def\csname pgfplots@#1ticklabel@pos\endcsname{}% + \pgfplots@error{Sorry, the key '#1ticklabel pos' does not know what to do with '#2'... accepted values are 'default, 'lower', 'upper' and some aliases. Maybe you misspelled it?}% + \fi + \fi + \fi + \fi + \fi +}% + +% Sets 'x dir={normal,reverse}' +% #1: an axis +% #2: the key's value to apply +\def\pgfplots@setkey@axisdir@for#1#2{% + \def\pgfplots@loc@TMPa{#2}% + \def\pgfplots@loc@TMPb{normal}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \pgfkeyssetvalue{/pgfplots/#1 dir/value}{n}% + \else + \def\pgfplots@loc@TMPb{reverse}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \pgfkeyssetvalue{/pgfplots/#1 dir/value}{r}% + \else + \pgfkeyssetvalue{/pgfplots/#1 dir/value}{n}% + \pgfplots@error{Sorry, the key '#1 dir' does not know what to do with '#2'... accepted values are 'normal' or 'reverse'.}% + \fi + \fi +}% + + +\def\pgfplots@meshmode{n}% none +\def\pgfplotsplothandlermesh@flatmode{m}% mean + +\def\pgfplots@cycle@multi@list@EOI{\pgfplots@cycle@multi@list@EOI}% +\def\pgfplots@cycle@multi@list#1{% + \def\pgfplots@loc@TMPb{0}% + \gdef\pgfplots@cycle@multi@list@finalize@{}% + \pgfplots@cycle@multi@list@#1\nextlist\pgfplots@cycle@multi@list@EOI +}% +\def\pgfplots@cycle@multi@list@#1\nextlist{% + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + % ignore it if someone provided too many \nextlist commands. + \else + % parse and store list: + \begingroup + \def\pgfplots@as@string{#1}% this deals with control sequences inside of #1. + \pgfplots@command@to@string\pgfplots@as@string\pgfplots@as@string + \expandafter\pgfplots@cycle@multi@list@findnamed\pgfplots@as@string\pgfplots@EOI + \global\let\pgfplots@glob@TMPa=\pgfplots@loc@TMPa + \endgroup + \ifx\pgfplots@glob@TMPa\pgfutil@empty + % create it: + \pgfplotscreateplotcyclelist{/pgfplots/cycle multi list/@list\pgfplots@loc@TMPb}{#1}% + \else + % ok, take an existing one + \expandafter\let\csname pgfp@cyclist@/pgfplots/cycle multi list/@list\pgfplots@loc@TMPb @\endcsname=\pgfplots@glob@TMPa + \fi + \begingroup + \expandafter\pgfplotslistsize\csname pgfp@cyclist@/pgfplots/cycle multi list/@list\pgfplots@loc@TMPb @\endcsname\to\c@pgf@counta + \edef\pgfmathresult{\the\c@pgf@counta}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \pgfkeyslet{/pgfplots/cycle multi list/@totalN\pgfplots@loc@TMPb}\pgfmathresult + \pgfkeyslet{/pgfplots/cycle multi list/@N\pgfplots@loc@TMPb}\pgfmathresult +%\def\temp{#1}\message{cycle multi list/@list={\meaning\temp}; /@N\pgfplots@loc@TMPb = \pgfkeysvalueof{/pgfplots/cycle multi list/@N\pgfplots@loc@TMPb}.}% + \pgfplotsutil@advancestringcounter\pgfplots@loc@TMPb + \fi + % + \pgfutil@ifnextchar{\pgfplots@cycle@multi@list@EOI}{% + \pgfplots@cycle@multi@list@finalize }{% - \expandafter\def\csname pgfplots@#1ticklabelaxisspec\endcsname{#2}% + \pgfplots@cycle@multi@list@ }% }% +% checks for +% - <known list> +% - [<elements> of]<known list> +% POSTCONDITION: +% 1. pgfplots@loc@TMPa will be \pgfutil@empty if there is no such +% list. +% 2. \pgfplots@loc@TMPa will be \let to the list if there is one. +% 3. \pgfplots@cycle@multi@list@finalize@ will contain any 'partial sublist' +% commands. +\def\pgfplots@cycle@multi@list@findnamed{\pgfutil@ifnextchar[{\pgfplots@cycle@multi@list@findnamed@}{\pgfplots@cycle@multi@list@findnamed@[]}}% +\def\pgfplots@cycle@multi@list@findnamed@[#1]#2\pgfplots@EOI{% + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \pgfplots@cycle@multi@list@findnamed@@#1 \pgfplots@EOI + \fi + \pgfplotsifcyclelistexists{#2}{% + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@cyclist@\string#2@\endcsname% + }{% + \let\pgfplots@loc@TMPa=\pgfutil@empty + }% +} +\def\pgfplots@cycle@multi@list@findnamed@@#1 {\pgfutil@ifnextchar o{\pgfplots@cycle@multi@list@findnamed@@@{#1}}{\pgfplots@cycle@multi@list@findnamed@@@{#1}of}}% +\def\pgfplots@cycle@multi@list@findnamed@@@#1of#2\pgfplots@EOI{% + \begingroup + \t@pgfplots@toka=\expandafter{\pgfplots@cycle@multi@list@finalize@}% + \t@pgfplots@tokb={#1}% + \xdef\pgfplots@cycle@multi@list@finalize@{\the\t@pgfplots@toka + \noexpand\pgfkeys{/pgfplots/cycle multi list/partial sublist={\pgfplots@loc@TMPb}{\the\t@pgfplots@tokb}}% + }% + \endgroup +} +\def\pgfplots@cycle@multi@list@finalize\pgfplots@cycle@multi@list@EOI{% + \pgfkeyslet{/pgfplots/cycle multi list/@dim}\pgfplots@loc@TMPb + \pgfplots@cycle@multi@list@finalize@ +}% \pgfkeys{% - /pgfplots/search path for tikz/.unknown/.code={% - \let\searchname=\pgfkeyscurrentname% - \pgfkeysalso{% - /tikz/\searchname/.try=#1, - /pgfplots/\searchname/.lastretry=#1 - }% - },% + /pgfplots/search path for tikz/.search also={/tikz,/pgfplots}, /pgfplots/.is family, /pgfplots/scale/.is family, /pgfplots/legend/.is family, @@ -257,22 +440,52 @@ /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 marks/.style={/pgfplots/no markers}, /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, - /pgfplots/every axis x label/.style={at={(0.5,0)},below,yshift=-15pt}, + /pgfplots/every axis label/.belongs to family=/pgfplots/descriptions, + /pgfplots/xlabel near ticks/.style={% + /pgfplots/every axis x label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel},% + /pgfplots/every x tick scale label/.style={at={(xticklabel cs:0.9,5pt)},anchor=near xticklabel,inner sep=0pt}, + },% + /pgfplots/xlabel absolute/.style={% + /pgfplots/every axis x label/.style={at={(0.5,0)},below,yshift=-15pt},% + /pgfplots/every x tick scale label/.style={at={(1,0)},yshift=-2em,left,inner sep=0pt}, + },% /pgfplots/every axis x label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis x label}}, - /pgfplots/every axis x label/.belongs to family=/pgfplots/style commands, - /pgfplots/every axis y label/.style={at={(0,0.5)},xshift=-35pt,rotate=90}, + /pgfplots/every axis x label/.belongs to family=/pgfplots/descriptions, + % + /pgfplots/ylabel near ticks/.style={% + /pgfplots/every axis y label/.style={at={(ticklabel cs:0.5)},rotate=90,anchor=near ticklabel},% + /pgfplots/every y tick scale label/.style={at={(yticklabel cs:1.03,-\pgfplotsvalueoflargesttickdimen y -0.3em)},anchor=south west,inner sep=0pt}, + },% + /pgfplots/ylabel absolute/.style={% + /pgfplots/every axis y label/.style={at={(0,0.5)},xshift=-35pt,rotate=90}, + /pgfplots/every y tick scale label/.style={at={(0,1)},above right,inner sep=0pt,yshift=0.3em}, + },% /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 y label/.belongs to family=/pgfplots/descriptions, + /pgfplots/every axis z label/.style={at={(ticklabel cs:0.5)},rotate=90, anchor=near ticklabel}, /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 z label/.belongs to family=/pgfplots/descriptions, + /pgfplots/every 3d description/.style={% + /pgfplots/every axis x label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel},% + /pgfplots/every axis y label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel},% + /pgfplots/every x tick scale label/.style={at={(xticklabel cs:0.95,5pt)},anchor=near xticklabel,inner sep=0pt}, + /pgfplots/every y tick scale label/.style={at={(yticklabel cs:0.95,5pt)},anchor=near yticklabel,inner sep=0pt}, + /pgfplots/try min ticks=3,% + },% + /pgfplots/every 3d view {0}{90}/.style={% + /pgfplots/xlabel near ticks,% + /pgfplots/ylabel near ticks,% + /pgfplots/axis on top=true,% + },% + % will be defined in \pgfplotspoint@initialisation: + %/tikz/sloped like x axis/.code={...},% /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, + /pgfplots/every axis title/.belongs to family=/pgfplots/descriptions, /pgfplots/every tick/.style={very thin,gray}, /pgfplots/every tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every tick}}, /pgfplots/every tick/.belongs to family=/pgfplots/style commands, @@ -395,9 +608,15 @@ /pgfplots/extra x tick style/.code={% \pgfkeysalso{/pgfplots/every extra x tick/.append style={#1}}% }, - /pgfplots/every x tick scale label/.style={at={(1,0)},yshift=-2em,left,inner sep=0pt}, + /pgfplots/extra tick style/.code={% + \pgfkeysalso{% + /pgfplots/every extra x tick/.append style={#1},% + /pgfplots/every extra y tick/.append style={#1},% + /pgfplots/every extra z tick/.append style={#1}}% + }, + /pgfplots/every x tick scale label/.initial=,% set by compat/labels=... /pgfplots/every x tick scale label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every x tick scale label}}, - /pgfplots/every x tick scale label/.belongs to family=/pgfplots/style commands, + /pgfplots/every x tick scale label/.belongs to family=/pgfplots/descriptions, /pgfplots/every y tick label/.style={}, /pgfplots/every y tick label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every y tick label}}, /pgfplots/every y tick label/.belongs to family=/pgfplots/style commands, @@ -410,9 +629,9 @@ /pgfplots/extra y tick style/.code={% \pgfkeysalso{/pgfplots/every extra y tick/.append style={#1}}% }, - /pgfplots/every y tick scale label/.style={at={(0,1)},above right,inner sep=0pt,yshift=0.3em}, + /pgfplots/every y tick scale label/.initial=,% set by compat/labels=... /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 y tick scale label/.belongs to family=/pgfplots/descriptions, /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, @@ -425,9 +644,8 @@ /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 z tick scale label/.style={at={(zticklabel cs:1.2,-\pgfplotsvalueoflargesttickdimen z -0.3em)},anchor=near zticklabel,inner sep=0pt}, + /pgfplots/every z tick scale label/.belongs to family=/pgfplots/descriptions, /pgfplots/every axis legend/.style={% cells={anchor=center}, inner xsep=3pt,inner ysep=2pt,nodes={inner sep=2pt,text depth=0.15em}, @@ -439,6 +657,121 @@ }, /pgfplots/every axis legend/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis legend}}, /pgfplots/every axis legend/.belongs to family=/pgfplots/style commands, + % + % Colorbar interface: + /pgfplots/colorbar/.is if=pgfplots@colorbar, + /pgfplots/colorbar/.default=true, + /pgfplots/colorbar right/.style={% + /pgfplots/colorbar=true, + /pgfplots/colorbar shift/.style={xshift=0.3cm}, + /pgfplots/every colorbar/.style={% + title=, + xlabel=, + ylabel=, + zlabel=, + legend entries=, + axis on top, + at={(parent axis.right of north east)}, + anchor=north west, + grid=none, + xmin=0, + xmax=1, + ymin=\pgfkeysvalueof{/pgfplots/point meta min}, + ymax=\pgfkeysvalueof{/pgfplots/point meta max}, + plot graphics/xmin=0,% + plot graphics/xmax=1, + plot graphics/ymin=\pgfkeysvalueof{/pgfplots/point meta min}, + plot graphics/ymax=\pgfkeysvalueof{/pgfplots/point meta max}, + enlargelimits=false, + scale only axis, + height=\pgfkeysvalueof{/pgfplots/parent axis height},% + x=\pgfkeysvalueof{/pgfplots/colorbar/width}, + xtick=\empty, + xticklabel=, + ytick=, + yticklabel=, + yticklabel pos=right, + colorbar vertical/lowlevel, + }% + },% + /pgfplots/colorbar left/.style={% + /pgfplots/colorbar right, + /pgfplots/colorbar shift/.style={xshift=-0.3cm}, + /pgfplots/every colorbar/.append style={% + at={(parent axis.left of north west)}, + anchor=north east, + yticklabel pos=left, + }% + },% + /pgfplots/colorbar horizontal/.style={% + /pgfplots/colorbar=true, + /pgfplots/colorbar shift/.style={yshift=-0.3cm}, + /pgfplots/every colorbar/.style={% + title=, + xlabel=, + ylabel=, + zlabel=, + legend entries=, + axis on top, + at={(parent axis.below south west)}, + anchor=north west, + grid=none, + ymin=0, + ymax=1, + xmin=\pgfkeysvalueof{/pgfplots/point meta min}, + xmax=\pgfkeysvalueof{/pgfplots/point meta max}, + plot graphics/ymin=0,% + plot graphics/ymax=1, + plot graphics/xmin=\pgfkeysvalueof{/pgfplots/point meta min}, + plot graphics/xmax=\pgfkeysvalueof{/pgfplots/point meta max}, + enlargelimits=false, + scale only axis, + width=\pgfkeysvalueof{/pgfplots/parent axis width},% + y=\pgfkeysvalueof{/pgfplots/colorbar/width}, + xticklabel pos=left, + xtick=, + xticklabel=, + ytick=\empty, + colorbar horizontal/lowlevel, + }% + },% + % You might wonder why this special treatment with '/lowlevel' + % keys is necessary. Well, It turned out that using '##' inside of + % styles is incompatible with '.add code' -- and therefor also + % with '.append style'. This here is a work-around which works. + /pgfplots/colorbar vertical/lowlevel/.style={% + plot graphics/lowlevel draw/.code 2 args={% + \if\pgfkeysvalueof{/pgfplots/y dir/value}n% + \pgfplotscolormaptoshadingspec{\pgfkeysvalueof{/pgfplots/colormap name}}{##2}\pgfplots@loc@TMPa + \else + \pgfplotscolormapreversedtoshadingspec{\pgfkeysvalueof{/pgfplots/colormap name}}{##2}\pgfplots@loc@TMPa + \fi + \def\pgfplots@loc@TMPb{\pgfdeclareverticalshading{tempshading}{\pgfkeysvalueof{/pgfplots/colorbar/width}}}% + \expandafter\pgfplots@loc@TMPb\expandafter{\pgfplots@loc@TMPa}% + \pgfuseshading{tempshading}% + },% + }, + /pgfplots/colorbar horizontal/lowlevel/.style={% + plot graphics/lowlevel draw/.code 2 args={% + \if\pgfkeysvalueof{/pgfplots/x dir/value}n% + \pgfplotscolormaptoshadingspec{\pgfkeysvalueof{/pgfplots/colormap name}}{##1}\pgfplots@loc@TMPa + \else + \pgfplotscolormapreversedtoshadingspec{\pgfkeysvalueof{/pgfplots/colormap name}}{##1}\pgfplots@loc@TMPa + \fi + \def\pgfplots@loc@TMPb{\pgfdeclarehorizontalshading{tempshading}{\pgfkeysvalueof{/pgfplots/colorbar/width}}}% + \expandafter\pgfplots@loc@TMPb\expandafter{\pgfplots@loc@TMPa}% + \pgfuseshading{tempshading}% + },% + },% + /pgfplots/colorbar right, + /pgfplots/colorbar=false, + /pgfplots/colorbar style/.style={/pgfplots/every colorbar/.append style={#1}}, + /pgfplots/colorbar/width/.initial=0.5cm, + /pgfplots/colorbar/draw/.code={% + \axis[every colorbar,colorbar shift,colorbar=false] + \addplot graphics {}; + \endaxis + },% % tick options: /pgfplots/xticklabel/.store in= \pgfplots@xticklabel, /pgfplots/xticklabel/.belongs to family=/pgfplots/tick, @@ -448,11 +781,25 @@ \pgfplots@foreach@to@list{#1}\to\pgfplots@xticklabels \let\pgfplots@xticklabel=\pgfplots@user@ticklabel@list@x }, + % #1 table name or macro + % #2 column name (or alias or create on use) + /pgfplots/xticklabels from table/.code 2 args={% + \pgfplotstablegetcolumn{#2}\of{#1}\to\pgfplots@xticklabels + \let\pgfplots@xticklabel=\pgfplots@user@ticklabel@list@x + }, + /pgfplots/xticklabels from table/.belongs to family=/pgfplots/tick, /pgfplots/yticklabels/.belongs to family=/pgfplots/tick, /pgfplots/yticklabels/.code={% \pgfplots@foreach@to@list{#1}\to\pgfplots@yticklabels \let\pgfplots@yticklabel=\pgfplots@user@ticklabel@list@y }, + % #1 table name or macro + % #2 column name (or alias or create on use) + /pgfplots/yticklabels from table/.code 2 args={% + \pgfplotstablegetcolumn{#2}\of{#1}\to\pgfplots@yticklabels + \let\pgfplots@yticklabel=\pgfplots@user@ticklabel@list@y + }, + /pgfplots/yticklabels from table/.belongs to family=/pgfplots/tick, /pgfplots/yticklabel/.store in= \pgfplots@yticklabel, /pgfplots/yticklabel/.belongs to family=/pgfplots/tick, /pgfplots/yticklabel=, @@ -461,6 +808,13 @@ \pgfplots@foreach@to@list{#1}\to\pgfplots@zticklabels \let\pgfplots@zticklabel=\pgfplots@user@ticklabel@list@z }, + % #1 table name or macro + % #2 column name (or alias or create on use) + /pgfplots/zticklabels from table/.code 2 args={% + \pgfplotstablegetcolumn{#2}\of{#1}\to\pgfplots@zticklabels + \let\pgfplots@zticklabel=\pgfplots@user@ticklabel@list@z + }, + /pgfplots/zticklabels from table/.belongs to family=/pgfplots/tick, /pgfplots/zticklabel/.store in= \pgfplots@zticklabel, /pgfplots/zticklabel/.belongs to family=/pgfplots/tick, /pgfplots/zticklabel=, @@ -522,11 +876,12 @@ /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/tick scale binop/.initial=\cdot, + /pgfplots/xtick scale label code/.code={$\pgfkeysvalueof{/pgfplots/tick scale binop} 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/.code={$\pgfkeysvalueof{/pgfplots/tick scale binop} 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/.code={$\pgfkeysvalueof{/pgfplots/tick scale binop} 10^{#1}$}, /pgfplots/ztick scale label code/.belongs to family=/pgfplots/tick, /pgfplots/tick scale label code/.style={% /pgfplots/xtick scale label code={#1}, @@ -539,7 +894,7 @@ /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}$}}}, + \pgfkeys{/pgfplots/xtick scale label code/.code={$\pgfkeysvalueof{/pgfplots/tick scale binop} \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}}}, @@ -551,7 +906,7 @@ /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}$}}}, + \pgfkeys{/pgfplots/ytick scale label code/.code={$\pgfkeysvalueof{/pgfplots/tick scale binop} \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}}}, @@ -563,7 +918,7 @@ /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}$}}}, + \pgfkeys{/pgfplots/ztick scale label code/.code={$\pgfkeysvalueof{/pgfplots/tick scale binop} \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}}}, @@ -611,12 +966,19 @@ /pgfplots/try min ticks log/.estore in= \pgfplots@default@try@minticks@log, /pgfplots/try min ticks log/.belongs to family=/pgfplots/tick, /pgfplots/try min ticks log=3, + /pgfplots/log basis x/.initial=, + /pgfplots/log basis y/.initial=, + /pgfplots/log basis z/.initial=, + /pgfplots/log base x/.style={log basis x={#1}},% + /pgfplots/log base y/.style={log basis y={#1}},% + /pgfplots/log base z/.style={log basis z={#1}},% /pgfplots/log plot exponent style/.style={/pgf/number format/fixed,/pgf/number format/precision=2}, /pgfplots/log plot exponent style/.belongs to family=/pgfplots/tick, /pgfplots/log identify minor tick positions/.is if=pgfplots@identify@log@minor@tick@pos, /pgfplots/log identify minor tick positions/.belongs to family=/pgfplots/tick, /pgfplots/log identify minor tick positions=false, - /pgfplots/log number format code/.code={{% + /pgfplots/log number format code/.code={% + \begingroup \pgfmathlogtologten@{#1}% \ifpgfplots@identify@log@minor@tick@pos \expandafter\pgfplots@is@log@tick@a@minor@tick@pos\pgfmathresult\relax% @@ -628,10 +990,25 @@ \else \pgfkeysalso{/pgfplots/log plot exponent style,/pgfplots/log base 10 number format code=\pgfmathresult}% \fi - }}, + \endgroup + }, /pgfplots/log number format code/.belongs to family=/pgfplots/tick, - /pgfplots/log base 10 number format code/.code={$10^{\pgfmathprintnumber{#1}}$}, + /pgfplots/log base 10 number format code/.code={{\pgfplots@invoke@pgfkeyscode{/pgfplots/log number format basis/.@cmd}{{10}{#1}}}}, /pgfplots/log base 10 number format code/.belongs to family=/pgfplots/tick, + % #1 = basis + % #2 = exponent + /pgfplots/log number format basis/.code 2 args={$#1^{\pgfmathprintnumber{#2}}$}, + % takes #1 = [xyz]: + /pgfplots/log basis ticks/.style={% + /pgfplots/every #1 tick label/.append style={% + /pgfplots/log number format code/.code={% + \begingroup + \pgfkeysalso{/pgfplots/log plot exponent style}% + \pgfplots@invoke@pgfkeyscode{/pgfplots/log number format basis/.@cmd}{{\pgfkeysvalueof{/pgfplots/log basis #1}}{####1}}% + \endgroup + }% + }% + }, % sets \pgfplots@[xy]tickposnum to /pgfplots/xtick pos/.is choice, /pgfplots/xtick pos/.belongs to family=/pgfplots/tick, @@ -670,43 +1047,55 @@ /pgfplots/ztick pos={#1} }, /pgfplots/tickpos/.belongs to family=/pgfplots/tick, -% sets the tick LABEL position, \pgfplots@[xy]ticklabelaxisspec + /pgfplots/tick pos/.style={/pgfplots/tickpos={#1}}, +% sets the tick LABEL position, \pgfplots@[xy]ticklabel@pos % to one of -% default : 0 -% left : 1 -% right : 3 - /pgfplots/xticklabel pos/.code={\pgfplots@setticklabelpos@for x{#1}}, +% lower (alias left alias bottom) : l +% upper (alias right alias top) : u +% default: uses one matches 'tick pos' + /pgfplots/xticklabel pos/.code={\pgfplots@setkey@ticklabelpos{x}{#1}}, /pgfplots/xticklabel pos/.belongs to family=/pgfplots/tick, - /pgfplots/xticklabel pos/default/.code ={\def\pgfplots@xticklabelaxisspec{}}, - /pgfplots/xticklabel pos/default/.belongs to family=/pgfplots/tick, - /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@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/.code={\pgfplots@setticklabelpos@for y{#1}}, + /pgfplots/yticklabel pos/.code={\pgfplots@setkey@ticklabelpos{y}{#1}}, /pgfplots/yticklabel pos/.belongs to family=/pgfplots/tick, - /pgfplots/yticklabel pos/default/.code ={\def\pgfplots@yticklabelaxisspec{}}, - /pgfplots/yticklabel pos/default/.belongs to family=/pgfplots/tick, - /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@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/zticklabel pos/.code={\pgfplots@setticklabelpos@for z{#1}}, + /pgfplots/zticklabel pos/.code={\pgfplots@setkey@ticklabelpos{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/ticklabelpos/.style={/pgfplots/ticklabel pos={#1}}, + /pgfplots/ticklabel pos/.style={ /pgfplots/xticklabel pos={#1}, /pgfplots/yticklabel pos={#1}, - % /pgfplots/zticklabel pos={#1}, + /pgfplots/zticklabel pos={#1}, }, + % This feature is more or less deprecated. + % The choice 'auto' should always use 'near ticklabel'. + % + % Choices are + % 'auto' (value 0), + % 'near ticklabel' (value 1), + % 'tikz' (value 2) + % with values stored in \pgfplots@ticklabel@anchor@[xyz] + /pgfplots/xticklabel anchor/.code={\pgfplots@setticklabel@anchor@for x{#1}}, + /pgfplots/xticklabel anchor/.belongs to family=/pgfplots/tick, + /pgfplots/yticklabel anchor/.code={\pgfplots@setticklabel@anchor@for y{#1}}, + /pgfplots/yticklabel anchor/.belongs to family=/pgfplots/tick, + /pgfplots/zticklabel anchor/.code={\pgfplots@setticklabel@anchor@for z{#1}}, + /pgfplots/zticklabel anchor/.belongs to family=/pgfplots/tick, + /pgfplots/ticklabel anchor/.style={ + /pgfplots/xticklabel anchor={#1}, + /pgfplots/yticklabel anchor={#1}, + /pgfplots/zticklabel anchor={#1} + }, + /pgfplots/ticklabel anchor=auto, + /pgfplots/xticklabel shift/.initial=, + /pgfplots/yticklabel shift/.initial=, + /pgfplots/zticklabel shift/.initial=, + /pgfplots/ticklabel shift/.style={ + /pgfplots/xticklabel shift={#1}, + /pgfplots/yticklabel shift={#1}, + /pgfplots/zticklabel shift={#1} + },% % sets \pgfplots@{x,y}tickalignnum to % inside=0 % outside=1 @@ -867,6 +1256,12 @@ % legend options: /pgfplots/legend entries/.initial={}, /pgfplots/legend entries/.belongs to family=/pgfplots/legend, + /pgfplots/legend pos/.is choice, + /pgfplots/legend pos/south west/.style={/pgfplots/legend style={at={(0.03,0.03)},anchor=south west}}, + /pgfplots/legend pos/south east/.style={/pgfplots/legend style={at={(0.97,0.03)},anchor=south east}}, + /pgfplots/legend pos/north west/.style={/pgfplots/legend style={at={(0.03,0.97)},anchor=north west}}, + /pgfplots/legend pos/north east/.style={/pgfplots/legend style={at={(0.97,0.97)},anchor=north east}}, + /pgfplots/legend pos/outer north east/.style={/pgfplots/legend style={at={(1.03,1)},anchor=north west}}, /pgfplots/legend columns/.store in=\pgfplots@legend@columns, /pgfplots/legend columns/.belongs to family=/pgfplots/legend, /pgfplots/legend columns=1, @@ -879,28 +1274,36 @@ /pgfplots/legend plot pos/none/.code= {\def\pgfplots@legend@plot@pos{2}}, /pgfplots/legend plot pos/none/.belongs to family=/pgfplots/legend, /pgfplots/legend plot pos=left, - /pgfplots/legend image code/.code={% - \draw[#1,mark repeat=2,mark phase=2] - plot coordinates { - (0cm,0cm) - (0.3cm,0cm) - (0.6cm,0cm)% - };% - }, + /pgfplots/line legend/.style={% + /pgfplots/legend image code/.code={% + \draw[mark repeat=2,mark phase=2,##1] + plot coordinates { + (0cm,0cm) + (0.3cm,0cm) + (0.6cm,0cm)% + };% + }% + }, + /pgfplots/line legend, /pgfplots/legend image code/.belongs to family=/pgfplots/legend, + /pgfplots/reverse legend/.is if=pgfplots@reverse@legend, + /pgfplots/reverse legend/.default=true, % axis description options: /pgfplots/title/.initial=, - /pgfplots/title/.belongs to family=/pgfplots/descriptions, /pgfplots/xlabel/.initial=, - /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/xlabel shift/.initial=0pt, + /pgfplots/ylabel shift/.initial=0pt, + /pgfplots/zlabel shift/.initial=0pt, + /pgfplots/label shift/.style={% + /pgfplots/xlabel shift={#1}, + /pgfplots/ylabel shift={#1}, + /pgfplots/zlabel shift={#1}, + },% /pgfplots/before end axis/.code=, /pgfplots/after end axis/.code=, /pgfplots/extra description/.code=, - /pgfplots/extra description/.belongs to family=/pgfplots/descriptions, % axis options: /pgfplots/at/.code={% \pgfplots@assert@tikzinternal@exists{tikz@scan@one@point}% @@ -911,6 +1314,8 @@ /pgfplots/clip limits=true, /pgfplots/clip limits/.belongs to family=/pgfplots, /pgfplots/clip/.is if=pgfplots@clip, + % will be used if it exists: + %/pgfplots/axis background/.style={}, /pgfplots/axis equal/.is if=pgfplots@axis@equal, /pgfplots/axis equal/.default=true, /pgfplots/axis equal image/.is if=pgfplots@axis@equal@image, @@ -969,6 +1374,71 @@ /pgfplots/y filter/.belongs to family=/pgfplots, /pgfplots/z filter/.code={}, /pgfplots/z filter/.belongs to family=/pgfplots, + /pgfplots/filter point/.code=, + /pgfplots/restrict x to domain/.style={/pgfplots/@restrict to domain={x}{}{#1}},% + /pgfplots/restrict y to domain/.style={/pgfplots/@restrict to domain={y}{}{#1}},% + /pgfplots/restrict z to domain/.style={/pgfplots/@restrict to domain={z}{}{#1}},% + /pgfplots/restrict expr to domain/.style 2 args={/pgfplots/@restrict to domain={x}{#1}{#2}},% + % '#1': the filter to install + % '#2': a mathematical expression (or empty) + % '#3': the interval. must be numeric currently. + /pgfplots/@restrict to domain/.code args={#1#2#3}{% + \edef\pgfplots@loc@TMPa{#3}% + % when invoked, ##1 and ##2 will be floats: + \def\pgfplots@loc@TMPb##1:##2\relax{% + \pgfkeysalso{% + /pgfplots/unbounded coords=jump,% + /pgfplots/#1 filter/.append code={% + \let\pgfplots@restrict@to@domain@orig=\pgfmathresult + \def\pgfplots@restrict@to@domain@tmp{#2}% + \ifx\pgfplots@restrict@to@domain@tmp\pgfutil@empty + % we don't have an expression. + \pgfmathfloatparsenumber{\pgfmathresult}% + \else + % evaluate the expression! + \pgfmathparse{#2}% + \fi + \let\pgfplots@restrict@to@domain@tmp=\pgfmathresult + \pgfmathfloatlessthan@{\pgfplots@restrict@to@domain@tmp}{##1}% ##1 is the lower argument + \ifpgfmathfloatcomparison + \def\pgfmathresult{inf}% + \else + \pgfmathfloatgreaterthan@{\pgfplots@restrict@to@domain@tmp}{##2}% + \ifpgfmathfloatcomparison + \def\pgfmathresult{-inf}% + \else + \let\pgfmathresult=\pgfplots@restrict@to@domain@orig + \fi + \fi + }% + }% + }% + % when invoked, ##1 and ##2 will be the user-supplied args. + \def\pgfplots@loc@TMPc##1:##2\relax{% + \pgfmathfloatparsenumber{##1}% + \let\pgfplots@rangea=\pgfmathresult + \pgfmathfloatparsenumber{##2}% + \edef\pgfplots@loc@TMPc{\pgfplots@rangea:\pgfmathresult}% + \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPc\relax + }% + \expandafter\pgfplots@loc@TMPc\pgfplots@loc@TMPa\relax + },% + % -> keeps only the nth point, all other ones will get ''. + /pgfplots/each nth point/.style 2 args={% + /pgfplots/x filter/.append code={% + \ifnum\coordindex=0 + \def\c@pgfplots@eachnthpoint@xfilter{0}% + \edef\c@pgfplots@eachnthpoint@xfilter@cmp{#1}% + \else + \pgfplotsutil@advancestringcounter\c@pgfplots@eachnthpoint@xfilter + \ifx\c@pgfplots@eachnthpoint@xfilter@cmp\c@pgfplots@eachnthpoint@xfilter + \def\c@pgfplots@eachnthpoint@xfilter{0}% + \else + \let\pgfmathresult\pgfutil@empty + \fi + \fi + }% + }, /pgfplots/skip coords between index/.style 2 args={% /pgfplots/x filter/.append code={% \ifnum\coordindex<#1\relax @@ -978,6 +1448,7 @@ \fi \fi} }, + /pgfplots/translate gnuplot/.is if=pgfplots@translategnuplot, /pgfplots/xfilter/.initial=,% DEPRECATED /pgfplots/yfilter/.initial=,% DEPRECATED /pgfplots/zfilter/.initial=,% DEPRECATED @@ -989,27 +1460,30 @@ % else % use 'samples at' /pgfplots/domain/.initial=,% empty -> use value of /tikz/domain! see \pgfplots@validate@plot@domain@arguments + /pgfplots/y domain/.initial=,% means: use the same as 'domain' + /pgfplots/domain y/.style={/pgfplots/y domain={#1}}, /pgfplots/samples at/.initial=,% empty -> use value of /tikz/samples at! /pgfplots/samples/.initial=,% empty -> use /tikz/samples! + /pgfplots/samples y/.initial=,% empty -> use the same as 'samples'. For use in mesh plots. + /pgfplots/variable y/.initial=\y,% % and provide aliases in the '/pgfplots/' tree to avoid - % search path problems just for these two options: + % search path problems just for the following 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/id/.code={\pgfkeysalso{/tikz/id={#1}}}, + /pgfplots/prefix/.code={\pgfkeysalso{/tikz/prefix={#1}}}, + /pgfplots/raw gnuplot/.code={\pgfkeysalso{/tikz/raw gnuplot={#1}}}, + % + /pgfplots/width/.initial=,% /pgfplots/width/.belongs to family=/pgfplots, - /pgfplots/width=, - /pgfplots/height/.store in= \pgfplots@height, + /pgfplots/height/.initial=,% /pgfplots/height/.belongs to family=/pgfplots, - /pgfplots/height=, - /pgfplots/execute at begin plot/.store in=\pgfplots@execute@at@begin@plot, - /pgfplots/execute at begin plot/.belongs to family=/pgfplots, - /pgfplots/execute at begin plot=, - /pgfplots/execute at end plot/.store in= \pgfplots@execute@at@end@plot, - /pgfplots/execute at end plot/.belongs to family=/pgfplots, - /pgfplots/execute at end plot=, + /pgfplots/execute at begin plot/.initial=, + /pgfplots/execute at begin plot@@/.initial=,% an internal variant + /pgfplots/execute at end plot/.initial=, + /pgfplots/execute at end plot@@/.initial=,% an internal variant /pgfplots/enlarge x limits/.initial=auto, /pgfplots/enlarge x limits/.default=true, /pgfplots/enlarge y limits/.initial=auto, @@ -1028,35 +1502,72 @@ /pgfplots/y/.belongs to family=/pgfplots, /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/x dir/.code={\pgfplots@setkey@axisdir@for x{#1}},% + /pgfplots/y dir/.code={\pgfplots@setkey@axisdir@for y{#1}},% + /pgfplots/z dir/.code={\pgfplots@setkey@axisdir@for z{#1}},% + /pgfplots/x dir=normal,% + /pgfplots/y dir=normal,% + /pgfplots/z dir=normal,% + /pgfplots/allow reversal of rel axis cs/.is if=pgfplots@allow@reversal@of@rel@axis@cs,% + /pgfplots/allow reversal of rel axis cs/.default=true,% + /pgfplots/allow reversal of rel axis cs=true,% + /pgfplots/plot box ratio/.initial={1}{1}{1},% + /pgfplots/view/az/.initial=25,% + /pgfplots/view/h/.code={\pgfkeyssetvalue{/pgfplots/view/az}{#1}},% + /pgfplots/view/el/.initial=30,% + /pgfplots/view/v/.code={\pgfkeyssetvalue{/pgfplots/view/el}{#1}},% + /pgfplots/view/.style 2 args={% + /pgfplots/view/az={#1},% + /pgfplots/view/el={#2}% + },% + /pgfplots/cycle list/.code={% + \pgfplots@assign@list\autoplotspeclist{#1}% + \expandafter\let\csname pgfp@cyclist@auto@\endcsname=\autoplotspeclist + \pgfkeyssetvalue{/pgfplots/cycle multi list/@dim}{0}% de-activate. }, - /pgfplots/view={}{}, - /pgfplots/cycle list/.code={\pgfplots@assign@list\autoplotspeclist{#1}}, /pgfplots/cycle list/.belongs to family=/pgfplots, /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?}% - }{% + \pgfplotsifcyclelistexists{#1}{% \expandafter\let\expandafter\autoplotspeclist\csname pgfp@cyclist@\string#1@\endcsname + \expandafter\let\csname pgfp@cyclist@auto@\endcsname=\autoplotspeclist + \pgfkeyssetvalue{/pgfplots/cycle multi list/@dim}{0}% de-activate. + }{% + \pgfplots@error{Sorry, there is no such cycle list named \string#1. Maybe you misspelled it?}% }% }, /pgfplots/cycle list name/.belongs to family=/pgfplots, /pgfplots/cycle list name=color, + % accepts arguments of the form + % <first list spec>\nextlist <second list spec>\nextlist .... + % where each list spec is EITHER a cycle list name OR a cycle list + % argument. + /pgfplots/cycle multi list/.code={\pgfplots@cycle@multi@list{#1}}, + % #1: list index + % #2: maximum number of elements to use + /pgfplots/cycle multi list/partial sublist/.code 2 args={% + \ifnum#1<\pgfkeysvalueof{/pgfplots/cycle multi list/@dim} + \ifnum#2<\pgfkeysvalueof{/pgfplots/cycle multi list/@totalN#1} + \pgfkeyssetvalue{/pgfplots/cycle multi list/@N#1}{#2}% + \fi + \else + \pgfplots@error{Sorry, the first argument of `cycle multi list/partial sublist=<list index><num elems>' is no valid list index (should be less than \pgfkeysvalueof{/pgfplots/cycle multi list/@dim}).}% + \fi + },% + /pgfplots/cycle multi list/@dim/.initial=0, + %/pgfplots/cycle multi list/@list0/.style={}, + %/pgfplots/cycle multi list/@N0/.initial=0,% + %/pgfplots/cycle multi list/@totalN0/.initial=0,% /pgfplots/legend style/.belongs to family=/pgfplots/style commands, /pgfplots/legend style/.code={% \pgfkeysalso{/pgfplots/every axis legend/.append style={#1}}% }, + /pgfplots/every forget plot/.code={},% + /pgfplots/forget plot style/.style={/pgfplots/every forget plot/.append style={#1}}, /pgfplots/label style/.belongs to family=/pgfplots/style commands, - /pgfplots/label style/.code={% - \pgfkeysalso{/pgfplots/every axis label/.append style={#1}}% + /pgfplots/label style/.style={% + /pgfplots/every axis x label/.append style={#1},% + /pgfplots/every axis y label/.append style={#1},% + /pgfplots/every axis z label/.append style={#1}% },% /pgfplots/x label style/.belongs to family=/pgfplots/style commands, /pgfplots/x label style/.code={% @@ -1092,15 +1603,15 @@ }, /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}}% + \pgfkeysalso{/pgfplots/every x tick scale label/.append style={#1}}% }, /pgfplots/y tick scale label style/.belongs to family=/pgfplots/style commands, /pgfplots/y tick scale label style/.code={% - \pgfkeysalso{/pgfplots/every y scale tick label/.append style={#1}}% + \pgfkeysalso{/pgfplots/every y tick scale 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}}% + \pgfkeysalso{/pgfplots/every z tick scale label/.append style={#1}}% }, /pgfplots/tick style/.belongs to family=/pgfplots/style commands, /pgfplots/tick style/.code={% @@ -1219,7 +1730,7 @@ /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/.is if=pgfplots@hide@z, /pgfplots/hide z axis/.default=true, /pgfplots/hide z axis=false, /pgfplots/hide axis/.style={% @@ -1239,9 +1750,9 @@ y axis line style={-stealth} }, /pgfplots/every non boxed z axis/.style={% - ytick align=center, + ztick align=center, enlarge z limits=false, - y axis line style={-stealth} + z axis line style={-stealth} }, /pgfplots/every boxed x axis/.style={}, /pgfplots/every boxed y axis/.style={}, @@ -1254,11 +1765,13 @@ % top=3 /pgfplots/axis x line*/.is choice, /pgfplots/axis x line*/box/.code ={\def\pgfplots@xaxislinesnum{0}\def\pgfplots@xtickposnum{0}}, - /pgfplots/axis x line*/bottom/.code ={\def\pgfplots@xaxislinesnum{1}\def\pgfplots@xtickposnum{1}}, - /pgfplots/axis x line*/middle/.code ={\def\pgfplots@xaxislinesnum{2}\def\pgfplots@xtickposnum{2}}, + /pgfplots/axis x line*/bottom/.code ={\def\pgfplots@xaxislinesnum{1}\def\pgfplots@xtickposnum{1}\let\pgfplots@xticklabel@pos\pgfutil@empty}, + /pgfplots/axis x line*/left/.style={/pgfplots/axis x line*/bottom}, + /pgfplots/axis x line*/middle/.code ={\def\pgfplots@xaxislinesnum{2}\def\pgfplots@xtickposnum{2}\let\pgfplots@xticklabel@pos\pgfutil@empty}, /pgfplots/axis x line*/center/.style ={/pgfplots/axis x line*/middle}, - /pgfplots/axis x line*/top/.code ={\def\pgfplots@xaxislinesnum{3}\def\pgfplots@xtickposnum{3}}, - /pgfplots/axis x line*/none/.code ={\def\pgfplots@xaxislinesnum{4}\def\pgfplots@xtickposnum{4}}, + /pgfplots/axis x line*/top/.code ={\def\pgfplots@xaxislinesnum{3}\def\pgfplots@xtickposnum{3}\let\pgfplots@xticklabel@pos\pgfutil@empty}, + /pgfplots/axis x line*/right/.style={/pgfplots/axis x line*/top}, + /pgfplots/axis x line*/none/.code ={\def\pgfplots@xaxislinesnum{4}\def\pgfplots@xtickposnum{4}\let\pgfplots@xticklabel@pos\pgfutil@empty}, /pgfplots/axis x line*=box, % /pgfplots/axis x line/.is choice, @@ -1270,6 +1783,7 @@ /pgfplots/axis x line*/bottom, /pgfplots/every non boxed x axis }, + /pgfplots/axis x line/left/.style={/pgfplots/axis x line/bottom},% /pgfplots/axis x line/middle/.code ={% \ifnum\pgfplots@yaxislinesnum=3 % if 'axis y line==right' then \pgfkeysalso{/pgfplots/every axis x label/.style={at={(current axis.left of origin)},anchor=south west}}% @@ -1280,6 +1794,7 @@ /pgfplots/every non boxed x axis}% }, /pgfplots/axis x line/center/.style ={/pgfplots/axis x line/middle}, + /pgfplots/axis x line/right/.style={/pgfplots/axis x line/top},% /pgfplots/axis x line/top/.code ={ \ifnum\pgfplots@yaxislinesnum=2 % if 'axis y line==center' then \pgfkeysalso{ @@ -1298,11 +1813,11 @@ % right=3 /pgfplots/axis y line*/.is choice, /pgfplots/axis y line*/box/.code ={\def\pgfplots@yaxislinesnum{0}\def\pgfplots@ytickposnum{0}}, - /pgfplots/axis y line*/left/.code ={\def\pgfplots@yaxislinesnum{1}\def\pgfplots@ytickposnum{1}}, - /pgfplots/axis y line*/center/.code ={\def\pgfplots@yaxislinesnum{2}\def\pgfplots@ytickposnum{2}}, + /pgfplots/axis y line*/left/.code ={\def\pgfplots@yaxislinesnum{1}\def\pgfplots@ytickposnum{1}\let\pgfplots@yticklabel@pos\pgfutil@empty}, + /pgfplots/axis y line*/center/.code ={\def\pgfplots@yaxislinesnum{2}\def\pgfplots@ytickposnum{2}\let\pgfplots@yticklabel@pos\pgfutil@empty}, /pgfplots/axis y line*/middle/.style ={/pgfplots/axis y line*/center}, - /pgfplots/axis y line*/right/.code ={\def\pgfplots@yaxislinesnum{3}\def\pgfplots@ytickposnum{3}}, - /pgfplots/axis y line*/none/.code ={\def\pgfplots@yaxislinesnum{4}\def\pgfplots@ytickposnum{4}}, + /pgfplots/axis y line*/right/.code ={\def\pgfplots@yaxislinesnum{3}\def\pgfplots@ytickposnum{3}\let\pgfplots@yticklabel@pos\pgfutil@empty}, + /pgfplots/axis y line*/none/.code ={\def\pgfplots@yaxislinesnum{4}\def\pgfplots@ytickposnum{4}\let\pgfplots@yticklabel@pos\pgfutil@empty}, /pgfplots/axis y line*=box, % /pgfplots/axis y line/.is choice, @@ -1334,6 +1849,7 @@ \pgfkeysalso{ axis y line*/right, %every axis y label/.style={at={(1,1)},anchor=north west,xshift=15pt}, + % FIXME : DEPRECATED !? USE 'near tick' things .... every axis y label/.style={at={(1,0.5)},xshift=33pt,rotate=90}, /pgfplots/every non boxed y axis }% @@ -1347,11 +1863,11 @@ % 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*/left/.code ={\def\pgfplots@zaxislinesnum{1}\def\pgfplots@ztickposnum{1}\let\pgfplots@zticklabel@pos\pgfutil@empty}, + /pgfplots/axis z line*/center/.code ={\def\pgfplots@zaxislinesnum{2}\def\pgfplots@ztickposnum{2}\let\pgfplots@zticklabel@pos\pgfutil@empty}, /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*/right/.code ={\def\pgfplots@zaxislinesnum{3}\def\pgfplots@ztickposnum{3}\let\pgfplots@zticklabel@pos\pgfutil@empty}, + /pgfplots/axis z line*/none/.code ={\def\pgfplots@zaxislinesnum{4}\def\pgfplots@ztickposnum{4}\let\pgfplots@zticklabel@pos\pgfutil@empty}, /pgfplots/axis z line*=box, % /pgfplots/axis z line/.is choice, @@ -1364,13 +1880,13 @@ /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 + % \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 + % \fi \pgfkeysalso{% /pgfplots/axis z line*/center, /pgfplots/every non boxed z axis}% @@ -1384,10 +1900,30 @@ 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/every non boxed z axis }% },% /pgfplots/axis z line/none/.style ={axis z line*/none,hide z axis}, + /pgfplots/axis lines/.style={% + axis x line=#1,% + axis y line=#1,% + axis z line=#1% + }, + /pgfplots/axis lines*/.style={% + axis x line*=#1,% + axis y line*=#1,% + axis z line*=#1% + }, + /pgfplots/3d box/.is choice, + /pgfplots/3d box/background/.code ={\def\pgfplots@threedimbox@choice{0}},% + /pgfplots/3d box/complete/.code ={\def\pgfplots@threedimbox@choice{1}},% + /pgfplots/3d box/complete*/.code ={\def\pgfplots@threedimbox@choice{2}},% + /pgfplots/3d box/.default=complete,% + /pgfplots/3d box/background,% + /pgfplots/every 3d box foreground/.style={}, + /pgfplots/3d box foreground style/.style={% + /pgfplots/every 3d box foreground/.append style={#1}% + }, % set \pgfplots@xaxisdiscontnum % none = 0 % crunch = 1 @@ -1535,6 +2071,91 @@ \pgfusepath{stroke}}% }; }, + /pgfplots/every node near coord/.style={}, + % values: 'horizontal', 'vertical' or any tikz alignment command + % like 'left' or 'anchor=south west' or so. + /pgfplots/nodes near coords align/.initial=auto,% + % + % 'nodes near coords=<content of node>'. + % The content is by default \pgfmathprintnumber\pgfplotspointmeta. + % + % Use 'point meta=y' after 'nodes near coords' to typeset the y coordinates + % Use 'point meta=x' to typeset the x coordinates + /pgfplots/nodes near coords/.style={% + /pgfplots/scatter/@pre marker code/.code={},% + /pgfplots/scatter/@post marker code/.code={},% + /pgfplots/nodes near coords*={#1},% + },% + /pgfplots/nodes near coords*/.style={% + /pgfplots/scatter/true*,% + /pgfplots/set point meta if empty=f(x),% + scatter/@post marker code/.append code={% + % determine default alignment: + \pgfkeysgetvalue{/pgfplots/nodes near coords align}{\pgfplots@nodes@near@coords@align}% + \edef\pgfplots@nodes@near@coords@align{\pgfplots@nodes@near@coords@align}% + \def\pgfplots@loc@TMPa{auto}% + \ifx\pgfplots@nodes@near@coords@align\pgfplots@loc@TMPa + \ifx\pgfplotspointmetainputhandler x% + % point meta=x: + \def\pgfplots@nodes@near@coords@align{horizontal}% + \else + \def\pgfplots@nodes@near@coords@align{vertical}% + \fi + \fi + % check for sign-dependand alignment options: + \def\pgfplots@loc@TMPa{horizontal}% + \ifx\pgfplots@nodes@near@coords@align\pgfplots@loc@TMPa + \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname% + \def\pgfplots@nodes@near@coords@align{above}% + \else + \pgfmathfloatifflags{\pgfplotspointmeta}{2}{% + % \pgfplotspointmeta < 0 + \def\pgfplots@nodes@near@coords@align{left}% + }{% + % \pgfplotspointmeta >= 0 + \def\pgfplots@nodes@near@coords@align{right}% + }% + \fi + \else + \def\pgfplots@loc@TMPa{vertical}% + \ifx\pgfplots@nodes@near@coords@align\pgfplots@loc@TMPa + \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname% + \def\pgfplots@nodes@near@coords@align{above}% + \else + \pgfmathfloatifflags{\pgfplotspointmeta}{2}{% + % \pgfplotspointmeta < 0 + \def\pgfplots@nodes@near@coords@align{below}% + }{% + % \pgfplotspointmeta >= 0 + \def\pgfplots@nodes@near@coords@align{above}% + }% + \fi + \fi + \fi + % ok, place the node. + \expandafter\node\expandafter[\pgfplots@nodes@near@coords@align,% + /pgfplots/every node near coord] + at (0pt,0pt) + {% + \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname% + % point meta=explicit symbolic + % do no try to invoke \pgfmathprintnumber on + % symbolic data... this check should keep the user + % interface simpler. + \def\pgfplots@loc@TMPa{\pgfmathprintnumber\pgfplotspointmeta}% + \def\pgfplots@loc@TMPb{#1}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \pgfplotspointmeta + \else + #1% + \fi + \else + #1% + \fi + }; + },% + },% + /pgfplots/nodes near coords*/.default={\pgfmathprintnumber\pgfplotspointmeta}, /pgfplots/bar cycle list/.style={/pgfplots/cycle list={% {blue,fill=blue!30!white,mark=none},% {red,fill=red!30!white,mark=none},% @@ -1553,10 +2174,14 @@ area legend, axis on top, }, + /pgfplots/ybar legend/.style={ + /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=3pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0cm,0.8em) (2*\pgfplotbarwidth,0.6em)};}, + }, /pgfplots/ybar/.style={ bar cycle list, xtick align=outside, - /pgfplots/legend image code/.code={\draw[##1,bar width=3pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0cm,0.8em) (2*\pgfplotbarwidth,0.6em)};}, + ybar legend, + /pgfplots/set point meta if empty=f(x),% /pgf/bar shift={% % total width = n*w + (n-1)*skip % -> subtract half for centering @@ -1574,14 +2199,19 @@ \pgfusepath{stroke}}% }; },% + /pgfplots/every node near coord/.append style={xshift={\pgfkeysvalueof{/pgf/bar shift}}},% /tikz/ybar, }, /pgfplots/ybar/.default=2pt, /pgfplots/ybar/.belongs to family=/pgfplots, + /pgfplots/xbar legend/.style={ + /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=3pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0cm,0.8em) (2*\pgfplotbarwidth,0.6em)};}, + }, /pgfplots/xbar/.style={ bar cycle list, ytick align=outside, - /pgfplots/legend image code/.code={\draw[##1,bar width=3pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0cm,0.8em) (2*\pgfplotbarwidth,0.6em)};}, + /pgfplots/xbar legend, + /pgfplots/set point meta if empty=x,% /pgf/bar shift={% % total width = n*w + (n-1)*skip % -> subtract half for centering @@ -1599,30 +2229,39 @@ \pgfusepath{stroke}}% }; },% + /pgfplots/every node near coord/.append style={yshift={\pgfkeysvalueof{/pgf/bar shift}}},% /tikz/xbar, }, /pgfplots/xbar/.default=2pt, /pgfplots/xbar/.belongs to family=/pgfplots, + /pgfplots/ybar interval legend/.style={ + /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,yshift=-0.2em,bar interval width=0.7,bar interval shift=0.5] plot coordinates {(0cm,0.8em) (5pt,0.6em) (10pt,0.6em)};}, + }, /pgfplots/ybar interval/.style={% + /pgfplots/set point meta if empty=f(x),% bar cycle list, x tick label as interval, xmajorgrids, xtick align=outside, - % xtick=data, - /pgfplots/legend image code/.code={\draw[##1,yshift=-0.2em,bar interval width=0.7,bar interval shift=0.5] plot coordinates {(0cm,0.8em) (5pt,0.6em) (10pt,0.6em)};}, + xtick=data, + ybar interval legend, bar interval width={#1/\numplots}, bar interval shift={(\plotnum+0.5)/\numplots}, /tikz/ybar interval, }, /pgfplots/ybar interval/.default=1, /pgfplots/ybar interval/.belongs to family=/pgfplots, + /pgfplots/xbar interval legend/.style={% + /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,yshift=-0.2em,bar interval width=0.7,bar interval shift=0.5] plot coordinates {(0cm,0.8em) (5pt,0.6em) (10pt,0.6em)};}, + }, /pgfplots/xbar interval/.style={% + /pgfplots/set point meta if empty=x,% bar cycle list, y tick label as interval, - % ytick=data, + ytick=data, ymajorgrids, ytick align=outside, - /pgfplots/legend image code/.code={\draw[##1,yshift=-0.2em,bar interval width=0.7,bar interval shift=0.5] plot coordinates {(0cm,0.8em) (5pt,0.6em) (10pt,0.6em)};}, + xbar interval legend, bar interval width={#1/\numplots}, bar interval shift={(\plotnum+0.5)/\numplots}, /tikz/xbar interval, @@ -1630,6 +2269,7 @@ /pgfplots/xbar interval/.default=1, /pgfplots/xbar interval/.belongs to family=/pgfplots, /pgfplots/xbar stacked/.style={ + /pgfplots/set point meta if empty=x,% bar cycle list, stack plots=x, stack dir=#1, @@ -1638,6 +2278,7 @@ /pgfplots/xbar stacked/.default=plus, /pgfplots/xbar stacked/.belongs to family=/pgfplots, /pgfplots/ybar stacked/.style={ + /pgfplots/set point meta if empty=f(x),% bar cycle list, stack plots=y, stack dir=#1, @@ -1646,6 +2287,7 @@ /pgfplots/ybar stacked/.default=plus, /pgfplots/ybar stacked/.belongs to family=/pgfplots, /pgfplots/xbar interval stacked/.style={ + /pgfplots/set point meta if empty=x,% bar cycle list, stack plots=x, stack dir=#1, @@ -1654,6 +2296,7 @@ /pgfplots/xbar interval stacked/.default=plus, /pgfplots/xbar interval stacked/.belongs to family=/pgfplots, /pgfplots/ybar interval stacked/.style={ + /pgfplots/set point meta if empty=f(x),% bar cycle list, stack plots=y, stack dir=#1, @@ -1671,10 +2314,9 @@ }, /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/plot file/ignore first/.style={/pgfplots/plot file/skip first={#1}}, + /pgfplots/plot file/.search also=/pgfplots,% + /pgfplots/plot coordinates/math parser/.is if=pgfplots@plot@coords@mathparser, /pgfplots/plot graphics/.code={\let\tikz@plot@handler=\pgfplotsplothandlergraphics},% /pgfplots/plot graphics/src/.initial=, /pgfplots/plot graphics/includegraphics/.initial=, @@ -1684,6 +2326,9 @@ /pgfplots/plot graphics/ymax/.initial=, /pgfplots/plot graphics/zmin/.initial=, /pgfplots/plot graphics/zmax/.initial=, + /pgfplots/plot graphics/lowlevel draw/.code 2 args={% + \pgfplots@plot@handler@graphics@DRAW{#1}{#2}% + },% /pgfplots/plot graphics/node/.style={ transform shape, inner sep=0pt, @@ -1693,6 +2338,92 @@ at={(0pt,0pt)}, rectangle }, + % 'mesh' plots. + % The macro \pgfplots@meshmode is + % n if meshmode == false, + % m if meshmode == 'mesh', + % s if meshmode == 'surf'. + % + % The type of surface plot can be configured with 'shader'. + /pgfplots/mesh/.is choice, + /pgfplots/mesh/true/.code={% + \def\pgfplots@meshmode{m}% + \let\tikz@plot@handler=\pgfplotsplothandlermesh + \pgfkeysalso{/pgfplots/set point meta if empty=f(x),/pgfplots/every mesh,/pgfplots/mesh legend,/tikz/color=mapped color}% + }, + /pgfplots/mesh/false/.code={ + \def\pgfplots@meshmode{n}% + \ifx\tikz@plot@handler\pgfplotsplothandlermesh + \let\tikz@plot@handler=\pgfplothandlerlineto + \fi}, + /pgfplots/mesh/.default=true, + /pgfplots/surf/.code={% + \pgfkeysalso{/pgfplots/mesh=#1}% + \def\pgfplots@meshmode{s}% + },% + /pgfplots/mesh/rows/.initial=, + /pgfplots/mesh/cols/.initial=, + /pgfplots/mesh/scanline verbose/.is if=pgfplots@scanline@verbose,% + /pgfplots/mesh/scanline verbose/.default=true, + /pgfplots/mesh/check/.code={% + \pgfplotsutilifstringequal{#1}{false}{% + \def\pgfplots@mesh@checkmode{0}% + }{% + \pgfplotsutilifstringequal{#1}{warning}{% + \def\pgfplots@mesh@checkmode{1}% + }{% + \pgfplotsutilifstringequal{#1}{error}{% + \def\pgfplots@mesh@checkmode{2}% + }{% + \pgfplots@error{Invalid value `#1' for /pgfplots/mesh/check. Please use one of false,warning,error}% + }% + }% + }% + },% + /pgfplots/mesh/check=error, + /pgfplots/mesh/ordering/.is choice, + /pgfplots/mesh/ordering/x varies/.code={\def\pgfplots@plot@mesh@ordering{0}}, + /pgfplots/mesh/ordering/y varies/.code={\def\pgfplots@plot@mesh@ordering{1}}, + /pgfplots/mesh/ordering/rowwise/.style={/pgfplots/mesh/ordering/x varies}, + /pgfplots/mesh/ordering/colwise/.style={/pgfplots/mesh/ordering/y varies}, + /pgfplots/mesh/ordering/x varies, + /pgfplots/every mesh/.code={% + % is slower: + %\pgfkeysalso{/pgfplots/unbounded coords=jump}% mesh plots need balanced cols! + },% + /pgfplots/mesh legend/.style={% + /pgfplots/legend image code/.code={% + \pgfplotsplothandlermesh@defaultlegend@img{##1}% + }% + }, + /pgfplots/mesh/num points/.initial=\numcoords,% this is NOT part of the public interface. Don't change it. + /pgfplots/z buffer/.is choice,% + /pgfplots/z buffer/none/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{0}},% + /pgfplots/z buffer/reverse x seq/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{1}},% + /pgfplots/z buffer/reverse y seq/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{2}},% + /pgfplots/z buffer/reverse xy seq/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{3}},% + /pgfplots/z buffer/sort/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{4}},% + /pgfplots/z buffer/auto/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{5}},% + /pgfplots/z buffer/default/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{6}},% + /pgfplots/z buffer/default,% + % + % Set the shader used for surface plots. + % RULES: + % 1. meshmode == 'm' (mesh): + % This means we use "shader/flat" to determine the colors + % and ignore fill colors. + % 2. meshmode == 's' (surf): + % the shader specifies how colors are used. + % 3. Onedimensional mesh/surf plots are treated like 'mesh' + % plots. + /pgfplots/shader/.is choice, + /pgfplots/shader/flat corner/.code={\def\pgfplotsplothandlermesh@shader{0}\def\pgfplotsplothandlermesh@flatmode{c}}, + /pgfplots/shader/flat mean/.code={\def\pgfplotsplothandlermesh@shader{0}\def\pgfplotsplothandlermesh@flatmode{m}}, + /pgfplots/shader/flat/.style={/pgfplots/shader/flat mean},% + /pgfplots/shader/faceted/.code={\def\pgfplotsplothandlermesh@shader{1}}, + /pgfplots/shader/interp/.code={\def\pgfplotsplothandlermesh@shader{2}}, + /pgfplots/shader/faceted, + /pgfplots/faceted color/.initial=mapped color!80!black, /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, @@ -1700,47 +2431,115 @@ /pgfplots/every crossref picture/.style={% baseline,yshift=0.3em }, + /pgfplots/unbounded coords/.code={% + \edef\pgfplots@loc@TMPa{#1}% + \def\pgfplots@loc@TMPb{discard}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \def\pgfplots@unbounded@handler{d}% + \else + \def\pgfplots@loc@TMPb{jump}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \def\pgfplots@unbounded@handler{j}% + \else + \pgfplots@error{Sorry, the choice `#1' is unknown for \pgfkeyscurrentkey. Please use either 'discard' or 'jump'.}% + \fi + \fi + },% + /pgfplots/unbounded coords=discard, /pgfplots/x coord trafo/.code={}, /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}% + % + % #1 = {<symbol1>,<symbol2>,....<symboln>} + /pgfplots/symbolic coords/.code 2 args={% + \pgfplotsarraynew\pgfplots@symbolic@coords@inverse{#2}% + \pgfplotsarrayforeachungrouped\pgfplots@symbolic@coords@inverse\as\pgfplots@loc@TMPa{% + \expandafter\edef\csname pgfp@symb@coords@\pgfplots@loc@TMPa\endcsname{\pgfplotsarrayforeachindex}% + }% + \pgfkeysdef{/pgfplots/#1 coord trafo}{% + \pgfutil@ifundefined{pgfp@symb@coords@##1}{% + \pgfplots@error{Sorry, the input coordinate `##1' has not been defined with 'symbolic #1 coords={#2}... Maybe it has been misspelled?}% + \def\pgfmathresult{0}% + }{% + \edef\pgfmathresult{\csname pgfp@symb@coords@##1\endcsname}% + }% + }% + \pgfkeysdef{/pgfplots/#1 coord inv trafo}{% + \begingroup + % discard everything up to the period: + \pgfmath@basic@round@{##1}% + \afterassignment\pgfplots@gobble@until@relax + \count0=\pgfmathresult\relax + \ifnum\count0<0 + \count0=0 + \else + \count1=\pgfplotsarraysizeof\pgfplots@symbolic@coords@inverse\relax + \ifnum\count0<\count1 + \else + \count0=\count1 + \advance\count0 by-1 + \fi + \fi + \pgfplotsarrayselect\count0 \of\pgfplots@symbolic@coords@inverse\to\pgfmathresult + \pgfmath@smuggleone\pgfmathresult + \endgroup + }% + \pgfkeysalso{% + /pgfplots/#1ticklabel={\tick},% + /pgfplots/scaled #1 ticks=false,% + /pgfplots/plot coordinates/math parser=false,% + }% + },% + /pgfplots/symbolic x coords/.style={symbolic coords={x}{#1}},% + /pgfplots/symbolic y coords/.style={symbolic coords={y}{#1}},% + /pgfplots/symbolic z coords/.style={symbolic coords={z}{#1}},% +% Defines the class name \pgfplotspointmetainputhandler: + /pgfplots/point meta/.code={% + % this thing here converts control sequences to + % characters, they won't cause 'unknown control sequence' + % errors: + \def\pgfplots@loc@TMPa{#1}% + \pgfplots@command@to@string\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \pgfkeysifdefined{/pgfplots/point meta/\pgfplots@loc@TMPb/.@cmd}{% + \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/#1/.@cmd}{}% + }{% + \pgfplotssetpointmetainput{expr}{#1}% + }% + },% + /pgfplots/point meta/none/.code ={\pgfplotssetpointmetainput{}{}},% + /pgfplots/point meta/x/.code ={\pgfplotssetpointmetainput{x}{}},% + /pgfplots/point meta/y/.code ={\pgfplotssetpointmetainput{y}{}},% + /pgfplots/point meta/z/.code ={\pgfplotssetpointmetainput{z}{}},% + /pgfplots/point meta/explicit/.code={\pgfplotssetpointmetainput{explicit}{}},% + /pgfplots/point meta/explicit symbolic/.code={\pgfplotssetpointmetainput{explicit symbolic}{}},% + /pgfplots/point meta/f(x)/.code={ + \ifpgfplots@curplot@threedim + \pgfplotssetpointmetainput{z}{}% + \else + \pgfplotssetpointmetainput{y}{}% + \fi }, + /pgfplots/set point meta if empty/.code={% + \ifx\pgfplotspointmetainputhandler\pgfutil@empty + \pgfkeysalso{/pgfplots/point meta/#1}% + \fi + },% /pgfplots/point meta/none, + /pgfplots/point meta rel/.is choice, + /pgfplots/point meta rel/axis wide/.code={\def\pgfplots@perpointmeta@rel@choice{0}},% + /pgfplots/point meta rel/per plot/.code={\def\pgfplots@perpointmeta@rel@choice{1}},% + /pgfplots/point meta rel/axis wide,% + /pgfplots/point meta min/.initial=,% + /pgfplots/point meta max/.initial=,% /pgfplots/colormap name/.initial=hot, - /pgfplots/colormap/.code 2 args={ + /pgfplots/colormap access/.is choice, + /pgfplots/colormap access/direct/.code={\def\pgfplots@colormap@access{d}},% + /pgfplots/colormap access/map/.code={\def\pgfplots@colormap@access{m}},% + /pgfplots/colormap access/map,% + /pgfplots/colormap/.code 2 args={% \pgfplotscreatecolormap{#1}{#2}% \pgfkeysalso{/pgfplots/colormap name=#1}% }, @@ -1762,12 +2561,20 @@ /pgfplots/colormap/blackwhite/.style={ colormap={blackwhite}{gray(0cm)=(0); gray(1cm)=(1)} }, + /pgfplots/colormap/violet/.style={ + colormap={violet}{rgb255=(25,25,122) color=(white) rgb255=(238,140,238)} + }, /pgfplots/scatter/.is choice, /pgfplots/scatter/false/.code={% \pgfplots@scatterplotenabledfalse - }, + },% + /pgfplots/scatter/true*/.code={% + \pgfplots@scatterplotenabledtrue + \pgfkeysalso{/pgfplots/set point meta if empty=f(x)}% + },% /pgfplots/scatter/true/.code={% \pgfplots@scatterplotenabledtrue + \pgfkeysalso{/pgfplots/set point meta if empty=f(x)}% % make sure there is a mark set! \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% \def\pgfplots@loc@TMPa{none}% @@ -1781,7 +2588,7 @@ \fi }, /pgfplots/scatter/.default=true, - /pgfplots/scatter src/.style={/pgfplots/point meta=#1}, + /pgfplots/scatter src/.style={/pgfplots/point meta={#1}}, /tikz/scatter/.style={/pgfplots/scatter=#1}, % % ARGUMENTS: the macros @@ -1791,90 +2598,72 @@ % - \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}% + /pgfplots/scatter/@pre marker code/.code=,% + /pgfplots/scatter/@post marker code/.code=,% + /pgfplots/scatter/use mapped color/.style={% + /pgfplots/scatter/@pre marker code/.code=,% + /pgfplots/scatter/@post marker code/.code=,% + /pgfplots/scatter/use mapped color*={#1},% + },% + /pgfplots/scatter/use mapped color*/.style={ + /pgfplots/scatter/@pre marker code/.append code={ + \pgfplotscolormapdefinemappedcolor\pgfplotspointmetatransformed \scope[#1]% }, - /pgfplots/scatter/@post marker code/.code={\endscope} + /pgfplots/scatter/@post marker code/.prefix code={\endscope} }, - /pgfplots/scatter/use mapped color/.default={draw=mapped color!80!black,fill=mapped color}, - /pgfplots/scatter/use mapped color, + /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={% + /pgfplots/scatter/classes/.style={% + /pgfplots/scatter/@pre marker code/.code=,% + /pgfplots/scatter/@post marker code/.code=,% + /pgfplots/scatter/classes*={#1},% + },% + /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}% + \def\pgfplots@loc@TMPa##1=##2\pgfplots@EEOI{% + \expandafter\def\csname pgfp@scatter@class@##1\endcsname{##2}% }% - % 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 + \pgfplotsforeachentryinCSV{\pgfplots@loc@TMPb}{#1}{% + \expandafter\pgfplots@loc@TMPa\pgfplots@loc@TMPb\pgfplots@EEOI }% - % 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}% + % + \pgfkeysalso{% + /pgfplots/scatter/@pre marker code/.append code={\pgfplots@scatter@classes@pre@marker@code},% + /pgfplots/scatter/@post marker code/.prefix code={\endscope}% + }% + % Now:remember the classes. + \pgfkeyssetvalue{/pgfplots/scatter/classes/values}{#1}% + % + % and generate legend items for every single class, + % But ONLY if we really *have* a plot which uses + % scatter/classes! + \pgfkeys{/pgfplots/execute at begin plot@@/.add={}{% + \ifpgfplots@scatterplotenabled + \pgfkeysgetvalue{/pgfplots/scatter/@pre marker code/.@cmd}\pgfplots@loc@TMPa + \def\pgfplots@loc@TMPb{\pgfutil@in@{\pgfplots@scatter@classes@pre@marker@code}}% + \expandafter\pgfplots@loc@TMPb\expandafter{\pgfplots@loc@TMPa\pgfeov}% \ifpgfutil@in@ - \def\pgfplots@loc@TMPb####1.####2\relax{\def\pgfplotspointmeta{####1}}% - \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\relax + % modify '\pgfplots@rememberplotspec' such + % that it generates entries for every class: + \let\pgfplots@rememberplotspec@orig=\pgfplots@rememberplotspec + \def\pgfplots@rememberplotspec##1{% + \def\pgfplots@scatter@loc@TMPa####1=####2\pgfplots@EEOI{% + \pgfplots@rememberplotspec@orig{##1,####2}% + \pgfplots@rememberplotspec@for@label[####1]{##1,####2}% + }% + \pgfplotsforeachentryinCSV{\pgfplots@scatter@loc@TMPb}{#1}{% + \expandafter\pgfplots@scatter@loc@TMPa\pgfplots@scatter@loc@TMPb\pgfplots@EEOI + }% + }% \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 + \fi }% - \expandafter\scope\expandafter[\pgfplots@loc@TMPa]% }% - \pgfkeysdef{/pgfplots/scatter/@post marker code}{\endscope}% }, /pgfplots/refstyle/.code={% \pgfutil@ifundefined{pgfplots@labelstyle@#1}{% @@ -1905,7 +2694,82 @@ label style={font=\small}, /pgfplots/max space between ticks=15, every mark/.append style={mark size=8}, - ylabel style={yshift=-0.3cm}, + major tick length=0.1cm, + minor tick length=0.066cm, + %ylabel style={yshift=-0.3cm}, + }, + /pgfplots/cube/set size/.code 2 args={% + \expandafter\def\csname pgfplots@cube@gethalf@#1\endcsname{% + \afterassignment\pgfplots@gobble@until@relax + \pgfplots@tmpa=#2pt\relax + \pgfplotsconvertunittocoordinate #1{0.5\pgfplots@tmpa}% + }% + },% + /pgfplots/cube/size x/.style={/pgfplots/cube/set size=x{#1}}, + /pgfplots/cube/size y/.style={/pgfplots/cube/set size=y{#1}}, + /pgfplots/cube/size z/.style={/pgfplots/cube/set size=z{#1}}, + /pgfplots/cube/size x=\pgfplotmarksize, + /pgfplots/cube/size y=\pgfplotmarksize, + /pgfplots/cube/size z=\pgfplotmarksize, + /pgfplots/xtick placement tolerance/.initial=0.05pt, + /pgfplots/ytick placement tolerance/.initial=0.05pt, + /pgfplots/ztick placement tolerance/.initial=0.05pt, + /pgfplots/compat/anchors/.is choice, + /pgfplots/compat/anchors/pre 1.3/.code={\pgfplots@deprecated@anchorstrue},% FIXME: WAS \global + /pgfplots/compat/anchors/newest/.code= {\pgfplots@deprecated@anchorsfalse},% + /pgfplots/compat/anchors/default/.code={\pgfplots@deprecated@anchorsfalse},% + /pgfplots/compat/labels/.is choice, + /pgfplots/compat/labels/pre 1.3/.style={% + /pgfplots/xlabel absolute, + /pgfplots/ylabel absolute},% + /pgfplots/compat/labels/newest/.style={% + /pgfplots/xlabel near ticks, + /pgfplots/ylabel near ticks},% + /pgfplots/compat/labels/default/.style={/pgfplots/compat/labels/pre 1.3},% maintain backwards compatibility for labels :-( + /pgfplots/compat/.style={% + /pgfplots/compat/anchors=#1,% + /pgfplots/compat/labels=#1,% + },% + /pgfplots/compat/.default=pre 1.3,% + /pgfplots/compat=default,% + % + /pgfplots/show outer normals/.style={% + extra description/.append code={ + \def\length{5} + \draw[->,blue] \pgfextra{% + \pgfpathmoveto{#1} + \pgfpathlineto{% + \pgfpointadd + {#1} + {\pgfqpointscale{\length}{\pgfplotspointouternormalvectorofticklabelaxis{x}}}% + }% + }; + \draw[->,red] \pgfextra{% + \pgfpathmoveto{#1}% + \pgfpathlineto{% + \pgfpointadd + {#1} + {\pgfqpointscale{\length}{\pgfplotspointouternormalvectorofticklabelaxis{y}}}% + }% + }; + \ifpgfplots@threedim + \draw[->,black] \pgfextra{% + \pgfpathmoveto{#1}% + \pgfpathlineto{% + \pgfpointadd + {#1} + {\pgfqpointscale{\length}{\pgfplotspointouternormalvectorofticklabelaxis{z}}}% + }% + }; + \fi + }, + }, + /pgfplots/show outer normals/.default={% + \ifpgfplots@threedim + \pgfplotspointrelaxisxy{-0.03}{-0.03}% + \else + \pgfplotspointrelaxisxyz{-0.03}{-0.03}{-0.03}% + \fi }, } @@ -1931,6 +2795,7 @@ \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 ticklabel style=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; @@ -1970,6 +2835,11 @@ \pgfkeysgetvalue{/pgfplots/domain}\pgfplots@plot@domain \pgfkeysgetvalue{/pgfplots/samples at}\pgfplots@plot@samples@at \ifx\pgfplots@plot@domain\pgfutil@empty + % simply acquire /tikz/domain value: + \pgfplots@gettikzinternal@keyval{domain}{tikz@plot@domain}{-5:5}% + \pgfkeyslet{/pgfplots/domain}{\tikz@plot@domain}% + \let\pgfplots@plot@domain=\tikz@plot@domain + % \ifx\pgfplots@plot@samples@at\pgfutil@empty \if 1\pgfplots@loc@TMPa % Resample! See above. @@ -1981,12 +2851,11 @@ \else % routines should use \pgfplots@plot@samples@at. \fi - \else - % do that such that any active ':' sign will be expanded - for - % french babel support. - \edef\pgfplots@plot@domain{\pgfplots@plot@domain}% - \pgfkeyslet{/pgfplots/domain}\pgfplots@plot@domain \fi + % do that such that any active ':' sign will be expanded - for + % french babel support. + \edef\pgfplots@plot@domain{\pgfplots@plot@domain}% + \pgfkeyslet{/pgfplots/domain}\pgfplots@plot@domain }% \def\pgfplots@set@at#1{\def\pgfplots@at{#1}}% @@ -2005,12 +2874,36 @@ % #1 axis (x or y) % #2 the label \def\pgfplots@show@label#1#2{% + \begingroup + % Prepare special alignment features here. + % + % The idea is to: + % 1. Declare a local COORDINATE SYSTEM to place labels, + % the 'ticklabel cs' for the current axis. + % It takes 1-2 arguments where the first is the coordinate on the + % ticklabel axis (between 0 and 1). The second is an optional shift orthogonal to + % the axis in direction of the outer normal. The minimum shift is + % the largest' ticklabels dimension. + % + % 2. Declare a local ANCHOR to align labels, the 'near ticklabel' + % anchor. + % + % Both things are not necessary - but they *can* be used. + \tikzdeclarecoordinatesystem{ticklabel}{\pgfplotspointticklabelcs[\pgfkeysvalueof{/pgfplots/#1label shift}]{#1}{##1}}% + \pgfplotsdeclareborderanchorforticklabelaxis{#1}{near ticklabel}% + % + \pgfkeysgetvalue{/tikz/sloped/.@cmd}\pgfplots@loc@TMPa + \pgfkeyslet{/tikz/sloped/orig/.@cmd}\pgfplots@loc@TMPa + \pgfkeysdef{/tikz/sloped}{\pgfkeysalso{/tikz/sloped like #1 axis}}% + % \node [/pgfplots/every axis label,% /pgfplots/every axis #1 label] {#2}; + \endgroup } + \def\pgfplots@show@title#1{% \node% [/pgfplots/every axis title] @@ -2021,7 +2914,7 @@ % #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 + \if2\csname pgfplots@#1axislinesnum\endcsname \draw[/pgfplots/every inner #1 axis line,% decorate,% #1discont,% @@ -2039,11 +2932,13 @@ % draw separate lines. This here is necessary if we want arrow heads. % % #1: the 'a' axis on the oriented surface (the same as \pgfplotspointonorientedsurfaceA) -% #2: the 'b' axis on the orentied surface (the same as \pgfplotspointonorientedsurfaceB) +% #2: the 'b' axis on the oriented surface (the same as \pgfplotspointonorientedsurfaceB) \def\pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2{% + \if2\csname pgfplots@#1axislinesnum\endcsname + % centered axis lines handled elsewhere. + \else \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 { \pgfextra @@ -2051,26 +2946,7 @@ \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2min\endcsname}}% \endpgfextra }; - }{\relax}% - \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% - \draw decorate { - \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 { - \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 { \pgfextra @@ -2078,9 +2954,9 @@ \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2max\endcsname}}% \endpgfextra }; - }{\relax}% - \fi + }{}% \endscope + \fi }% % This here is complicated: we try to create good edges and draw a @@ -2097,6 +2973,8 @@ \draw[ /pgfplots/every outer x axis line, % FIXME! these outer styles need much more attention :-( /pgfplots/every outer y axis line] + % FIXME : replace this here with basic layer! This should also + % allow closed paths: (\pgfplots@xmin, \pgfplots@ymin) \ifpgfplots@hide@y { (\pgfplots@xmin, \pgfplots@ymax) } @@ -2189,28 +3067,79 @@ \fi }% -\def\pgfplots@rememberplotspec#1{% - \pgfplotslistpushbackglobal{#1}\to\pgfplots@plotspeclist +\def\pgfplots@rememberplotspec@for@label{\pgfutil@ifnextchar[{\pgfplots@rememberplotspec@for@label@}{\pgfplots@rememberplotspec@for@label@[]}}% +\def\pgfplots@rememberplotspec@for@label@[#1]#2{% + \expandafter\gdef\csname pgfplots@last@plot@style@#1\endcsname{#2}% + \global\pgfplots@has@label@informationtrue +}% +\def\pgfplots@rememberplotspec{\pgfutil@ifnextchar[{\pgfplots@rememberplotspec@opt}{\pgfplots@rememberplotspec@opt[]}}% +\def\pgfplots@rememberplotspec@opt[#1]#2{% + \pgfplots@rememberplotspec@for@label[#1]{#2}% + \pgfplotslistpushbackglobal{#2}\to\pgfplots@plotspeclist } \def\pgfplots@getautoplotspec into#1{% - \pgfplotslistsize\autoplotspeclist\to\c@pgf@counta - \ifnum\c@pgf@counta=0 - \let#1=\pgfutil@empty + \begingroup + \let#1=\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/cycle multi list/@dim}\pgfplots@cycle@dim + \ifnum\pgfplots@cycle@dim>0 + % use the 'cycle multi list' feature. + % + % it employs a scalar -> multiindex map like + % void fromScalar( size_t d, size_t scalar, size_t* Iout, const size_t* N ) + % { + % size_t ret=scalar; + % for( int i = d-1; i>=0; --i ) { + % Iout[i] = ret % N[i]; + % ret /= N[i]; + % } + % } + % to get the different indices into the cycle lists. + %-------------------------------------------------- + \c@pgf@counta=\pgfplots@cycle@dim + \c@pgf@countb=\pgfplots@numplots\relax + \advance\c@pgf@counta by-1 + \pgfplotsloop{% + \ifnum\c@pgf@counta<0 + \pgfplotsloopcontinuefalse + \else + \pgfplotsloopcontinuetrue + \fi + }{% + \pgfkeysgetvalue{/pgfplots/cycle multi list/@N\the\c@pgf@counta}\pgfplots@cycle@N + % compute list index: + \pgfplotsmathmodint{\c@pgf@countb}{\pgfplots@cycle@N}% + \divide\c@pgf@countb by \pgfplots@cycle@N\relax + % + \expandafter\pgfplots@getautoplotspec@ + \csname pgfp@cyclist@/pgfplots/cycle multi list/@list\the\c@pgf@counta @\endcsname + {\pgfplots@cycle@N}% + {\pgfmathresult}% + \t@pgfplots@toka=\expandafter{#1,}% + \t@pgfplots@tokb=\expandafter{\pgfplotsretval}% + \edef#1{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \advance\c@pgf@counta by-1 + }% \else - \c@pgf@countb=\pgfplots@numplots - % offset modulo size: - \pgfutil@loop - \ifnum\c@pgf@countb<\c@pgf@counta - \pgfplots@loop@CONTINUEfalse - \else - \pgfplots@loop@CONTINUEtrue - \fi - \ifpgfplots@loop@CONTINUE - \advance\c@pgf@countb by-\c@pgf@counta - \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}% + % normal cycle list: + \pgfplotslistsize\autoplotspeclist\to\c@pgf@countd + \pgfplots@getautoplotspec@{\autoplotspeclist}{\c@pgf@countd}{\pgfplots@numplots}% + \let#1=\pgfplotsretval + \fi + \pgfmath@smuggleone#1% + \endgroup +} +% #1: list name (macro!) +% #2: list size (integer register or value) +% #3: list element index +% +% defines \pgfplotsretval +\def\pgfplots@getautoplotspec@#1#2#3{% + \ifnum#2=0 + \let\pgfplotsretval=\pgfutil@empty + \else + \pgfplotsmathmodint{#3}{#2}% + \pgfplotslistselect\pgfmathresult\of#1\to\pgfplotsretval \fi } @@ -2290,38 +3219,31 @@ % #4: commands which should be executed after '#2 #3'. % \long\def\pgfplots@path@enqueue@coords#1#2#3#4{% - \ifpgfplots@draw@at@end - \pgfplotslistpushbackglobal{#1}{#2}{#3}{#4}\to\pgfplots@stored@plotlist - \else - \begingroup - #1#2#3#4% - \endgroup - \fi + \pgfplotslistpushbackglobal{#1}{#2}{#3}{#4}\to\pgfplots@stored@plotlist } -% The same as \pgfplots@path@enqueue@coords, but this here also stores -% \pgfplots@addplot@nonlegend@options -\long\def\pgfplots@addplot@enqueue@coords#1#2#3#4{% - \ifpgfplots@draw@at@end - \ifx\pgfplots@addplot@nonlegend@options\pgfutil@empty - \pgfplots@path@enqueue@coords{#1}{#2}{#3}{#4}% - \else - \expandafter - \pgfplots@path@enqueue@coords - \expandafter{% - \expandafter\pgfplotsset\expandafter{\pgfplots@addplot@nonlegend@options}% - #1}{#2}{#3}{#4}% - \fi - \else - \pgfplots@path@enqueue@coords{#1}{#2}{#3}{#4}% - \fi -} +% this was formerly slightly different than +% \pgfplots@path@enqueue@coords, but it is now the same. +\let\pgfplots@addplot@enqueue@coords=\pgfplots@path@enqueue@coords % Remembers the plotting command #1. \long\def\pgfplots@path@enqueue#1{% \pgfplots@path@enqueue@coords{}{}{#1}{}% } +% Use +%\begin{axis} +% \pgfplotsextra{ +% ... basic level commands or whatever... +% } +%\end{axis} +% to process the special commands by pgfplots. +% This is the same treatment as for TikZ \path commands: +% the commands will be processed as soon as the axis is finished- not +% before. +% +% In contrast to \path, \pgfplotsextra can contain any command(s). +\let\pgfplotsextra=\pgfplots@path@enqueue % Assigns a legend. @@ -2341,6 +3263,41 @@ \global\let\pgfplots@legend=\pgfplots@loc@TMPc } +\def\pgfplots@reverselegend{% + % Reverse \pgfplots@plotspeclist + \begingroup + \pgfplotslistnewempty\pgfplots@plotspeclist@reversed + \pgfplotslistforeachungrouped\pgfplots@plotspeclist\as\pgfplots@plotspeclisttmp{% + \expandafter\pgfplotslistpushfront\pgfplots@plotspeclisttmp\to\pgfplots@plotspeclist@reversed + }% + \global\let\pgfplots@plotspeclist=\pgfplots@plotspeclist@reversed + \let\pgfplots@legend@reversed=\relax + % + % Reverse \pgfplots@legend + \pgfplotslistnewempty\pgfplots@legend@reversed + \pgfplotslistforeachungrouped\pgfplots@legend\as\pgfplots@legendtmp{% + \expandafter\pgfplotslistpushfront\pgfplots@legendtmp\to\pgfplots@legend@reversed + }% + \global\let\pgfplots@legend=\pgfplots@legend@reversed + \endgroup +} + + +\def\pgfplots@addlegendentryexpanded{% + \pgfutil@ifnextchar[{% + \pgfplots@addlegendentryexpanded@opts + }{% + \pgfplots@addlegendentryexpanded@opts[]% + }% +} +\def\pgfplots@addlegendentryexpanded@opts[#1]#2{% + \begingroup + \let\protect=\noexpand + \edef\pgfplots@loc@TMPa{#2}% + \def\pgfplots@loc@TMPb{\pgfplots@addlegendentry@opts[#1]}% + \expandafter\pgfplots@loc@TMPb\expandafter{\pgfplots@loc@TMPa}% + \endgroup +}% \def\pgfplots@addlegendentry{% \pgfutil@ifnextchar[{% @@ -2357,18 +3314,17 @@ \globaldefs=1 \pgfplotslistcheckempty\pgfplots@plotspeclist \ifpgfplotslistempty - \let\pgfplots@curplotlist=\pgfutil@empty + \let\pgfplots@curplotlist=\relax \else \pgfplotslistpopfront\pgfplots@plotspeclist\to\pgfplots@curplotlist + \pgfplotslistcheckempty\pgfplots@legend + \ifpgfplotslistempty + \let\pgfplots@curlegend=\pgfutil@empty + \else + \pgfplotslistpopfront\pgfplots@legend\to\pgfplots@curlegend + \fi \fi % - \pgfplotslistcheckempty\pgfplots@legend - \ifpgfplotslistempty - \let\pgfplots@curlegend=\pgfutil@empty - \else - \pgfplotslistpopfront\pgfplots@legend\to\pgfplots@curlegend - \fi - \advance\pgfplots@numplots by-1 }} \def\pgfplots@try@mirror@plot@handler{% @@ -2386,13 +3342,12 @@ \long\def\pgfplots@show@small@legendplots#1#2{ \begingroup - \def\pgfplots@loc@TMPb{#1}% - \ifx\pgfplots@loc@TMPb\pgfutil@empty - \else - \pgfqkeys{/pgfplots/search path for tikz}{#1}% - \fi - \pgfkeysvalueof{/pgfplots/legend image code/.@cmd}#2\pgfeov + \pgfplots@define@currentplotstyle@as{#1,#2}% + \scope[/tikz/current plot style]% this scoping construction allows plot styles to change 'legend image code'. + \pgfkeysvalueof{/pgfplots/legend image code/.@cmd}\pgfeov + \endscope \endgroup + %\pgfkeysvalueof{/pgfplots/legend image code/.@cmd}{/pgfplots/.cd,#1,#2}\pgfeov } \def\pgfplots@split@opts{% @@ -2426,6 +3381,9 @@ \fi \ifpgfplotslistempty \else + \ifpgfplots@reverse@legend + \pgfplots@reverselegend + \fi % % \begingroup @@ -2459,9 +3417,14 @@ \curcolumnNum=0 \maxcolumnCount=\pgfplots@legend@columns\relax % - \pgfutil@loop - \ifnum0<\pgfplots@numplots\relax + \pgfplotsloop{% \pgfplots@pop@next@legend + \ifpgfplotslistempty + \pgfplotsloopcontinuefalse + \else + \pgfplotsloopcontinuetrue + \fi + }{% \ifx\pgfplots@curlegend\pgfutil@empty \else \advance\curcolumnNum by1 @@ -2494,12 +3457,13 @@ \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}% \else \pgfplotslistcheckempty\pgfplots@legend - \ifnum\pgfplots@numplots=0 - \pgfplotslistemptytrue + \ifpgfplotslistempty + \else + \pgfplotslistcheckempty\pgfplots@plotspeclist \fi \ifpgfplotslistempty % Ok, either the legend list is empty or - % there are no more plots. + % there are no more plot specifications. % % Finalize matrix: \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}% @@ -2517,7 +3481,7 @@ \fi \expandafter\t@pgfplots@toka\expandafter{\pgfplots@glob@TMPa}% \fi - \pgfutil@repeat + }% \t@pgfplots@tokb={\matrix[/pgfplots/every axis legend]}% \xdef\pgfplots@glob@TMPa{% \noexpand\def\noexpand\plotnum{0}% @@ -2558,115 +3522,134 @@ % DEPRECATED. \def\logtologtentomacro#1#2{% - \pgfmathmultiply@{#1}\reciproclogten% + \pgfmathlogtologten@{#1}% \expandafter\skipsuffixzero\pgfmathresult|% \let#2=\pgfmathresult } % DEPRECATED. \def\logtologten#1{% - \pgfmathmultiply@{#1}\reciproclogten% + \pgfmathlogtologten@{#1}% \expandafter\skipsuffixzero\pgfmathresult|% \pgfmathresult } +\pgfkeysdef{/pgfplots/@enlargelimits/true}{% + \def\bool@pgfplots@loc@enlargelimits@min{1}% + \def\bool@pgfplots@loc@enlargelimits@max{1}% +}% +\pgfkeysdef{/pgfplots/@enlargelimits/false}{% + \def\bool@pgfplots@loc@enlargelimits@min{0}% + \def\bool@pgfplots@loc@enlargelimits@max{0}% +}% +\pgfkeysdef{/pgfplots/@enlargelimits/upper}{% + \def\bool@pgfplots@loc@enlargelimits@min{0}% + \def\bool@pgfplots@loc@enlargelimits@max{1}% +}% +\pgfkeysdef{/pgfplots/@enlargelimits/lower}{% + \def\bool@pgfplots@loc@enlargelimits@min{1}% + \def\bool@pgfplots@loc@enlargelimits@max{0}% +}% +\pgfkeysdef{/pgfplots/@enlargelimits/auto}{% + \def\bool@pgfplots@loc@enlargelimits@min{0}% + \def\bool@pgfplots@loc@enlargelimits@max{0}% + \def\pgfplots@loc@TMPa{0}% + \ifpgfplots@threedim + \if\pgfplots@enlargelimits@curaxis z% + \def\pgfplots@loc@TMPa{1}% + \fi + \else + \def\pgfplots@loc@TMPa{1}% + \fi + \if1\pgfplots@loc@TMPa + \pgfplots@if{pgfplots@autocompute@\pgfplots@enlargelimits@curaxis min}{% + \def\bool@pgfplots@loc@enlargelimits@min{1}% + }{}% + \pgfplots@if{pgfplots@autocompute@\pgfplots@enlargelimits@curaxis max}{% + \def\bool@pgfplots@loc@enlargelimits@max{1}% + }{}% + \fi +}% +\pgfkeysdef{/pgfplots/@enlargelimits/value}{% + \pgfmathparse{#1}% + \let\pgfplots@enlargelimits@relthresh=\pgfmathresult + \let\pgfplots@enlargelimits@absthresh=\pgfutil@empty +}% +\pgfkeysdef{/pgfplots/@enlargelimits/rel}{\pgfkeysalso{true,value={#1}}}% +\pgfkeysdef{/pgfplots/@enlargelimits/abs value}{% + \begingroup + \pgfutil@namelet{pgfplots@datascaletrafo@\pgfplots@enlargelimits@curaxis}{pgfplots@datascaletrafo@\pgfplots@enlargelimits@curaxis @noshift}% + \expandafter\csname pgfplotstransformcoordinate\pgfplots@enlargelimits@curaxis\endcsname{#1}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let\pgfplots@enlargelimits@absthresh=\pgfmathresult + \let\pgfplots@enlargelimits@relthresh=\pgfutil@empty +}% +\pgfkeysdef{/pgfplots/@enlargelimits/abs}{\pgfkeysalso{true,abs value={#1}}}% +\pgfkeysdef{/pgfplots/@enlargelimits/.unknown}{\pgfkeysalso{true,value={\pgfkeyscurrentname}}}% + \def\pgfplots@enlarge@limit@ifconfigured#1{% - \pgfplots@enlargelimits@autofalse - \pgfplots@enlargelimitsfalse - \pgfplots@enlargelimits@rel@threshfalse + \begingroup + \def\bool@pgfplots@loc@enlargelimits@min{0}% + \def\bool@pgfplots@loc@enlargelimits@max{0}% + \def\pgfplots@enlargelimits@relthresh{0.1}% the default + \let\pgfplots@enlargelimits@absthresh=\pgfutil@empty + \def\pgfplots@enlargelimits@curaxis{#1}% + % \pgfkeysgetvalue{/pgfplots/enlarge #1 limits}{\pgfplots@loc@TMPa}% + \def\pgfplots@loc@TMPb{\pgfqkeys{/pgfplots/@enlargelimits}}% set the argument keys + \expandafter\pgfplots@loc@TMPb\expandafter{\pgfplots@loc@TMPa}% % - \def\pgfplots@loc@TMPb{true}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \pgfplots@enlargelimitstrue + \def\bool@pgfplots@loc@enlargeany{0}% + \if1\bool@pgfplots@loc@enlargelimits@min + \def\bool@pgfplots@loc@enlargeany{1}% \else - \def\pgfplots@loc@TMPb{false}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \else - \def\pgfplots@loc@TMPb{auto}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \pgfplots@enlargelimits@autotrue - \else - \begingroup - % try to read it as number: - \pgf@xa\pgfplots@loc@TMPa pt\relax - \endgroup - \pgfplots@enlargelimitstrue - \pgfplots@enlargelimits@rel@threshtrue - \fi + \if1\bool@pgfplots@loc@enlargelimits@max + \def\bool@pgfplots@loc@enlargeany{1}% \fi \fi - \expandafter\let\expandafter\ifpgfplots@autocompute@@@min\csname ifpgfplots@autocompute@#1min\endcsname - \expandafter\let\expandafter\ifpgfplots@autocompute@@@max\csname ifpgfplots@autocompute@#1max\endcsname - \ifpgfplots@enlargelimits - % relax the sizes. - % - % Idea: if the user chose his xmin,xmax tight to his data, - % this here will look better. + \if1\bool@pgfplots@loc@enlargeany \pgfplots@enlarge@limit@for{#1}% - \else - \ifpgfplots@enlargelimits@auto - %\ifpgfplots@hide@x - % there is no axis, so skip this enlargement (unless - % the user explizitly requests it) - % WHY!? - %\else - % FIXME : this here should be user-configurable! - \ifpgfplots@autocompute@@@min - \pgfplots@enlarge@limit@for{#1}% - \else - \ifpgfplots@autocompute@@@max - \pgfplots@enlarge@limit@for{#1}% - \fi - \fi - %\fi - \fi \fi + % assignments are made globally. + \endgroup } +% Helper method inside of \pgfplots@enlarge@limit@ifconfigured. +% +% It modifies '#1min' and '#1max' (globally!) according to the already prepared +% booleans. \def\pgfplots@enlarge@limit@for#1{% \begingroup - \expandafter\let\expandafter\pgfplots@@min\expandafter=\csname pgfplots@#1min\endcsname - \expandafter\let\expandafter\pgfplots@@max\expandafter=\csname pgfplots@#1max\endcsname - \expandafter\let\expandafter\ifpgfplots@autocompute@@@min\csname ifpgfplots@autocompute@#1min\endcsname - \expandafter\let\expandafter\ifpgfplots@autocompute@@@max\csname ifpgfplots@autocompute@#1max\endcsname - \ifpgfplots@enlargelimits@rel@thresh - \pgfkeysgetvalue{/pgfplots/enlarge #1 limits}{\enlargepercent}% + \expandafter\let\expandafter\pgfplots@@min\csname pgfplots@#1min\endcsname + \expandafter\let\expandafter\pgfplots@@max\csname pgfplots@#1max\endcsname + \ifx\pgfplots@enlargelimits@relthresh\pgfutil@empty + % we have an absolute enlarge value: + \let\enlargeabsolute=\pgfplots@enlargelimits@absthresh + \pgf@xb=\pgfplots@enlargelimits@absthresh pt \else - \def\enlargepercent{0.1}% FIXME : pack 10% as default into option 'enlargelimits' or so + % we have a relative enlarge value: + \pgfmathsubtract@\pgfplots@@max\pgfplots@@min% + \pgf@xa=\pgfmathresult pt + \pgf@xb=\pgfplots@enlargelimits@relthresh\pgf@xa + \edef\enlargeabsolute{\pgf@sys@tonumber{\pgf@xb}}% \fi - \pgfmathsubtract@\pgfplots@@max\pgfplots@@min% - \pgf@xa\pgfmathresult pt - \pgf@xb\enlargepercent\pgf@xa \ifdim\pgf@xb>0.001pt % the case with % enlargeabsolute ~= 0 % means that \pgfplots@@min ~= \pgfplots@@max. % It is handled in another method. - \edef\enlargeabsolute{\pgf@sys@tonumber{\pgf@xb}}% % - \ifpgfplots@enlargelimits@auto - \ifpgfplots@autocompute@@@min - \pgfmathsubtract@\pgfplots@@min\enlargeabsolute% - \let\pgfplots@@min=\pgfmathresult - \fi - \ifpgfplots@autocompute@@@max - \pgfmathadd@\pgfplots@@max\enlargeabsolute% - \let\pgfplots@@max=\pgfmathresult - \fi - \else - % compute xmin := xmin - enlargeabsolute + \if1\bool@pgfplots@loc@enlargelimits@min \pgfmathsubtract@\pgfplots@@min\enlargeabsolute% - \let\pgfplots@@min=\pgfmathresult + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult + \fi + \if1\bool@pgfplots@loc@enlargelimits@max \pgfmathadd@\pgfplots@@max\enlargeabsolute% - \let\pgfplots@@max=\pgfmathresult + \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi \fi - \xdef\pgfplots@glob@TMPa{\pgfplots@@min}% - \xdef\pgfplots@glob@TMPb{\pgfplots@@max}% \endgroup - \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfplots@glob@TMPa - \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfplots@glob@TMPb } @@ -2699,141 +3682,140 @@ % % 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@if{pgfplots@apply@datatrafo@#1}{% \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 % \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 - \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 + \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 + \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 - \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@width\relax - \else - \def\pgfplots@loc@TMPb{y}% + \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}% - \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 + % +%\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 - \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}% + %-------------------------------------------------- + % \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...}% +%\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 @@ -2849,15 +3831,15 @@ % ... 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]}% +%\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]}% +%\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]}% +%\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}% @@ -2869,7 +3851,7 @@ \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]}% +%\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}% @@ -2884,14 +3866,15 @@ % 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}% + \expandafter\pgfplotsutil@unify@short@csv@list\expandafter{\pgfplots@loc@TMPa}% + \t@pgfplots@toka=\expandafter{\pgfplotsretval}% \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'}% +%\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 @@ -2910,17 +3893,20 @@ % % Transform any explicit axis unit scalings: % WILL BE DONE LATER! - \else + }{% + % case apply trafo == false: \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}% + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@firstplot@coords@#1\endcsname + \expandafter\pgfplotsutil@unify@short@csv@list\expandafter{\pgfplots@loc@TMPa}% + \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplotsretval% % 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@isuniform @@ -2929,7 +3915,7 @@ \def\pgfplots@handle@invalid@range{% % COMPLETELY EMPTY AXIS: - \pgfplots@warning{You have a plot with empty range. Replacing it with default and clearing plots.}% + \pgfplots@warning{You have an axis with empty range. Replacing it with a default range and clearing all plots.}% \ifpgfplots@xislinear \pgfmathfloatcreate{0}{0.0}{0}% \global\let\pgfplots@xmin=\pgfmathresult @@ -2941,8 +3927,6 @@ \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 @@ -3079,6 +4063,11 @@ % \pgfplots@set@default@size@options % + \ifpgfplots@threedim + \pgfplotsthreedimtrue + \else + \pgfplotsthreedimfalse + \fi % \pgfplots@check@and@apply@datatrafo@for x% \pgfplots@check@and@apply@datatrafo@for y% @@ -3124,13 +4113,18 @@ \pgfplots@zminortickstrue \fi \fi - \pgfplots@enlarge@limit@ifconfigured y - \pgfplots@avoid@empty@axis@range@for y% + \pgfplots@enlarge@limit@ifconfigured z + \pgfplots@avoid@empty@axis@range@for z% \fi % % \pgfplots@initsizes % + % + \pgfplots@BEGIN@prepare@description@styles + % + % + % \pgfplots@isuniformticktrue \pgfplots@determinedefaultvalues@needs@check@uniformticktrue \ifx\pgfplots@xtick\pgfutil@empty @@ -3149,26 +4143,33 @@ \pgfplots@xminorgridsfalse \fi % - \ifx\pgfplots@xticklabelaxisspec\pgfutil@empty - \ifnum\pgfplots@xtickposnum=3 % right - \def\pgfplots@xticklabelaxisspec{v10}% - \else - \def\pgfplots@xticklabelaxisspec{v00}% - \fi + % + \ifx\pgfplots@xticklabel@pos\pgfutil@empty + \def\pgfplots@xticklabel@pos{% + \if3\pgfplots@xtickposnum% right + u% + \else + l% + \fi + }% \fi - \ifx\pgfplots@yticklabelaxisspec\pgfutil@empty - \ifnum\pgfplots@ytickposnum=3 % right - \def\pgfplots@yticklabelaxisspec{1v0}% - \else - \def\pgfplots@yticklabelaxisspec{0v0}% - \fi + \ifx\pgfplots@yticklabel@pos\pgfutil@empty + \def\pgfplots@yticklabel@pos{% + \if3\pgfplots@ytickposnum% right + u% + \else + l% + \fi + }% \fi - \ifx\pgfplots@zticklabelaxisspec\pgfutil@empty - \ifnum\pgfplots@ztickposnum=3 % right - \def\pgfplots@zticklabelaxisspec{01v}% - \else - \def\pgfplots@zticklabelaxisspec{00v}% - \fi + \ifx\pgfplots@zticklabel@pos\pgfutil@empty + \def\pgfplots@zticklabel@pos{% + \if3\pgfplots@ztickposnum% right + u% + \else + l% + \fi + }% \fi % \ifx\pgfplots@xticklabel\pgfutil@empty @@ -3246,8 +4247,51 @@ % % \pgfplots@prepare@ZERO@coordinates + % + \pgfplotspoint@initialisation + % + \pgfplots@decide@which@figure@surfaces@are@drawn + % + \pgfplots@define@threedim@marks + % + \pgfplots@clippath@prepare + % + \pgfplots@ticklabel@maxtickdimen@reset x% + \pgfplots@ticklabel@maxtickdimen@reset y% + \pgfplots@ticklabel@maxtickdimen@reset z% } +% Defines \pgfmathresult to be the desired width without axis labels. +% +\def\pgfplots@initsizes@get@width@withoutlabels{% + \pgfplots@initsizes@handle@label@const{\pgfplots@width}{45pt}{width}% +} + +% Defines \pgfmathresult to be the desired height without axis labels. +\def\pgfplots@initsizes@get@height@withoutlabels{% + \pgfplots@initsizes@handle@label@const{\pgfplots@height}{45pt}{height}% +} +\def\pgfplots@initsizes@handle@label@const#1#2#3{% + \begingroup + \pgf@xa=#1\relax + % EXPECTED WIDTH = X = \pgfplots@width + % ACTUAL WIDTH = c + x * (xmax-xmin) + % where c is a CONSTANT (for the axis labels/tick labels). + % -> \pgfplots@tmpXscale = (X - c) / (x *(xmax-xmin)) + % + % \pgf@xa := X-c: + \ifpgfplots@scale@only@axis + \else + \advance\pgf@xa by-#2 % FIXME determine 'c' correctly! + \fi + \ifdim\pgf@xa<0pt + \pgfplots@error{Error: Plot #3 `#1' is too small. This can't be realised while maintaining constant size for labels. Sorry, label sizes are only approximate. You will need to adjust your #3.}% + \pgf@xa=0pt + \fi + \edef\pgfmathresult{\the\pgf@xa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% % Helper method for initsizes. % @@ -3263,22 +4307,15 @@ % #2: the output argument for the SCALE. \def\pgfplots@initsizes@getXscale#1\into#2{% \begingroup - \pgf@xa=\pgfplots@width\relax + \pgfplots@initsizes@get@width@withoutlabels % EXPECTED WIDTH = X = \pgfplots@width % ACTUAL WIDTH = c + x * (xmax-xmin) % where c is a CONSTANT (for the axis labels/tick labels). % -> \pgfplots@tmpXscale = (X - c) / (x *(xmax-xmin)) % % \pgf@xa := X-c: - \ifpgfplots@scale@only@axis - \else - \advance\pgf@xa by-45pt% FIXME determine 'c' correctly! - \fi - \ifdim\pgf@xa<0pt - \pgfplots@error{Error: Plot width `\pgfplots@width' is too small. This can't be realised while maintaining constant width for y-labels. Sorry, label width are only approximate. You will need to adjust your width.}% - \pgf@xa=0pt - \fi % \pgf@xb := x*(xmax-xmin): + \pgf@xa=\pgfmathresult\relax \pgf@xb=#1\relax \pgfmathlog@invoke@expanded\pgfmathdivide@{% {\pgf@sys@tonumber\pgf@xa}% @@ -3297,22 +4334,9 @@ % The same as \pgfplots@initsizes@getXscale, just for the height. \def\pgfplots@initsizes@getYscale#1\into#2{% \begingroup - \pgf@xa=\pgfplots@height\relax - % EXPECTED WIDTH = X = \pgfplots@width - % ACTUAL WIDTH = c + x * (xmax-xmin) - % where c is a CONSTANT (for the axis labels/tick labels). - % -> \pgfplots@tmpXscale = (X - c) / (x *(xmax-xmin)) - % - % \pgf@xa := X-c: - \ifpgfplots@scale@only@axis - \else - \advance\pgf@xa by-45pt\relax% FIXME determine 'c' correctly! - \fi - \ifdim\pgf@xa<0pt - \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 + \pgfplots@initsizes@get@height@withoutlabels % \pgf@xb := y*(ymax-ymin): + \pgf@xa=\pgfmathresult\relax \pgf@xb=#1% \pgfmathlog@invoke@expanded\pgfmathdivide@{% {\pgf@sys@tonumber\pgf@xa}% @@ -3364,7 +4388,7 @@ \fi \fi \ifpgfplots@avoid@emptyrange@@range@is@approx@equal - \pgfplots@warning{Axis range for axis #1 is approximately equal; enlargeing it.}% + \pgfplots@warning{Axis range for axis #1 is approximately empty; enlargeing it.}% % the case \pgfplots@@min ~= \pgfplots@@max % % enlarge \pgfplots@@max and shrink \min: @@ -3477,6 +4501,18 @@ \pgfkeysgetvalue{/pgfplots/x}{\pgfplots@x}% \pgfkeysgetvalue{/pgfplots/y}{\pgfplots@y}% \pgfkeysgetvalue{/pgfplots/z}{\pgfplots@z}% + \pgfkeysgetvalue{/pgfplots/width}{\pgfplots@width}% + \pgfkeysgetvalue{/pgfplots/height}{\pgfplots@height}% + \ifx\pgfplots@width\pgfutil@empty + \else + \pgfmathparse{\pgfplots@width}% + \edef\pgfplots@width{\pgfmathresult pt}% + \fi + \ifx\pgfplots@height\pgfutil@empty + \else + \pgfmathparse{\pgfplots@height}% + \edef\pgfplots@height{\pgfmathresult pt}% + \fi % % CASES: % hasx := 'x' option non-empty @@ -3546,6 +4582,8 @@ \fi \fi \fi + \pgfkeyslet{/pgfplots/width}{\pgfplots@width}% + \pgfkeyslet{/pgfplots/height}{\pgfplots@height}% } % A helper method for \pgfplots@initsizes which @@ -3561,16 +4599,19 @@ % '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{% + \pgfkeysgetvalue{/pgfplots/#1 dir/value}\pgfplots@loc@dirvalue \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}% + \if r\pgfplots@loc@dirvalue + \edef\pgfplots@loc@TMPa{-#3}% + \fi \begingroup - \pgf@xa=#3\relax - \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% + \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! @@ -3582,19 +4623,32 @@ \pgfmathabs@{\pgfplots@glob@TMPb}% \or \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPa}}% - \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \ifdim\pgfplots@loc@TMPa=0pt + \def\pgfmathresult{0}% + \else + \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \fi \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!? + % coordinates. \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult - \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% - \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + \pgfplotsmath@ifzero{\pgfmathresult}{% + \expandafter\def\csname pgfplots@#1@inverseveclength\endcsname{infty}% + }{% + \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! % + \if r\pgfplots@loc@dirvalue + \def\pgfplots@loc@dirvalue{-}% + \else + \def\pgfplots@loc@dirvalue{}% + \fi % % 1. Check whether we have a complete vector of type (x,y): \expandafter\pgfutil@in@\expandafter(\expandafter{\pgfplots@loc@TMPb}% @@ -3604,38 +4658,49 @@ \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 ...}% + % FIXME : that's wrong for 3D axes! \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}}% + % + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \csname pgfplots@inverse@datascaletrafo@tofixed@#1@noshift\endcsname{\pgfplots@loc@TMPb}% + \let\pgfplots@loc@TMPb=\pgfmathresult + \csname pgfplots@inverse@datascaletrafo@tofixed@#1@noshift\endcsname{\pgfplots@loc@TMPc}% + \let\pgfplots@loc@TMPc=\pgfmathresult + }{}% + \csname pgfset#1vec\endcsname{% + \pgfqpoint + {\pgfplots@loc@dirvalue\pgfplots@loc@TMPb pt} + {\pgfplots@loc@dirvalue\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 + \pgfplotsmath@ifzero{\pgfmathresult}{% + \expandafter\def\csname pgfplots@#1@inverseveclength\endcsname{infty}% + }{% + \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 + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% \pgfmathparse{\csname pgfplots@#1\endcsname}% \expandafter\expandafter\csname pgfplots@inverse@datascaletrafo@tofixed@#1@noshift\endcsname\expandafter{\pgfmathresult}% \edef\pgfplots@loc@TMPb{\pgfmathresult pt}% - \fi + }{\relax}% \begingroup - \pgf@xa=\pgfplots@loc@TMPb\relax - \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% + \pgf@xa=\pgfplots@loc@TMPb\relax + \if r\pgfplots@loc@dirvalue + \multiply\pgf@xa by-1 + \fi + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% \endgroup \ifcase#2\relax \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPb}{0pt}}% @@ -3645,13 +4710,22 @@ \pgfmathabs@{\pgfplots@glob@TMPb}% \or \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPb}}% - \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \ifdim\pgfplots@loc@TMPb=0pt + \def\pgfmathresult{0}% + \else + \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \fi \fi \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult - \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% - \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + \pgfplotsmath@ifzero{\pgfmathresult}{% + \expandafter\def\csname pgfplots@#1@inverseveclength\endcsname{infty}% + }{% + \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + }% \fi \fi +%\message{-> got unitvector(#1) = (\the\csname pgf@#1x\endcsname, \the\csname pgf@#1y\endcsname).}% }% % Applies the 'axis equal' feature. @@ -3731,7 +4805,7 @@ \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. + % everytime the case here), we need to respect it here. % % We only need to respect the SCALING, translations (shifts) are % not interesting. @@ -3866,8 +4940,16 @@ % - final axis limits are given in transformed range % - \pgfplots@set@default@size@options has been invoked before % POSTCONDITION: -% - the current x- and y unit vectors are changed; -% - \pgfplots@[xy]coord{min,max}TEX are set +% - the current x,y and z unit vectors are defined properly; +% - the fast-access registers are initialised for the axis limits, +% - the following macros are assigned: +% \pgfplots@[xyz]@veclength +% \pgfplots@[xyz]@inverseveclength +% \pgfplotspointxaxis +% \pgfplotspointyaxis +% \pgfplotspointzaxis +% \pgfplotspointcenter +% \pgfplotspointminminmin % \def\pgfplots@initsizes{% % INIT. @@ -3930,18 +5012,39 @@ \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 + \pgfkeysgetvalue{/pgfplots/view/az}{\pgfplots@view@az}% + \pgfkeysgetvalue{/pgfplots/view/el}{\pgfplots@view@el}% + \ifpgfplots@threedim + \def\pgfplots@tmpZscale{1pt}% + \else + \def\pgfplots@tmpZscale{0pt}% + % FIXME + \let\pgfplots@view@el=\pgfutil@empty + \let\pgfplots@view@az=\pgfutil@empty + \def\pgfplots@view@dir@threedim@x{0}% + \def\pgfplots@view@dir@threedim@y{0}% + \def\pgfplots@view@dir@threedim@z{1}% + \fi + \ifx\pgfplots@view@az\pgfutil@empty + % FIXME : this does NOT work! it doesn't prepare the view@dir@threedim properly! \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 - \pgfplotssetaxesfrompitchyaw{\pgfplots@view@pitch}{\pgfplots@view@yaw}{\pgfplots@tmp@xisaxisparallel}% + \pgfplotssetaxesfromazel{\pgfplots@view@az}{\pgfplots@view@el}{\pgfplots@tmp@xisaxisparallel}% \if1\pgfplots@tmp@xisaxisparallel% \def\pgfplots@tmp@yisaxisparallel{1}% \fi \fi +%\message{Pgfplots debug: initialised unit vectors to x=(\the\pgf@xx,\the\pgf@xy), y=(\the\pgf@yx,\the\pgf@yy), z=(\the\pgf@zx,\the\pgf@zy). }% + % + \let\pgfplotsmathfloatviewdepthxyz@=\pgfplotsmathfloatviewdepthxyz@infigure + \let\pgfplotsmathviewdepthxyz@=\pgfplotsmathviewdepthxyz@infigure + % + \pgfplotsmath@ifzero{\pgfplots@x@veclength}{\pgfplots@hide@xtrue\pgfplots@shownothingof@xtrue}{}% + \pgfplotsmath@ifzero{\pgfplots@y@veclength}{\pgfplots@hide@ytrue\pgfplots@shownothingof@ytrue}{}% \ifpgfplots@threedim + \pgfplotsmath@ifzero{\pgfplots@z@veclength}{\pgfplots@hide@ztrue\pgfplots@shownothingof@ztrue}{}% \else \if1\pgfplots@tmp@xisaxisparallel% \if1\pgfplots@tmp@yisaxisparallel% @@ -3979,8 +5082,16 @@ % accurate. % \begingroup - \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% - \xdef\pgfplotspointsouthwest{\noexpand\pgf@x=\the\pgf@x\noexpand\relax\noexpand\pgf@y=\the\pgf@y}% + \ifpgfplots@threedim + \def\pgfplotspointmaxminmin{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}% + \def\pgfplotspointminmaxmin{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}% + \pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}% + \else + \def\pgfplotspointmaxminmin{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}% + \def\pgfplotspointminmaxmin{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}% + \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \fi + \xdef\pgfplotspointminminmin{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% % 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 @@ -3988,48 +5099,77 @@ \pgfplots@xcoordminTEX=\pgf@x \pgfplots@ycoordminTEX=\pgf@y % - \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% - \ifx\pgfplots@rectangle@width\pgfutil@empty - \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. - % - % and I am quite sure that this inaccuracy (and this - % work-around) only affects the - % final size, not the relative plot accuracy. - \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 - \def\pgfplots@tmp@xmin@ymax{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}% - \else - \pgf@x=\pgfplots@ycoordminTEX - \advance\pgf@x\pgfplots@height - \edef\pgfplots@tmp@xmin@ymax{\noexpand\pgfqpoint{\noexpand\pgfplots@xcoordminTEX}{\the\pgf@x}}% - \fi + %-------------------------------------------------- + % FIXME : WHAT IS THIS HERE FOR? + % \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% + % \ifx\pgfplots@rectangle@width\pgfutil@empty + % \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. + % % + % % and I am quite sure that this inaccuracy (and this + % % work-around) only affects the + % % final size, not the relative plot accuracy. + % \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 + % \def\pgfplots@tmp@xmin@ymax{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}% + % \else + % \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}% + {\pgfplotspointmaxminmin}% + \xdef\pgfplotspointxaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% \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}% + {\pgfplotspointminmaxmin}% + \xdef\pgfplotspointyaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% \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}% + {\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}% + \xdef\pgfplotspointzaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% \pgfmathveclen{\pgf@x}{\pgf@y}% \xdef\pgfplotspointzaxislength{\pgfmathresult pt}% + % + \pgfpointscale + {0.5}% + {\pgfplotspointxaxis + \pgf@xa=\pgf@x + \pgf@xb=\pgf@y + \pgfplotspointyaxis% + \advance\pgf@xa by\pgf@x + \advance\pgf@xb by\pgf@y + \pgfplotspointzaxis% + \advance\pgf@xa by\pgf@x + \advance\pgf@xb by\pgf@y + \pgf@x=\pgf@xa + \pgf@y=\pgf@xb + }% + \xdef\pgfplotspointcenter{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \else + \global\let\pgfplotspointzaxis=\pgfpointorigin + \gdef\pgfplotspointzaxislength{0pt}% + \pgfpointscale + {0.5}% + {\pgfpointadd + \pgfplotspointxaxis% + \pgfplotspointyaxis% + }% + \xdef\pgfplotspointcenter{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% \fi \endgroup } @@ -4040,50 +5180,47 @@ % See pgfplots@low@level@shape below. \pgfdeclareshape{pgfplots@low@level@shape@INNER}{% \nodeparts{image}% - \anchor{image}{% - \pgf@x=0pt - \pgf@y=0pt - }% - % - % - \anchor{center}{\pgfqpointxy{0.5}{0.5}}% - \anchor{north}{\pgfqpointxy{0.5}{1}}% - \anchor{north east}{\pgfqpointxy{1}{1}}% - \anchor{east}{\pgfqpointxy{1}{0.5}} - \anchor{south east}{\pgfqpointxy{1}{0}}% - \anchor{south}{\pgfqpointxy{0.5}{0}}% - \anchor{south west}{\pgfqpointxy{0}{0}}% - \anchor{west}{\pgfqpointxy{0}{0.5}}% - \anchor{north west}{\pgfqpointxy{0}{1}}% + \anchor{image}{\pgfpointorigin}% + % + % + \anchor{center}{\pgfplotsqpointdescriptionxy{0.5}{0.5}}% + \anchor{north}{\pgfplotsqpointdescriptionxy{0.5}{1}}% + \anchor{north east}{\pgfplotsqpointdescriptionxy{1}{1}}% + \anchor{east}{\pgfplotsqpointdescriptionxy{1}{0.5}} + \anchor{south east}{\pgfplotsqpointdescriptionxy{1}{0}}% + \anchor{south}{\pgfplotsqpointdescriptionxy{0.5}{0}}% + \anchor{south west}{\pgfplotsqpointdescriptionxy{0}{0}}% + \anchor{west}{\pgfplotsqpointdescriptionxy{0}{0.5}}% + \anchor{north west}{\pgfplotsqpointdescriptionxy{0}{1}}% %% - \anchor{origin}{\pgfplotspointORIGIN@tmp}% + \anchor{origin}{\pgfplotspointaxisorigin}% \anchor{above origin}{% \pgfpointintersectionoflines - {\pgfplotspointORIGIN@tmp} - {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfplotspointyaxis}} - {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointyaxis}} - {\pgfpointadd{\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointyaxis}}{\pgfplotspointxaxis}}% + {\pgfplotspointaxisorigin} + {\pgfpointadd{\pgfplotspointaxisorigin}{\pgfplotspointyaxis}} + {\pgfplotsqpointdescriptionxy{0}{1}} + {\pgfplotsqpointdescriptionxy{1}{1}}% }% \anchor{left of origin}{% \pgfpointintersectionoflines - {\pgfplotspointORIGIN@tmp} - {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfpointscale{-1}{\pgfplotspointxaxis}}} - {\pgfqpointxy{0}{0}} - {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointyaxis}}% + {\pgfplotspointaxisorigin} + {\pgfpointadd{\pgfplotspointaxisorigin}{\pgfplotspointxaxis}} + {\pgfplotsqpointdescriptionxy{0}{0}} + {\pgfplotsqpointdescriptionxy{0}{1}}% }% \anchor{right of origin}{% \pgfpointintersectionoflines - {\pgfplotspointORIGIN@tmp} - {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfplotspointxaxis}} - {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointxaxis}} - {\pgfpointadd{\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointxaxis}}{\pgfplotspointyaxis}}% + {\pgfplotspointaxisorigin} + {\pgfpointadd{\pgfplotspointaxisorigin}{\pgfplotspointxaxis}} + {\pgfplotsqpointdescriptionxy{1}{0}} + {\pgfplotsqpointdescriptionxy{1}{1}}% }% \anchor{below origin}{% \pgfpointintersectionoflines - {\pgfplotspointORIGIN@tmp} - {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfpointscale{-1}{\pgfplotspointyaxis}}} - {\pgfqpointxy{0}{0}} - {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointxaxis}}% + {\pgfplotspointaxisorigin} + {\pgfpointadd{\pgfplotspointaxisorigin}{\pgfplotspointyaxis}} + {\pgfplotsqpointdescriptionxy{0}{0}} + {\pgfplotsqpointdescriptionxy{1}{0}}% }% %% %% @@ -4111,10 +5248,9 @@ \savedanchor\lowerleftinnercorner{% \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}% }% - \savedanchor\xaxisvec{\pgfplotspointxaxis}% - \savedanchor\yaxisvec{\pgfplotspointyaxis}% + \savedanchor\innerdiagonal{\pgfplotspointbbdiagonal}% \savedanchor\origin{% - \pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ZERO@y\relax}% + \pgfplotspointaxisorigin }% % \nodeparts{image}% @@ -4127,43 +5263,45 @@ \anchor{center}{% \pgfpointadd {\lowerleftinnercorner}% - {\pgfpointscale{0.5}{\pgfpointadd{\xaxisvec}{\yaxisvec}}}% + {\pgfpointscale + {0.5} + {\innerdiagonal}}% }% \anchor{north}{% \pgfpointadd - {\lowerleftinnercorner}% - {\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}% + {\lowerleftinnercorner} + {\innerdiagonal\divide\pgf@x by2 }% }% \anchor{north east}{% \pgfpointadd - {\lowerleftinnercorner}% - {\pgfpointadd{\yaxisvec}{\xaxisvec}}% + \lowerleftinnercorner + \innerdiagonal }% \anchor{east}{% \pgfpointadd - {\lowerleftinnercorner}% - {\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}% + \lowerleftinnercorner + {\innerdiagonal\divide\pgf@y by2 }% }% \anchor{south east}{% \pgfpointadd - {\lowerleftinnercorner}% - {\xaxisvec}% + \lowerleftinnercorner + {\innerdiagonal\pgf@y=0sp }% }% \anchor{south}{% \pgfpointadd - {\lowerleftinnercorner}% - {\pgfpointscale{0.5}{\xaxisvec}}% + \lowerleftinnercorner + {\innerdiagonal\divide\pgf@x by2 \pgf@y=0sp }% }% \anchor{south west}{\lowerleftinnercorner}% \anchor{west}{% \pgfpointadd - {\lowerleftinnercorner}% - {\pgfpointscale{0.5}{\yaxisvec}}% - }% + \lowerleftinnercorner + {\innerdiagonal\pgf@x=0sp \divide\pgf@y by2 }% + } \anchor{north west}{% \pgfpointadd - {\lowerleftinnercorner}% - {\yaxisvec}% + \lowerleftinnercorner + {\innerdiagonal\pgf@x=0sp }% }% %% \anchor{origin}{% @@ -4172,30 +5310,30 @@ \anchor{above origin}{% \pgfpointintersectionoflines {\origin} - {\pgfpointadd{\origin}{\yaxisvec}} - {\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}} - {\pgfpointadd{\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}}{\xaxisvec}}% + {\pgfpointadd{\origin}{\innerdiagonal\pgf@x=0sp }} + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\pgf@x=0sp }} + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal}}% }% \anchor{left of origin}{% \pgfpointintersectionoflines {\origin} - {\pgfpointadd{\origin}{\pgfpointscale{-1}{\xaxisvec}}} + {\pgfpointadd{\origin}{\innerdiagonal\multiply\pgf@x by-1 \pgf@y=0sp }} {\lowerleftinnercorner} - {\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}}% + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\pgf@x=0sp }}% }% \anchor{right of origin}{% \pgfpointintersectionoflines {\origin} - {\pgfpointadd{\origin}{\xaxisvec}} - {\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}} - {\pgfpointadd{\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}}{\yaxisvec}}% + {\pgfpointadd{\origin}{\innerdiagonal\pgf@y=0sp }} + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\pgf@y=0sp }} + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal}}% }% \anchor{below origin}{% \pgfpointintersectionoflines {\origin} - {\pgfpointadd{\origin}{\pgfpointscale{-1}{\yaxisvec}}} + {\pgfpointadd{\origin}{\innerdiagonal\pgf@x=0sp \multiply\pgf@y by-1 }} {\lowerleftinnercorner} - {\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}}% + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\pgf@y=0sp }}% }% % %% @@ -4244,52 +5382,52 @@ \upperrightcorner \pgfutil@tempdima=\pgf@y \pgfpointadd - {\lowerleftinnercorner}% - {\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}% + {\lowerleftinnercorner} + {\innerdiagonal\divide\pgf@x by2 }% \pgf@y=\pgfutil@tempdima }% \anchor{above north east}{% \upperrightcorner \pgfutil@tempdima=\pgf@y \pgfpointadd - {\lowerleftinnercorner}% - {\pgfpointadd{\yaxisvec}{\xaxisvec}}% + \lowerleftinnercorner + \innerdiagonal \pgf@y=\pgfutil@tempdima }% \anchor{right of north east}{% \upperrightcorner \pgfutil@tempdima=\pgf@x \pgfpointadd - {\lowerleftinnercorner}% - {\pgfpointadd{\yaxisvec}{\xaxisvec}}% + \lowerleftinnercorner + \innerdiagonal \pgf@x=\pgfutil@tempdima }% \anchor{right of east}{% \upperrightcorner \pgfutil@tempdima=\pgf@x \pgfpointadd - {\lowerleftinnercorner}% - {\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}% + \lowerleftinnercorner + {\innerdiagonal\divide\pgf@y by2 }% \pgf@x=\pgfutil@tempdima }% \anchor{right of south east}{% \upperrightcorner \pgfutil@tempdima=\pgf@x \pgfpointadd - {\lowerleftinnercorner}% - {\xaxisvec}% + \lowerleftinnercorner + {\innerdiagonal\pgf@y=0sp }% \pgf@x=\pgfutil@tempdima }% \anchor{below south east}{% \pgfpointadd - {\lowerleftinnercorner}% - {\xaxisvec}% + \lowerleftinnercorner + {\innerdiagonal\pgf@y=0sp }% \pgf@y=0pt }% \anchor{below south}{% \pgfpointadd - {\lowerleftinnercorner}% - {\pgfpointscale{0.5}{\xaxisvec}}% + \lowerleftinnercorner + {\innerdiagonal\divide\pgf@x by2 \pgf@y=0sp }% \pgf@y=0pt }% \anchor{below south west}{% @@ -4302,22 +5440,22 @@ }% \anchor{left of west}{% \pgfpointadd - {\lowerleftinnercorner}% - {\pgfpointscale{0.5}{\yaxisvec}}% + \lowerleftinnercorner + {\innerdiagonal\pgf@x=0sp \divide\pgf@y by2 }% \pgf@x=0pt }% \anchor{left of north west}{% \pgfpointadd - {\lowerleftinnercorner}% - {\yaxisvec}% + \lowerleftinnercorner + {\innerdiagonal\pgf@x=0sp }% \pgf@x=0pt }% \anchor{above north west}{% \upperrightcorner \pgfutil@tempdima=\pgf@y \pgfpointadd - {\lowerleftinnercorner}% - {\yaxisvec}% + \lowerleftinnercorner + {\innerdiagonal\pgf@x=0sp }% \pgf@y=\pgfutil@tempdima }% %% @@ -4343,8 +5481,258 @@ \beforeforegroundpath{}% } -\def\pgfplots@draw@axis{% - % +\def\pgfplots@restore@deprecated@lowlevel@shape{% + \pgfutil@ifundefined{pgfplots@low@level@shape@deprecated@isdefined}{% + \gdef\pgfplots@low@level@shape@deprecated@isdefined{1}% + % + % all these assignments are global, so it is save to call this + % macro inside of scopes: + \pgfdeclareshape{pgfplots@low@level@shape@deprecated}{% + % The '(0,0)' point is the LOWER LEFT OUTER CORNER. + \savedanchor\upperrightcorner{ + \pgf@x=\wd\pgfnodepartimagebox + \pgf@y=\ht\pgfnodepartimagebox + }% + \savedanchor\lowerleftinnercorner{% + \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}% + }% + \savedanchor\xaxisvec{\pgfplotspointxaxis}% + \savedanchor\yaxisvec{\pgfplotspointyaxis}% + \savedanchor\origin{% + \pgfplotspointaxisorigin + }% + % + \nodeparts{image}% + \anchor{image}{% + \pgf@x=0pt % + \pgf@y=0pt % + }% + % + % + \anchor{center}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\pgfpointadd{\xaxisvec}{\yaxisvec}}}% + }% + \anchor{north}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}% + }% + \anchor{north east}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\xaxisvec}}% + }% + \anchor{east}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}% + }% + \anchor{south east}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\xaxisvec}% + }% + \anchor{south}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\xaxisvec}}% + }% + \anchor{south west}{\lowerleftinnercorner}% + \anchor{west}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\yaxisvec}}% + }% + \anchor{north west}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\yaxisvec}% + }% + %% + \anchor{origin}{% + \origin + }% + \anchor{above origin}{% + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\yaxisvec}} + {\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}} + {\pgfpointadd{\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}}{\xaxisvec}}% + }% + \anchor{left of origin}{% + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\pgfpointscale{-1}{\xaxisvec}}} + {\lowerleftinnercorner} + {\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}}% + }% + \anchor{right of origin}{% + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\xaxisvec}} + {\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}} + {\pgfpointadd{\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}}{\yaxisvec}}% + }% + \anchor{below origin}{% + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\pgfpointscale{-1}{\yaxisvec}}} + {\lowerleftinnercorner} + {\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}}% + }% + % + %% + % + \anchor{outer north}{% + \upperrightcorner + \pgf@x=.5\pgf@x + }% + \anchor{outer north east}{\upperrightcorner}% + \anchor{outer east}{% + \upperrightcorner + \pgf@y=.5\pgf@y + }% + \anchor{outer south east}{% + \upperrightcorner + \pgf@y=0pt + }% + \anchor{outer south}{% + \upperrightcorner + \pgf@x=.5\pgf@x + \pgf@y=0pt + }% + \anchor{outer south west}{% + \pgf@x=0pt + \pgf@y=0pt + }% + \anchor{outer west}{% + \upperrightcorner + \pgf@x=0pt + \pgf@y=.5\pgf@y + }% + \anchor{outer north west}{% + \upperrightcorner + \pgf@x=0pt + }% + \anchor{outer center}{% + \upperrightcorner + \pgf@x=.5\pgf@x + \pgf@y=.5\pgf@y + }% + % + % + %% + %% + \anchor{above north}{% + \upperrightcorner + \pgfutil@tempdima=\pgf@y + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}% + \pgf@y=\pgfutil@tempdima + }% + \anchor{above north east}{% + \upperrightcorner + \pgfutil@tempdima=\pgf@y + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\xaxisvec}}% + \pgf@y=\pgfutil@tempdima + }% + \anchor{right of north east}{% + \upperrightcorner + \pgfutil@tempdima=\pgf@x + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\xaxisvec}}% + \pgf@x=\pgfutil@tempdima + }% + \anchor{right of east}{% + \upperrightcorner + \pgfutil@tempdima=\pgf@x + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}% + \pgf@x=\pgfutil@tempdima + }% + \anchor{right of south east}{% + \upperrightcorner + \pgfutil@tempdima=\pgf@x + \pgfpointadd + {\lowerleftinnercorner}% + {\xaxisvec}% + \pgf@x=\pgfutil@tempdima + }% + \anchor{below south east}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\xaxisvec}% + \pgf@y=0pt + }% + \anchor{below south}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\xaxisvec}}% + \pgf@y=0pt + }% + \anchor{below south west}{% + \lowerleftinnercorner + \pgf@y=0pt + }% + \anchor{left of south west}{% + \lowerleftinnercorner + \pgf@x=0pt + }% + \anchor{left of west}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\yaxisvec}}% + \pgf@x=0pt + }% + \anchor{left of north west}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\yaxisvec}% + \pgf@x=0pt + }% + \anchor{above north west}{% + \upperrightcorner + \pgfutil@tempdima=\pgf@y + \pgfpointadd + {\lowerleftinnercorner}% + {\yaxisvec}% + \pgf@y=\pgfutil@tempdima + }% + %% + %% + \anchorborder{% + % Call a function that computes a border point. Since this + % function will modify dimensions like \pgf@x, we must move them to + % other dimensions. + \pgfutil@tempdima=\pgf@x + \pgfutil@tempdimb=\pgf@y + \pgfpointborderrectangle% + {\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdimb}}% + {\upperrightcorner}% + }% + \backgroundpath{% + \pgfkeysvalueof{/pgfplots/@backgroundpath@hook/.@cmd}\pgfeov + \pgfpathrectangle{\pgfpointorigin}{\upperrightcorner}% + }% + \foregroundpath{}% + \behindbackgroundpath{}% + \beforebackgroundpath{}% + \behindforegroundpath{}% + \beforeforegroundpath{}% + }% + }{}% +}% + +% A command which has to be invoked BEFORE \pgfplots@draw@axis to +% prepare everything. +\def\pgfplots@draw@axis@pre{% % Preparation for axis lines and discontinuities: \pgfplots@drawaxis@lines@preparediscont@for{x}% \pgfplots@drawaxis@lines@preparediscont@for{y}% @@ -4354,16 +5742,13 @@ \ifpgfplots@threedim \pgfplots@separate@axis@linestrue \else - \ifnum\pgfplots@xaxislinesnum>0 + \if\pgfplots@xaxislinesnum0\else \pgfplots@separate@axis@linestrue \fi - \ifnum\pgfplots@yaxislinesnum>0 + \if\pgfplots@yaxislinesnum0\else \pgfplots@separate@axis@linestrue \fi \fi - % - \pgfplots@decide@which@figure@surfaces@are@drawn - % % compute tick position lists % \pgfplots@prepared@tick@positions@minor@x % and @@ -4378,78 +5763,275 @@ \ifpgfplots@hide@z\else \expandafter\pgfplots@prepare@tick@coordlists@for\expandafter z\expandafter{\pgfplots@ztick}% \fi - \ifcase\pgfplots@zaxislinesnum\relax + \fi +} + +% PRECONDITION: +% \pgfplots@draw@axis@pre has been called. +\def\pgfplots@draw@axis{% + % + % + % +%\message{Ok, I am now in pgfplots@draw@axis; ready to do work. Hide flags: hide x = \ifpgfplots@hide@x true\else false\fi; hide y = \ifpgfplots@hide@y true\else false\fi hide z = \ifpgfplots@hide@z true \else false \fi. Vector length: x = \pgfplots@x@veclength (1/x = \pgfplots@x@inverseveclength). y = \pgfplots@y@veclength (1/y = \pgfplots@y@inverseveclength) z = \pgfplots@z@veclength (1/z = \pgfplots@z@inverseveclength)}% + \ifpgfplots@threedim +%\if10 + \if2\pgfplots@zaxislinesnum + % axis z line*=center + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@logical@ZERO@z}{2}% + \pgfplots@draw@axis@insurface@symmetric xyz + \else + % the other cases are handled in + % \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmin}{0}% - \pgfplots@draw@axis@insurface@symmetric xyz0 + \pgfplots@draw@axis@insurface@symmetric xyz % \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 + \pgfplots@draw@axis@insurface@symmetric xyz \fi % - \ifcase\pgfplots@xaxislinesnum\relax - \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmin}{0}% - \pgfplots@draw@axis@insurface@onlyticksandgrid yzx - \pgfplots@draw@axis@insurface zyx0 - % - \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmax}{1}% +%\fi\if10 + \if2\pgfplots@xaxislinesnum + % axis x line*=center + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@logical@ZERO@x}{2}% \pgfplots@draw@axis@insurface@onlyticksandgrid yzx - \pgfplots@draw@axis@insurface zyx1 - \or + \pgfplots@draw@axis@insurface zyx + \else \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 + \pgfplots@draw@axis@insurface zyx + % \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmax}{1}% \pgfplots@draw@axis@insurface@onlyticksandgrid yzx - \pgfplots@draw@axis@insurface zyx1 + \pgfplots@draw@axis@insurface zyx \fi +%\fi\if10 % - \ifcase\pgfplots@yaxislinesnum\relax - \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymin}{0}% - \pgfplots@draw@axis@insurface@onlyticksandgrid xzy - \pgfplots@draw@axis@insurface@onlyticksandgrid zxy - % - \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymax}{1}% + \if2\pgfplots@yaxislinesnum + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@logical@ZERO@y}{2}% \pgfplots@draw@axis@insurface@onlyticksandgrid xzy \pgfplots@draw@axis@insurface@onlyticksandgrid zxy - \or + \else \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 +%\fi \else % Just use the 2d-point commands (assuming Z=0) \let\pgfplotspointonorientedsurfaceabsetupforxyz=\pgfplotspointonorientedsurfaceabsetupforxy \let\pgfplotspointonorientedsurfaceabsetupforyxz=\pgfplotspointonorientedsurfaceabsetupforyx - \pgfplots@draw@axis@insurface@symmetric xyz2 + \pgfplots@draw@axis@insurface@symmetric xyz \fi }% +% The complement of \pgfplots@draw@axis which will ALWAYS be drawn on +% top of every thing else; it complements the rest. +% +% This implements only the 3d box=complete feature. +% +% PRECONDITION: +% \pgfplots@draw@axis@pre has been called. +\def\pgfplots@draw@axis@post{% + \ifpgfplots@threedim + \if0\pgfplots@threedimbox@choice + % 3d box=background + \else + \if0\pgfplots@xaxislinesnum + \else + \def\pgfplots@threedimbox@choice{0}% + \fi + \if0\pgfplots@yaxislinesnum + \else + \def\pgfplots@threedimbox@choice{0}% + \fi + \if0\pgfplots@zaxislinesnum + \else + \def\pgfplots@threedimbox@choice{0}% + \fi + \if\pgfplots@threedimbox@choice0% + \pgfplots@error{Sorry, your choice for '3d box' and 'axis x line' is incompatible.}% + \else + % 3d box=complete or complete* + \begingroup + \pgfplotsset{every 3d box foreground}% + \let\pgfplots@drawticklabels@onorientedsurf=\relax + \if2\pgfplots@threedimbox@choice + \def\pgfplots@ifgridlines@onorientedsurf@should@be@drawn##1##2{% + ##1% + }% + \else + \let\pgfplots@drawgridlines@onorientedsurf=\relax + \fi + % + \let\pgfplots@drawticklabels@onorientedsurf=\relax + % + % negate the meaning of this if: + \let\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@@ORIG=\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@% + \def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@##1##2##3{% + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@@ORIG{##1}{##3}{##2}% + }% + % + % the following code is *almost* the same as if we would + % have called + % \pgfplots@draw@axis again. + % The difference is in the + % \pgfplotsifaxissurfaceisforeground checks. + % Furthermore, I have removed the case distinctions for + % the different axis line combinations. + %\if10 + % axis z line*=box + % + \pgfplotsifaxissurfaceisforeground{vv0}{% + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmin}{0}% + \pgfplots@draw@axis@insurface@symmetric xyz + }{}% + % + \pgfplotsifaxissurfaceisforeground{vv1}{% + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmax}{1}% + \pgfplots@draw@axis@insurface@symmetric xyz + }{}% + % + %\fi\if10 + % axis x line*=box + \pgfplotsifaxissurfaceisforeground{0vv}{% + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx + }{} + % + \pgfplotsifaxissurfaceisforeground{1vv}{% + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx + }{} + %\fi\if11 + % + \pgfplotsifaxissurfaceisforeground{v0v}{% + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + }{}% + % + \pgfplotsifaxissurfaceisforeground{v1v}{% + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + }{}% + %\fi + \endgroup + % end of 3d box=complete + \fi + \fi + \fi +}% + +\def\pgfplots@define@threedim@marks{% + \ifpgfplots@threedim + % FIXME : there is always the same arithmetics going on here. I could try to optimize it -- for fixed mark size. + \pgfdeclareplotmark{cube} + {% + \pgfplots@cube@gethalf@x + \let\pgfplots@cube@halfx=\pgfmathresult + \pgfplots@cube@gethalf@y + \let\pgfplots@cube@halfy=\pgfmathresult + \pgfplots@cube@gethalf@z + \let\pgfplots@cube@halfz=\pgfmathresult + % + \pgfpathmoveto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathclose + % + \pgfpathmoveto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathclose + % + \pgfpathmoveto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + % + \pgfpathmoveto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + % + \pgfpathmoveto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + % + \pgfpathmoveto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfusepathqstroke + % + }% + \pgfdeclareplotmark{cube*} + {% + \pgfplots@cube@gethalf@x + \let\pgfplots@cube@halfx=\pgfmathresult + \pgfplots@cube@gethalf@y + \let\pgfplots@cube@halfy=\pgfmathresult + \pgfplots@cube@gethalf@z + \let\pgfplots@cube@halfz=\pgfmathresult + % + \pgfplotsifaxissurfaceisforeground{0vv}{% + \pgfpathmoveto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathclose + \pgfusepathqfillstroke + }{% + \pgfpathmoveto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathclose + \pgfusepathqfillstroke + }% + \pgfplotsifaxissurfaceisforeground{v0v}{% + \pgfpathmoveto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathclose + \pgfusepathqfillstroke + }{% + \pgfpathmoveto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathclose + \pgfusepathqfillstroke + }% + \pgfplotsifaxissurfaceisforeground{vv0}{% + \pgfpathmoveto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}% + \pgfpathclose + \pgfusepathqfillstroke + }{% + \pgfpathmoveto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}% + \pgfpathclose + \pgfusepathqfillstroke + }% + }% + \else + \pgfdeclareplotmark{cube}{\pgfuseplotmark{square}}% + \pgfdeclareplotmark{cube*}{\pgfuseplotmark{square*}}% + \fi +} + % 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 2D, the only available surface is 'vv0' (x=varying; y=varying; z=zmin) % For 3D, there are surfaces % - 'vv0' 'vv1' % - 'v0v' 'v1v' @@ -4461,138 +6043,218 @@ % @PRECONDITION % % @POSTCONDITION -% for every available surface, a macro '\pgfplots@surfenabled@CCC' -% is defined to be either '0' or '1'. +% - for every available surface, a macro '\pgfplots@surfviewdepth@CCC' +% is defined to be either 'f' (foreground) or 'b' (background). % Thus, we don't have real TeX booleans, "only" those one-character % strings. +% There are high-level routines to check these flags. +% - every tick label position will be initialised, i.e. the macros +% \pgfplots@[xyz]ticklabelaxisspec +% will be initialised. % % 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: +% Given \pgfplots@view@dir@threedim@[xyz], we know the view direction (in 3D!). +% Now, we compute the scalar products <n,(1,0,0)'> <n,(0,1,0)'> and +% <n,(0,0,1)'> between the view direction n and the unit vectors in 3D +% space. Of course, these scalar products are just specific components +% of n. Using the sign of the scalar product, we know whether n points +% roughly into the same or the opposite direction of each unit vector +% and we can deduce foreground and background side surfaces of the +% unit cube. The idea is: foreground surfaces won't be drawn, only +% background surfaces. % -% 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. +% Given this knowledge, we can also deduce the default axes for tick +% labels. % -% 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. +% The operation is relatively fast. \def\pgfplots@decide@which@figure@surfaces@are@drawn{% + \expandafter\def\csname pgfplots@surfviewdepth@2vv\endcsname{f}% + \expandafter\def\csname pgfplots@surfviewdepth@v2v\endcsname{f}% + \expandafter\def\csname pgfplots@surfviewdepth@vv2\endcsname{f}% \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 + % respect reversed axes here. If I am not mistaken, it should + % be completely sufficient to flip signs here: + \ifdim\pgfplots@view@dir@threedim@x pt\if\pgfkeysvalueof{/pgfplots/x dir/value}n>\else<\fi0pt + \expandafter\def\csname pgfplots@surfviewdepth@0vv\endcsname{f}% foreground + \expandafter\def\csname pgfplots@surfviewdepth@1vv\endcsname{b}% background + \else + \expandafter\def\csname pgfplots@surfviewdepth@0vv\endcsname{b}% + \expandafter\def\csname pgfplots@surfviewdepth@1vv\endcsname{f}% + \fi + \ifdim\pgfplots@view@dir@threedim@y pt\if\pgfkeysvalueof{/pgfplots/y dir/value}n>\else<\fi0pt + \expandafter\def\csname pgfplots@surfviewdepth@v0v\endcsname{f}% foreground + \expandafter\def\csname pgfplots@surfviewdepth@v1v\endcsname{b}% background + \else + \expandafter\def\csname pgfplots@surfviewdepth@v0v\endcsname{b}% + \expandafter\def\csname pgfplots@surfviewdepth@v1v\endcsname{f}% + \fi + \ifdim\pgfplots@view@dir@threedim@z pt\if\pgfkeysvalueof{/pgfplots/z dir/value}n>\else<\fi0pt + \expandafter\def\csname pgfplots@surfviewdepth@vv0\endcsname{f}% foreground + \expandafter\def\csname pgfplots@surfviewdepth@vv1\endcsname{b}% background + \else + \expandafter\def\csname pgfplots@surfviewdepth@vv0\endcsname{b}% + \expandafter\def\csname pgfplots@surfviewdepth@vv1\endcsname{f}% + \fi + % + % + % Now, determine which axis line shall get tick labels. + % The strategie is as follows: + % - only lines on the convex hull of the 2D projected axis + % rectangle can get tick labels, + % - for each axis, there are two such choices in the general + % case, + % - for X and Y: prefer the one on the lower side. + % - for Z: prefer the one on the left hand side. + % + \pgfplotspointcenter + \edef\pgfplots@tmp@centerx{\the\pgf@x}% + \edef\pgfplots@tmp@centery{\the\pgf@y}% + % + \pgfplots@init@ticklabelaxisspecfor xy% + % + \pgfplots@init@ticklabelaxisspecfor yy% + % + \pgfplots@init@ticklabelaxisspecfor zx% + \else + % FIXME : it might be better to implement that stuff here + % implicilty using the 3D algorithms. + % + % this here is the only important one: + \expandafter\def\csname pgfplots@surfviewdepth@vv0\endcsname{b}% + % + \expandafter\def\csname pgfplots@surfviewdepth@0vv\endcsname{b}% + \expandafter\def\csname pgfplots@surfviewdepth@1vv\endcsname{f}% + \expandafter\def\csname pgfplots@surfviewdepth@v0v\endcsname{b}% + \expandafter\def\csname pgfplots@surfviewdepth@v1v\endcsname{f}% + \expandafter\def\csname pgfplots@surfviewdepth@vv1\endcsname{f}% + \def\pgfplotsifaxislineisonconvexhull##1##2##3{##2}% ALWAYS TRUE + \def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@##1##2##3{##2}% ALWAYS TRUE + % + \pgfplotspointcenter + \edef\pgfplots@tmp@centerx{\the\pgf@x}% + \edef\pgfplots@tmp@centery{\the\pgf@y}% + % + \pgfplots@init@ticklabelaxisspec@twodim@for xy% + % + \pgfplots@init@ticklabelaxisspec@twodim@for yx% + \fi +} + +% A helper method which is to be invoked ONLY inside of +% \pgfplots@decide@which@figure@surfaces@are@drawn. +% It does NOT work outside of it. +% +% It initialises the 'pgfplots@#1ticklabelaxisspec' macro according to +% the foreground/background situation of the axis and the '#1ticklabel pos' +% key. +% +% #1: the axis: x,y or z +% #2: either x or y. It refers to the PROJECTED coordinate which +% should be used to compare the 'lower' and 'upper' arguments of the +% |[xyz]ticklabel pos| key. +% +% PRECONDITION: +% \pgfplots@tmp@center[xy] is set. +% +% POSTCONDITION: +% - pgfplots@#1ticklabelaxisspec is set, +% - pgfplots@#1ticklabel@suggested@anchor is set +% +% @see also \pgfplots@init@ticklabelaxisspec@twodim@for +\def\pgfplots@init@ticklabelaxisspecfor#1#2{% + \if#1x% + \def\pgfplots@loc@to@threedim##1##2{v##1##2}% + \def\pgfplots@loc@axischar@for@first{y}% + \else + \if#1y% + \def\pgfplots@loc@to@threedim##1##2{##1v##2}% + \def\pgfplots@loc@axischar@for@first{x}% + \else + \def\pgfplots@loc@to@threedim##1##2{##1##2v}% + \def\pgfplots@loc@axischar@for@first{x}% + \fi + \fi + \pgfplotsifaxislineisonconvexhull{\pgfplots@loc@to@threedim 00}{% + % -> both, v00 or v11 are on CH. + % + % Decide whether the '{0.5}{0}{0}' point is above or below + % the {0.5}{0.5}{0.5} + % point. This '<' operation is based on the '#1ticklabel pos' + % key, the 2D projection of the axis and the argument '#2'. + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 00}% + \pgfqpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}% + \ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax + \if u\csname pgfplots@#1ticklabel@pos\endcsname + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}% \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 + \else + \if l\csname pgfplots@#1ticklabel@pos\endcsname + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}% \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 + }{% + % -> both, v01 or v10 are on CH + %-------------------------------------------------- + % \pgfplotsifaxislineisonconvexhull{\pgfplots@loc@to@threedim 01}{% FIXME : eliminate sanity assertion if possible + % }{% + % \pgfplots@error{INTERNAL ERROR}% + % }% + %-------------------------------------------------- + % Decide whether the '{0.5}{1}{0}' point is above or below + % the {0.5}{0.5}{0.5} point. Again, the '<' operation is based + % on the '#1ticklabel pos' key, the projection and #2. + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 10}% + % compute the middle point on \pgfplots@loc@to@threedim 10 + \pgfpointadd + {\csname pgfplotspoint\pgfplots@loc@axischar@for@first axis\endcsname} + {\pgfpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}}% + % + \ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax + \if u\csname pgfplots@#1ticklabel@pos\endcsname + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}% \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 + \else + \if l\csname pgfplots@#1ticklabel@pos\endcsname + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}% \fi \fi - \endgroup - % and activate the macro: - \pgfplots@glob@TMPa + }% +}% +\def\pgfplots@init@ticklabelaxisspec@twodim@for#1#2{% + \if#1x% + \def\pgfplots@loc@to@threedim##1{v##10}% + \def\pgfplots@loc@axischar@for@first{y}% \else - \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% - \def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn##1##2##3{##2}% ALWAYS TRUE + \def\pgfplots@loc@to@threedim##1{##1v0}% + \def\pgfplots@loc@axischar@for@first{x}% \fi -} + % Decide whether the '{0.5}{0}' point is above or below + % the {0.5}{0.5} + % point. This '<' operation is based on the '#1ticklabel pos' + % key, the 2D projection of the axis and the argument '#2'. + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 0}% + \pgfqpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}% + \ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax + \if u\csname pgfplots@#1ticklabel@pos\endcsname + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 1}% + \fi + \else + %-------------------------------------------------- + %FIXME : I have the impression that this here is DEPRECATED + % \if3\csname pgfplots@#1tickposnum\endcsname % is 'right' + % \expandafter\def\csname pgfplots@#1tickposnum\endcsname{1}% set to 'left' + % \else + % \if1\csname pgfplots@#1tickposnum\endcsname % is 'left' + % \expandafter\def\csname pgfplots@#1tickposnum\endcsname{3}% set to 'right' + % \fi + % \fi + %-------------------------------------------------- + \if l\csname pgfplots@#1ticklabel@pos\endcsname + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 1}% + \fi + \fi +}% + % Processes every tick mark in direction #1 and draws tick lines, tick % labels, grid lines, axis lines and extra ticks. @@ -4600,13 +6262,7 @@ % #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{% +\def\pgfplots@draw@axis@insurface#1#2#3{% \pgfplots@if{pgfplots@hide@#1}{\relax}{% \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname \pgfplots@drawgridlines@onorientedsurf @@ -4618,18 +6274,20 @@ % \pgfplots@drawticklabels@onorientedsurf % - \expandafter\ifx\csname pgfplots@extra@#1tick\endcsname\pgfutil@empty + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@extra@xtick}% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@loc@TMPa}% \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 +% \pgfplots@draw@axis@insurface #1#2#3 +% \pgfplots@draw@axis@insurface #2#1#3 % with slightly optimized execution sequence. -\def\pgfplots@draw@axis@insurface@symmetric#1#2#3#4{% +\def\pgfplots@draw@axis@insurface@symmetric#1#2#3{% \pgfplots@if{pgfplots@hide@#1}{\relax}{% \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname \pgfplots@drawgridlines@onorientedsurf @@ -4676,17 +6334,19 @@ }% % \pgfplots@if{pgfplots@hide@#1}{\relax}{% - \expandafter\ifx\csname pgfplots@extra@#1tick\endcsname\pgfutil@empty + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname - \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@extra@xtick}% + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@loc@TMPa}% \fi }% \pgfplots@if{pgfplots@hide@#2}{\relax}{% - \expandafter\ifx\csname pgfplots@extra@#2tick\endcsname\pgfutil@empty + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#2tick\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname - \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@extra@ytick}% + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@loc@TMPa}% \fi }% }% @@ -4696,9 +6356,53 @@ \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname \pgfplots@drawgridlines@onorientedsurf \pgfplots@drawticklines@onorientedsurf + % + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \begingroup + \let\pgfplots@drawticklabels@onorientedsurf=\relax + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@loc@TMPa}% + \endgroup + \fi }% }% +% Handles the 'every 3d description' style. +% +% This requires a different type of attention than any other key -- +% because all other keys are set in a context where the dimension of +% the axis is unknown (it might be 2 or 3 dimensional). +% +% The idea is: +% Call \pgfplots@BEGIN@prepare@description@styles as soon as the +% dimension is fixed, but before any style changes of the user +% interface are applied. +% +% Example: +% \begin{axis}[xlabel style={}] +% will be processed here. The reason: 'every 3d description' will +% certainly use a different style for axis labels than the default 2d +% style. +% +% Thus, all style changes which are relevant for 'every 3d description' +% have NOT YET been processed (they have been appended to 'every axis'). +\def\pgfplots@BEGIN@prepare@description@styles{% + \ifpgfplots@threedim + \pgfplotsset{every 3d description,every 3d view {\pgfkeysvalueof{/pgfplots/view/az}}{\pgfkeysvalueof{/pgfplots/view/el}}/.try}% + \fi + \pgfkeysgetvalue{/pgfplots/.unknown/.@cmd}\pgfplots@BEGIN@prepare@description@styles@oldhandler + \pgfkeysdef{/pgfplots/.unknown}{}% ignore unknown keys here. + \pgfkeysactivatefamily{/pgfplots/style commands}% + \pgfkeysactivatefamily{/pgfplots/descriptions}% +%\pgfkeys{/pgfplots/every axis/.show code}% + \pgfplots@set@keys@from@tikz@style{every axis}% + \pgfkeysdeactivatefamily{/pgfplots/descriptions}% + \pgfkeysdeactivatefamily{/pgfplots/style commands}% + \pgfkeyslet{/pgfplots/.unknown/.@cmd}\pgfplots@BEGIN@prepare@description@styles@oldhandler +}% + \def\pgfplots@BEGIN@init@and@draw@axis{% \pgfplots@determinedefaultvalues \setbox\pgfnodepartimagebox=\hbox\bgroup\bgroup @@ -4707,27 +6411,260 @@ % set baseline for sub-picture to default value. % the baseline option will be applied to the OUTER picture. \pgfsetbaseline{\pgf@picminy}% + \begingroup + \pgfgettransformentries\aa\ab\ba\bb\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \xdef\pgfplots@savedtransformshift{% + \pgf@x=\pgfplots@loc@TMPa\space + \pgf@y=\pgfplots@loc@TMPb\space + }% + \xdef\pgfplots@glob@TMPa{{\aa}{\ab}{\ba}{\bb}}% + \endgroup + \expandafter\pgfsettransformentries\pgfplots@glob@TMPa{0pt}{0pt}% % + \pgfplots@draw@axis@pre \scope + % + \pgfkeysifdefined{/pgfplots/axis background/.@cmd}{% + \path[/pgfplots/axis background] \pgfextra{\pgfplots@clippath@install{}};% + }{}% + % \ifpgfplots@axis@on@top \else \pgfplots@draw@axis \fi % CLIPPING: - \pgfplots@clippath@prepare \ifpgfplots@clip - \pgfplots@clippath@install + \pgfplots@clippath@install{\pgfusepath{clip}}% \fi + \pgfplotspointbb@assertvaluesexist% } % Defines \pgfplots@clippath@install. % @PRECONDITION the axis limits must be ready. \def\pgfplots@clippath@prepare{% + \def\pgfplots@clippath@use@##1{% + \ifx\pgfplotspoint@bb@@@\relax + % remember the axis dimensions as well: + \ifdim\pgf@pathmaxx=-16000pt + \else + \begingroup + \pgf@xa=\pgf@pathmaxx + \advance\pgf@xa by-\pgf@pathminx + \pgf@ya=\pgf@pathmaxy + \advance\pgf@ya by-\pgf@pathminy + \xdef\pgfplots@glob@TMPa{{\the\pgf@pathminx}{\the\pgf@pathminy}{\the\pgf@xa}{\the\pgf@ya}}% + \endgroup + \global\let\pgfplotspoint@bb@@@=\pgfplots@glob@TMPa + \fi + \fi + ##1% + }% \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 + % + % -> Identify the convex hull of the 2D projection: + \pgfplotsifaxissurfaceisforeground{0vv}{% + \pgfplotsifaxissurfaceisforeground{v0v}{% + \pgfplotsifaxissurfaceisforeground{vv0}{% + % ok. Do NOT use the intersection lines + % - 00v + % - 0v0 + % - v00 + % so, use + % 010 (01v) 011 + % 011 (0v1) 001 + % 001 (v01) 101 + % 101 (10v) 100 + % 100 (1v0) 110 + % 110 (v10) 011 (cycle) + \def\pgfplots@clippath@install##1{% + \pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmin}}% + \pgfpathclose + \pgfplots@clippath@use@{##1}% + }% + }{% + % foreground surfs: 0vv, v0v, vv1 + % + % ok. Do NOT use the intersection lines + % - 00v + % - 0v1 + % - v01 + % so, use + % 010 (01v) 011 + % 011 (v11) 111 + % 111 (1v1) 101 + % 101 (10v) 100 + % 100 (v00) 000 + % 000 (0v0) 010 (cycle) + \def\pgfplots@clippath@install##1{\relax% + \pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}}% + \pgfpathclose + \pgfplots@clippath@use@{##1}% + }% + }% + }{% + \pgfplotsifaxissurfaceisforeground{vv0}{% + % foreground surfs: 0vv, v1v, vv0 + % + % ok. Do NOT use the intersection lines + % - 01v + % - 0v0 + % - v10 + % so, use + % 000 (00v) 001 + % 001 (0v1) 011 + % 011 (v11) 111 + % 111 (11v) 110 + % 110 (1v0) 100 + % 100 (v00) 000 (cycle) + \def\pgfplots@clippath@install##1{% + \pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}% + \pgfpathclose + \pgfplots@clippath@use@{##1}% + }% + }{% + % foreground surfs: 0vv, v1v, vv1 + % + % ok. Do NOT use the intersection lines + % - 01v + % - 0v1 + % - v11 + % so, use + % 000 (00v) 001 + % 001 (v01) 101 + % 101 (1v1) 111 + % 111 (11v) 110 + % 110 (v10) 010 + % 010 (0v0) 000 (cycle) + \def\pgfplots@clippath@install##1{% + \pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}% + \pgfpathclose + \pgfplots@clippath@use@{##1}% + }% + }% + }% + }{% + \pgfplotsifaxissurfaceisforeground{v0v}{% + \pgfplotsifaxissurfaceisforeground{vv0}{% + % foreground surfs: 1vv, v0v, vv0. + % + % Thus: DON'T use the intersection lines + % - 10v + % - 1v0 + % - v00 + % So, use + % 110 (11v) 111 + % 111 (1v1) 101 + % 101 (v01) 001 + % 001 (00v) 000 + % 000 (0v0) 010 + % 010 (v10) 110 (cycle) + \def\pgfplots@clippath@install##1{% + \pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}% + \pgfpathclose + \pgfplots@clippath@use@{##1}% + }% + }{% + % foreground surfs: 1vv, v0v, vv1 + % Thus: DON'T use the intersection lines + % - 10v + % - 1v1 + % - v01 + % So, use + % 110 (11v) 111 + % 111 (v11) 011 + % 011 (0v1) 001 + % 001 (00v) 000 + % 000 (v00) 100 + % 100 (1v0) 110 (cycle) + \def\pgfplots@clippath@install##1{% + \pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}% + \pgfpathclose + \pgfplots@clippath@use@{##1}% + }% + }% + }{% + \pgfplotsifaxissurfaceisforeground{vv0}{% + % foreground surfs: 1vv, v1v, vv0 + % Thus: DON'T use the intersection lines + % - 11v + % - 1v0 + % - v10 + % So, use + % 100 (10v) 101 + % 101 (1v1) 111 + % 111 (v11) 011 + % 011 (01v) 010 + % 010 (0v0) 000 + % 000 (v00) 100 (cycle) + \def\pgfplots@clippath@install##1{% + \pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}}% + \pgfpathclose + \pgfplots@clippath@use@{##1}% + }% + }{% + % foreground surfs: 1vv, v1v, vv1 + % Thus: DON'T use the intersection lines + % - 11v + % - 1v1 + % - v11 + % So, use + % 100 (10v) 101 + % 101 (v01) 001 + % 001 (0v1) 011 + % 011 (01v) 010 + % 010 (v10) 110 + % 110 (1v0) 100 (cycle) + \def\pgfplots@clippath@install##1{% + \pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmax}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}% + \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmin}}% + \pgfpathclose + \pgfplots@clippath@use@{##1}% + }% + }% + }% + }% + \else \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% \edef\pgfplots@loc@TMPa{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% @@ -4742,29 +6679,72 @@ \toks1=\expandafter{\pgfplots@loc@TMPb}% \toks2=\expandafter{\pgfplots@loc@TMPc}% \toks3=\expandafter{\pgfplots@loc@TMPd}% - \xdef\pgfplots@glob@TMPa{% + \xdef\pgfplots@glob@TMPa##1{% \noexpand\pgfpathmoveto{\the\toks0 }% \noexpand\pgfpathlineto{\the\toks1 }% \noexpand\pgfpathlineto{\the\toks2 }% \noexpand\pgfpathlineto{\the\toks3 }% - \noexpand\pgfusepath{clip}% + \noexpand\pgfplots@clippath@use@{##1}% }% \endgroup \let\pgfplots@clippath@install=\pgfplots@glob@TMPa \fi + % FIXME : workaround clear path sizes at beginning! This shouldn't + % be necessary! + \expandafter\def + \expandafter\pgfplots@clippath@install + \expandafter##% + \expandafter1% + \expandafter{% + \expandafter\pgf@resetpathsizes + \pgfplots@clippath@install{##1}% + }% + \global\let\pgfplotspoint@bb@@@=\relax +}% +\def\pgfplotspointbb@assertvaluesexist{% + \ifx\pgfplotspoint@bb@@@\relax + % (RE)COMPUTE: + % + % Determine tight 2D bounding box for the axis as such: + \begingroup + \pgfinterruptboundingbox + \pgf@relevantforpicturesizetrue + \pgfplots@clippath@install{\pgfusepath{discard}} + \endpgfinterruptboundingbox + \endgroup + \fi +}% + +% Point commands which expand to the bounding box which contains at +% least the (projected) visible part of the axis +\def\pgfplotspointbblowerleft{% + \pgfplotspointbb@assertvaluesexist + \expandafter\pgfplotspointbblowerleft@\pgfplotspoint@bb@@@ +}% +\def\pgfplotspointbbupperright{% + \pgfpointadd{\pgfplotspointbblowerleft}{\pgfplotspointbbdiagonal}% +}% +\def\pgfplotspointbbdiagonal{% + \pgfplotspointbb@assertvaluesexist + \expandafter\pgfplotspointbbdiagonal@\pgfplotspoint@bb@@@ }% +\let\pgfplotspoint@bb@@@=\relax +\def\pgfplotspointbblowerleft@#1#2#3#4{\pgf@x=#1 \pgf@y=#2 }% +\def\pgfplotspointbbdiagonal@#1#2#3#4{\pgf@x=#3 \pgf@y=#4 }% -\def\pgfplots@clippath@install{% +% #1: a complete \pgfusepath command what to do with the clip path. +\def\pgfplots@clippath@install#1{% \pgfplots@error{Can't install a clippath here - the command has not yet been prepared.}% }% +% This is the counterpart for \pgfplots@BEGIN@init@and@draw@axis \def\pgfplots@END@init@and@draw@axis{% \endscope% % \ifpgfplots@axis@on@top \pgfplots@draw@axis - \else \fi + \pgfplots@draw@axis@post % % whats the better sequence for \ifpgfplots@axis@on@top and \ifpgfplots@clip@marker@paths !? % This here looks better, I think... markers should not be obscured by descriptions. @@ -4787,10 +6767,12 @@ } % Writes output to \pgfmathresult -\def\pgfplots@filter@input@ticks@with@log#1{% +% #1: the tick list (not a macro!) +% #2: the axis +\def\pgfplots@filter@input@ticks@with@log#1#2{% \let\pgfplots@glob@TMPa=\pgfutil@empty \foreach \pgfplots@loc@TMPb in {#1} {% - \expandafter\pgfmathlog@\expandafter{\pgfplots@loc@TMPb}% + \csname pgfplotsmathlog@#2@\endcsname{\pgfplots@loc@TMPb}% \ifx\pgfplots@glob@TMPa\pgfutil@empty \xdef\pgfplots@glob@TMPa{\pgfmathresult}% \else @@ -4816,13 +6798,25 @@ \let\pgfmathresult=\pgfplots@glob@TMPa } -\tikzdeclarecoordinatesystem{axis}{\pgfplots@evalute@tikz@coord@system@interface#1\pgfplots@coord@end} +\tikzdeclarecoordinatesystem{axis}{\edef\pgfplots@loc@TMPa{#1}\expandafter\pgfplots@evalute@tikz@coord@system@interface\pgfplots@loc@TMPa\pgfplots@coord@end} +\def\pgfplotspointaxisxy#1#2{\pgfplots@evalute@tikz@coord@system@interface#1,#2\pgfplots@coord@end}% +\def\pgfplotspointaxisxyz#1#2#3{\pgfplots@evalute@tikz@coord@system@interface#1,#2,#3\pgfplots@coord@end}% + +\tikzdeclarecoordinatesystem{rel axis}{\edef\pgfplots@loc@TMPa{#1}\expandafter\pgfplots@evalute@tikz@coord@system@interface@rel\pgfplots@loc@TMPa\pgfplots@coord@end} +\def\pgfplotspointrelaxisxy#1#2{\pgfplots@evalute@tikz@coord@system@interface@rel#1,#2\pgfplots@coord@end}% +\def\pgfplotspointrelaxisxyz#1#2#3{\pgfplots@evalute@tikz@coord@system@interface@rel#1,#2,#3\pgfplots@coord@end}% + +\tikzdeclarecoordinatesystem{axis description}{\edef\pgfplots@loc@TMPa{#1}\expandafter\pgfplots@evalute@tikz@coord@system@interface@axis@description\pgfplots@loc@TMPa\pgfplots@coord@end} +\def\pgfplots@evalute@tikz@coord@system@interface@axis@description#1,#2\pgfplots@coord@end{\pgfplotspointdescriptionxy{#1}{#2}} +\def\pgfplotstransformcoordinatex#1{\pgfplots@evalute@tikz@coord@system@interface@for{x}{#1}}% +\def\pgfplotstransformcoordinatey#1{\pgfplots@evalute@tikz@coord@system@interface@for{y}{#1}}% +\def\pgfplotstransformcoordinatez#1{\pgfplots@evalute@tikz@coord@system@interface@for{z}{#1}}% % Assigns \pgfmathresult := canvas coordinate (#2) for axis #1. \long\def\pgfplots@evalute@tikz@coord@system@interface@for#1#2{% \pgfkeysgetvalue{/pgfplots/#1 coord trafo/.@cmd}\pgfplots@loc@TMPc - \def\pgfmathresult{#2}% + \edef\pgfmathresult{#2}% \ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key \else \expandafter\pgfplots@loc@TMPc\expandafter{\pgfmathresult}\pgfeov @@ -4842,15 +6836,95 @@ \begingroup \pgfplots@evalute@tikz@coord@system@interface@for{x}{#1}% \let\pgfplots@evaluate@tikz@coord@x=\pgfmathresult - \pgfplots@evalute@tikz@coord@system@interface@for{y}{#2}% + \edef\pgfplots@loc@TMPa{#2}% + \expandafter\pgfutil@in@\expandafter,\expandafter{\pgfplots@loc@TMPa}% + \ifpgfutil@in@ + \def\pgfplots@loc@TMPb##1,##2\pgfplots@EOI{% + \def\pgfplots@axiscs@y{##1}% + \def\pgfplots@axiscs@z{##2}% + }% + \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\pgfplots@EOI + \pgfplots@evalute@tikz@coord@system@interface@for{y}{\pgfplots@axiscs@y}% + \let\pgfplots@evaluate@tikz@coord@y=\pgfmathresult + \pgfplots@evalute@tikz@coord@system@interface@for{z}{\pgfplots@axiscs@z}% + \let\pgfplots@evaluate@tikz@coord@z=\pgfmathresult + \else + \pgfplots@evalute@tikz@coord@system@interface@for{y}{#2}% + \let\pgfplots@evaluate@tikz@coord@y=\pgfmathresult + \let\pgfplots@evaluate@tikz@coord@z=\pgfutil@empty + \fi \xdef\pgfplots@glob@TMPa{\pgfplots@evaluate@tikz@coord@x}% - \xdef\pgfplots@glob@TMPb{\pgfmathresult}% + \xdef\pgfplots@glob@TMPb{\pgfplots@evaluate@tikz@coord@y}% + \xdef\pgfplots@glob@TMPc{\pgfplots@evaluate@tikz@coord@z}% \endgroup \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! + \pgfplotsqpointxyz{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}{\pgfplots@glob@TMPc}% + \fi +} +\long\def\pgfplots@evalute@tikz@coord@system@interface@rel#1,#2\pgfplots@coord@end{% + \begingroup + \pgfkeys{/pgf/fpu=false}% + \pgfmathparse{#1}% + \let\pgfplots@axiscs@x=\pgfmathresult + \edef\pgfplots@loc@TMPa{#2}% + \expandafter\pgfutil@in@\expandafter,\expandafter{\pgfplots@loc@TMPa}% + \ifpgfutil@in@ + \def\pgfplots@loc@TMPb##1,##2\pgfplots@EOI{% + \pgfmathparse{##1}% + \let\pgfplots@axiscs@y=\pgfmathresult + \pgfmathparse{##2}% + \let\pgfplots@axiscs@z=\pgfmathresult + }% + \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\pgfplots@EOI + \else + \pgfmathparse{#2}% + \let\pgfplots@axiscs@y=\pgfmathresult + \def\pgfplots@axiscs@z{}% + \fi + \pgfplotspointxaxis + \pgf@xx=\pgf@x + \pgf@xy=\pgf@y + % + \pgfplotspointyaxis + \pgf@yx=\pgf@x + \pgf@yy=\pgf@y + % + \ifpgfplots@allow@reversal@of@rel@axis@cs + \if\pgfkeysvalueof{/pgfplots/x dir/value}r% + \pgf@xa=-\pgfplots@axiscs@x pt + \advance\pgf@xa by1pt + \edef\pgfplots@axiscs@x{\pgf@sys@tonumber\pgf@xa}% + \fi + \if\pgfkeysvalueof{/pgfplots/y dir/value}r% + \pgf@xa=-\pgfplots@axiscs@y pt + \advance\pgf@xa by1pt + \edef\pgfplots@axiscs@y{\pgf@sys@tonumber\pgf@xa}% + \fi + \fi + % + \ifx\pgfplots@axiscs@z\pgfutil@empty + \pgfpointadd + {\pgfplotspointminminmin}% + {\pgfplotsqpointxy{\pgfplots@axiscs@x}{\pgfplots@axiscs@y}}% + \else + \ifpgfplots@allow@reversal@of@rel@axis@cs + \if\pgfkeysvalueof{/pgfplots/z dir/value}r% + \pgf@xa=-\pgfplots@axiscs@z pt + \advance\pgf@xa by1pt + \edef\pgfplots@axiscs@z{\pgf@sys@tonumber\pgf@xa}% + \fi + \fi + \pgfplotspointzaxis + \pgf@zx=\pgf@x + \pgf@zy=\pgf@y + \pgfpointadd + {\pgfplotspointminminmin}% + {\pgfplotsqpointxyz{\pgfplots@axiscs@x}{\pgfplots@axiscs@y}{\pgfplots@axiscs@z}}% \fi + \pgf@process{}% + \endgroup } % In case of (semi-) logplots, this command will @@ -4864,12 +6938,15 @@ % - the options have been set, but are not applied % % POSTCONDITION: -% - any user input for log-axis has been replaced by its log -% - coordinate filters to compute logs are installed +% - any user input has been parsed +% - any user input for log-axis has been replaced by its log if +% necessary +% - coordinate filters are prepared % % See also: % \pgfplots@check@and@apply@datatrafo@for \def\pgfplots@prepare@coord@filtering@for#1{% + \expandafter\let\csname pgfplotsmathlogtologten@#1@\endcsname=\pgfmathlogtologten@ \pgfkeysgetvalue{/pgfplots/#1 coord trafo/.@cmd}\pgfplots@loc@TMPc \expandafter\let\csname pgfplots@highlevel@trafo@#1\endcsname=\pgfplots@loc@TMPc \ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key @@ -4921,6 +6998,7 @@ \else \def\pgfplots@loc@TMPb{data}% \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + % #1tick=data is handled elsewhere... \else \expandafter\pgfplots@filter@input@ticks@with@highleveltrafo\expandafter{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPc}% \expandafter\edef\csname pgfplots@#1tick\endcsname{\pgfmathresult}% @@ -4975,21 +7053,117 @@ \fi \fi \else + \expandafter\let\csname pgfplotsmathlog@#1@\endcsname=\pgfmathlog@ + \expandafter\let\csname pgfplotsmathlogi@#1\endcsname=\logi + \expandafter\let\csname pgfplotsmathlog@#1@float\endcsname=\pgfmathlog@float + \expandafter\let\csname pgfplots@log@scale@todisplaylog@#1\endcsname=\logten + \expandafter\let\csname pgfplots@log@scale@todisplaylog@#1@inv\endcsname=\reciproclogten + \expandafter\def\csname pgfplotsmathlogscale@#1\endcsname{1}% + \expandafter\def\csname pgfplotsmathlogscale@#1@inv\endcsname{1}% + % % 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. \pgfplots@if{pgfplots@disablelogfilter@#1}{\relax}{% + % Prepare the log to use for axis '#1'. + % + \pgfkeysgetvalue{/pgfplots/log basis #1}\pgfplots@loc@TMPa% + \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + % log basis x={} (initial setting:) + \else + % use a different basis. + % + % + \pgfmathlog@{\pgfplots@loc@TMPa}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \pgfmathparse{1/\pgfplots@loc@TMPa}% + \expandafter\let\csname pgfplotsmathlogscale@#1\endcsname=\pgfplots@loc@TMPa + \expandafter\let\csname pgfplotsmathlogscale@#1@inv\endcsname=\pgfmathresult + % + \expandafter\edef\csname pgfplotsmathlog@#1@\endcsname##1{% + \noexpand\pgfmathlog@{##1}% + \noexpand\ifx\noexpand\pgfmathresult\noexpand\pgfutil@empty + \noexpand\else + \noexpand\expandafter\noexpand\pgfmath@basic@multiply@\noexpand\expandafter + {\noexpand\pgfmathresult}% + {\pgfmathresult}% + \noexpand\fi + }% + \expandafter\edef\csname pgfplotsmathlog@#1@float\endcsname##1{% + \noexpand\pgfmathlog@float{##1}% + \noexpand\ifx\noexpand\pgfmathresult\noexpand\pgfutil@empty + \noexpand\else + \noexpand\expandafter\noexpand\pgfmath@basic@multiply@\noexpand\expandafter + {\noexpand\pgfmathresult}% + {\pgfmathresult}% + \noexpand\fi + }% + % + % generate default ticks in the 'log basis', not base 10: + \expandafter\def\csname pgfplots@log@scale@todisplaylog@#1\endcsname{1}% + \expandafter\def\csname pgfplots@log@scale@todisplaylog@#1@inv\endcsname{1}% + \pgfplotsset{/pgfplots/log basis ticks=#1}% + % + % + \ifdim\pgfkeysvalueof{/pgfplots/log basis #1}pt=10pt + \else + \pgfplots@identify@log@minor@tick@posfalse + \csname pgfplots@#1minorticksfalse\endcsname + \csname pgfplots@#1minorgridsfalse\endcsname + \expandafter\def\csname pgfplots@#1minortickstrue\endcsname{\pgfplots@error{Sorry, minor ticks are not supported for this log basis.}}% + \expandafter\def\csname pgfplots@#1minorgridstrue\endcsname{\pgfplots@error{Sorry, minor grid lines are not supported for this log basis.}}% + \fi + \pgfkeysdef{/pgfplots/log basis #1}{\pgfplots@error{Sorry, you can't change 'log basis #1' in this context.}}% + % + % recompute logtologten for this axis: + \pgfmath@basic@multiply@{\reciproclogten}{\pgfplots@loc@TMPa}% + \expandafter\edef\csname pgfplotsmathlogtologten@#1@\endcsname##1{% + \noexpand\pgfmath@basic@multiply@{##1}{\pgfmathresult}% + }% + \begingroup + % recompute \logi for the new basis. + \dimen1=\logi1pt \dimen1=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen1 + \dimen2=\logi2pt \dimen2=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen2 + \dimen3=\logi3pt \dimen3=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen3 + \dimen4=\logi4pt \dimen4=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen4 + \dimen5=\logi5pt \dimen5=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen5 + \dimen6=\logi6pt \dimen6=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen6 + \dimen7=\logi7pt \dimen7=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen7 + \dimen8=\logi8pt \dimen8=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen8 + \dimen9=\logi9pt \dimen9=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen9 + \xdef\pgfplots@glob@TMPa##1{% + \noexpand\ifcase##1 + \noexpand\or0 + \noexpand\or\pgf@sys@tonumber{\dimen1 }% + \noexpand\or\pgf@sys@tonumber{\dimen2 }% + \noexpand\or\pgf@sys@tonumber{\dimen3 }% + \noexpand\or\pgf@sys@tonumber{\dimen4 }% + \noexpand\or\pgf@sys@tonumber{\dimen5 }% + \noexpand\or\pgf@sys@tonumber{\dimen6 }% + \noexpand\or\pgf@sys@tonumber{\dimen7 }% + \noexpand\or\pgf@sys@tonumber{\dimen8 }% + \noexpand\or\pgf@sys@tonumber{\dimen9 }% + \noexpand\fi + }% + \endgroup + \expandafter\let\csname pgfplotsmathlogi@#1\endcsname=\pgfplots@glob@TMPa + %%% + % Ok, now, I have prepared everything for the new + % log basis! + \fi + % % any user-specified axis limits: \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1min\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfmathlog@\expandafter{\pgfplots@loc@TMPa}% + \csname pgfplotsmathlog@#1@\endcsname{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult \fi \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1max\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfmathlog@\expandafter{\pgfplots@loc@TMPa}% + \csname pgfplotsmathlog@#1@\endcsname{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi % @@ -4997,13 +7171,13 @@ \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmin\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfmathlog@\expandafter{\pgfplots@loc@TMPa}% + \csname pgfplotsmathlog@#1@\endcsname{\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}% + \csname pgfplotsmathlog@#1@\endcsname{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult \fi % @@ -5013,91 +7187,117 @@ \else \def\pgfplots@loc@TMPb{data}% \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + % #1tick=data is handled elsewhere... \else - \expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@loc@TMPa}% + \expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@loc@TMPa}{#1}% \expandafter\edef\csname pgfplots@#1tick\endcsname{\pgfmathresult}% \fi \fi \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@loc@TMPa}% + \expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@loc@TMPa}{#1}% \expandafter\edef\csname pgfplots@extra@#1tick\endcsname{\pgfmathresult}% \fi % % append logarithm to prepare coord. % + \t@pgfplots@toka={% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfplots@if{pgfplots@disablelogfilter@#1}{% + \pgfmathfloatparsenumber{\pgfmathresult}% + \expandafter\pgfmathfloat@decompose@F\pgfmathresult\relax\c@pgf@counta + \ifnum\c@pgf@counta>2 % this clears nan, inf and -inf points. + \let\pgfmathresult=\pgfutil@empty + \def\pgfplots@unbounded@dir{#1}% + \else + \pgfmathfloattofixed{\pgfmathresult}% + \fi + }{% + \csname pgfplotsmathlog@#1@\endcsname{\pgfmathresult}% + \ifx\pgfmathresult\pgfutil@empty + % detect unbounded coords: + \def\pgfplots@unbounded@dir{#1}% + \fi + }% + \fi + }% \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{% - \edef\pgfmathresult{##1}% - \ifx\pgfmathresult\pgfutil@empty - \else - \pgfplots@if{pgfplots@disablelogfilter@#1}{% - \pgfmathfloatparsenumber{##1}% - \pgfmathfloattofixed{\pgfmathresult}% - }{% - \pgfmathlog@{##1}% - }% - \fi + \expandafter\edef\csname pgfplots@prepare@#1coord\endcsname##1{% + \noexpand\edef\noexpand\pgfmathresult{##1}% + \the\t@pgfplots@toka }% \else - % This is a bit complicated... but it works. - \t@pgfplots@toka=\expandafter\expandafter\expandafter{% + % This is a bit complicated... but it works: APPEND + % the log stuff to the existing prepare method. + \t@pgfplots@tokb=\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 + \expandafter\edef\csname pgfplots@prepare@#1coord\endcsname##1{% + \the\t@pgfplots@tokb + \the\t@pgfplots@toka + }% \fi }% \fi } \def\pgfplots@create@axis@descriptions{% - \ifpgfplots@hide@x - \else - \pgfkeysgetvalue{/pgfplots/xlabel}{\pgfplots@label@}% - \ifx\pgfplots@label@\pgfutil@empty + \begingroup + % + \pgfplots@change@pgfpoints@to@descriptioncs + % + \ifpgfplots@hide@x \else - \pgfplots@show@label{x}{\pgfplots@label@}% + \ifpgfplots@units@use% + \pgfplots@show@label{x}{\pgfplots@label@units{x}}% + \else% + \pgfkeysgetvalue{/pgfplots/xlabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty + \else + \pgfplots@show@label{x}{\pgfplots@label@}% + \fi + \fi \fi - \fi - \ifpgfplots@hide@y - \else - \pgfkeysgetvalue{/pgfplots/ylabel}{\pgfplots@label@}% - \ifx\pgfplots@label@\pgfutil@empty + \ifpgfplots@hide@y \else - \pgfplots@show@label{y}{\pgfplots@label@}% + \ifpgfplots@units@use% + \pgfplots@show@label{y}{\pgfplots@label@units{y}}% + \else% + \pgfkeysgetvalue{/pgfplots/ylabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty + \else + \pgfplots@show@label{y}{\pgfplots@label@}% + \fi + \fi \fi - \fi - \ifpgfplots@threedim - \ifpgfplots@hide@z - \else - \pgfkeysgetvalue{/pgfplots/zlabel}{\pgfplots@label@}% - \ifx\pgfplots@label@\pgfutil@empty + \ifpgfplots@threedim + \ifpgfplots@hide@z \else - \pgfplots@show@label{z}{\pgfplots@label@}% + \ifpgfplots@units@use% + \pgfplots@show@label{z}{\pgfplots@label@units{z}}% + \else% + \pgfkeysgetvalue{/pgfplots/zlabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty + \else + \pgfplots@show@label{z}{\pgfplots@label@}% + \fi + \fi \fi \fi - \fi - % - \pgfkeysgetvalue{/pgfplots/title}\pgfplots@loc@TMPa - \ifx\pgfplots@loc@TMPa\pgfutil@empty - \else - \expandafter\pgfplots@show@title\expandafter{\pgfplots@loc@TMPa}% - \fi - \pgfplots@createlegend + % + \pgfkeysgetvalue{/pgfplots/title}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@show@title\expandafter{\pgfplots@loc@TMPa}% + \fi + \pgfplots@createlegend + % + \pgfkeysvalueof{/pgfplots/extra description/.@cmd}\pgfeov% + % + \endgroup } \def\pgfplots@datascaletrafo@undoshift@x#1{% @@ -5130,12 +7330,12 @@ % \pgfplots@datascaletrafo@fromfixed@x \def\pgfplots@datascaletrafo@x#1{% \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@x}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \pgfmathfloattofixed{\pgfmathresult}% \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@SHIFT@x}% } \def\pgfplots@datascaletrafo@x@noshift#1{% \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@x}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \pgfmathfloattofixed{\pgfmathresult}% } % Overloaded function. @@ -5144,34 +7344,34 @@ % @see \pgfplots@datascaletrafo@x \def\pgfplots@datascaletrafo@fromfixed@x#1{% \pgfmathfloatparsenumber{#1}% - \expandafter\pgfplots@datascaletrafo@x\expandafter{\pgfmathresult}% + \pgfplots@datascaletrafo@x{\pgfmathresult}% } \def\pgfplots@datascaletrafo@y#1{% \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@y}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \pgfmathfloattofixed{\pgfmathresult}% \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@SHIFT@y}% } \def\pgfplots@datascaletrafo@fromfixed@y#1{% \pgfmathfloatparsenumber{#1}% - \expandafter\pgfplots@datascaletrafo@y\expandafter{\pgfmathresult}% + \pgfplots@datascaletrafo@y{\pgfmathresult}% } \def\pgfplots@datascaletrafo@y@noshift#1{% \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@y}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \pgfmathfloattofixed{\pgfmathresult}% } \def\pgfplots@datascaletrafo@z#1{% \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@z}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \pgfmathfloattofixed{\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}% + \pgfplots@datascaletrafo@z{\pgfmathresult}% } \def\pgfplots@datascaletrafo@z@noshift#1{% \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@z}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \pgfmathfloattofixed{\pgfmathresult}% } % INVERSE transformation x = T^{-1}( X ) @@ -5309,6 +7509,115 @@ \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } +% Defines '#1' to be a macro which, upon execution, draws the color +% bar for the current axis. It also handles any required style +% inheritance and option preparation issues. +% +% The important thing is: the macro is expected to be invoked after +% the current TeX group (scope). Thus, the complete state is +% represented inside of '#1' (and maybe some global variables). +\def\pgfplots@colorbar@move@outside@scope@with@globalmacro#1{% + \pgfplotspointbbdiagonal + \edef\pgfplots@loc@TMPa{\the\pgf@x}% + \edef\pgfplots@loc@TMPb{\the\pgf@y}% + \pgfkeyslet{/pgfplots/parent axis width}{\pgfplots@loc@TMPa}% + \pgfkeyslet{/pgfplots/parent axis height}{\pgfplots@loc@TMPb}% + % + \pgfnodealias{parent axis}{current axis}% + % we have to do a lot of work to move *some* of the current + % settings out of the current TeX group: + \pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@loc@TMPa + \expandafter\pgfplotscolormapserializetomacro\expandafter{\pgfplots@loc@TMPa}{\pgfplots@serializedcolormap}% + \toks0=\expandafter{\pgfplots@serializedcolormap}% + % + % FIXME : + % I would really prefer to find a different way to move these + % variables out of the current scope. But expansion lead to + % mistakes with '#' characters ... :-( + % I use these no-name globals in the hope they might be used + % in another place as well. + {\globaldefs=1 + \pgfkeysgetvalue{/pgfplots/colorbar/draw/.@cmd}\pgfplots@savedstyle@colorbar@draw + \pgfkeysgetvalue{/pgfplots/every colorbar/.@cmd}\pgfplots@savedstyle@colorbar + \pgfkeysgetvalue{/pgfplots/colorbar shift/.@cmd}\pgfplots@savedstyle@colorbarshift + \pgfkeysgetvalue{/pgfplots/every tick/.@cmd}\pgfplots@savedstyle@tick + \pgfkeysgetvalue{/pgfplots/every minor tick/.@cmd}\pgfplots@savedstyle@minortick + \pgfkeysgetvalue{/pgfplots/every major tick/.@cmd}\pgfplots@savedstyle@majortick + \pgfkeysgetvalue{/pgfplots/every axis grid/.@cmd}\pgfplots@savedstyle@grid + \pgfkeysgetvalue{/pgfplots/every minor grid/.@cmd}\pgfplots@savedstyle@minorgrid + \pgfkeysgetvalue{/pgfplots/every major grid/.@cmd}\pgfplots@savedstyle@majorgrid + \pgfkeysgetvalue{/pgfplots/every tick label/.@cmd}\pgfplots@savedstyle@ticklabel + \pgfkeysgetvalue{/pgfplots/every tick label/.@cmd}\pgfplots@savedstyle@ticklabel + }% + % + \xdef#1{% + \noexpand\begingroup + \the\toks0 % restore colormap definition + % restore relevant styles and variables: + \noexpand\pgfkeyslet{/pgfplots/colorbar/draw/.@cmd} {\noexpand\pgfplots@savedstyle@colorbar@draw}% + \noexpand\pgfkeyslet{/pgfplots/colorbar shift/.@cmd} {\noexpand\pgfplots@savedstyle@colorbarshift}% + \noexpand\pgfkeyslet{/pgfplots/every colorbar/.@cmd} {\noexpand\pgfplots@savedstyle@colorbar}% + \noexpand\pgfkeyslet{/pgfplots/every tick/.@cmd} {\noexpand\pgfplots@savedstyle@tick}% + \noexpand\pgfkeyslet{/pgfplots/every minor tick/.@cmd} {\noexpand\pgfplots@savedstyle@minortick}% + \noexpand\pgfkeyslet{/pgfplots/every major tick/.@cmd} {\noexpand\pgfplots@savedstyle@majortick}% + \noexpand\pgfkeyslet{/pgfplots/every axis grid/.@cmd} {\noexpand\pgfplots@savedstyle@grid}% + \noexpand\pgfkeyslet{/pgfplots/every minor grid/.@cmd} {\noexpand\pgfplots@savedstyle@minorgrid}% + \noexpand\pgfkeyslet{/pgfplots/every major grid/.@cmd} {\noexpand\pgfplots@savedstyle@majorgrid}% + \noexpand\pgfkeyslet{/pgfplots/every tick label/.@cmd} {\noexpand\pgfplots@savedstyle@ticklabel}% + \noexpand\pgfkeyssetvalue{/pgfplots/point meta min}{\pgfplots@axiswide@metamin}% + \noexpand\pgfkeyssetvalue{/pgfplots/point meta max}{\pgfplots@axiswide@metamax}% + \noexpand\pgfkeyssetvalue{/pgfplots/colormap name}{\pgfkeysvalueof{/pgfplots/colormap name}}% + \noexpand\pgfkeyssetvalue{/pgfplots/parent axis width}{\pgfkeysvalueof{/pgfplots/parent axis width}}% + \noexpand\pgfkeyssetvalue{/pgfplots/parent axis height}{\pgfkeysvalueof{/pgfplots/parent axis height}}% + \noexpand\pgfkeyssetvalue{/pgfplots/colorbar/width}{\pgfkeysvalueof{/pgfplots/colorbar/width}}% + \noexpand\pgfplots@colorbar@define@hook% + \noexpand\pgfkeysvalueof{/pgfplots/colorbar/draw/.@cmd}\noexpand\pgfeov + \noexpand\endgroup + \noexpand\pgfnodealias{current colorbar axis}{current axis}% + \noexpand\pgfnodealias{current axis}{parent axis}% + }% +}% +\let\pgfplots@colorbar@position@hook\relax +\def\pgfplots@colorbar@define@hook{% + \def\pgfplots@colorbar@position@hook{% + % I patch \pgfplots@at... + \let\pgfplots@at@orig=\pgfplots@at + % + % ... and I patch \pgfplotspointdescriptionxy (but only INSIDE + % of \pgfplots@at) ... + \let\pgfplotspointdescriptionxy@orig=\pgfplotspointdescriptionxy + \let\pgfplotsqpointdescriptionxy@orig=\pgfplotsqpointdescriptionxy + \def\pgfplots@colorbar@position@prepare@CS{% + % ... which needs to set up ONLY \pgfplotspoint@bb@@@, + % nothing more. + \pgfpointanchor{parent axis}{south west}% + \edef\pgfplotspoint@bb@@@{% + {\the\pgf@x}% + {\the\pgf@y}% + {\pgfkeysvalueof{/pgfplots/parent axis width}}% + {\pgfkeysvalueof{/pgfplots/parent axis height}}% + }% + }% + % + % Install replacements: + \def\pgfplots@at{% + \begingroup + \def\pgfplotspointdescriptionxy########1########2{% + \pgfplots@colorbar@position@prepare@CS + \pgfplotspointdescriptionxy@orig{########1}{########2}% + }% + \def\pgfplotsqpointdescriptionxy########1########2{% + \pgfplots@colorbar@position@prepare@CS + \pgfplotsqpointdescriptionxy@orig{########1}{########2}% + }% + \pgfplots@deprecated@anchorsfalse + \pgfplots@change@pgfpoints@to@descriptioncs + \pgf@process{\pgfplots@at@orig}% + \endgroup + }% + }% +}% + % Parses all options in #1 which are known in the currently active families. % % The result will be stored back into the TikZ-style named #1 without @@ -5360,26 +7669,34 @@ % #1: macro % #2: style name \long\def\pgfplots@append@keymacro@to@style#1#2{% - \t@pgfplots@toka={#2/.append style=}% - \t@pgfplots@tokb=\expandafter{#1}% - \edef\pgfplots@setkeys@TMP{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% - \expandafter\pgfplotsset\expandafter{\pgfplots@setkeys@TMP}% + \ifx#1\pgfutil@empty + \else + \t@pgfplots@toka={#2/.append style=}% + \t@pgfplots@tokb=\expandafter{#1}% + \edef\pgfplots@setkeys@TMP{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% + \expandafter\pgfplotsset\expandafter{\pgfplots@setkeys@TMP}% + \fi %\pgfplots@message{tikzstyle{#2}+=[#1]}% } % #1: macro % #2: style name \long\def\pgfplots@set@keymacro@to@style#1#2{% - \t@pgfplots@toka={#2/.style=}% - \t@pgfplots@tokb=\expandafter{#1}% - \edef\pgfplots@setkeys@TMP{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% - \expandafter\pgfplotsset\expandafter{\pgfplots@setkeys@TMP}% + \ifx#1\pgfutil@empty + \pgfplotsset{#2/.code={{}}}% + \else + \t@pgfplots@toka={#2/.style=}% + \t@pgfplots@tokb=\expandafter{#1}% + \edef\pgfplots@setkeys@TMP{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% + \expandafter\pgfplotsset\expandafter{\pgfplots@setkeys@TMP}% + \fi %\pgfplots@message{tikzstyle{#2}=[#1]}% } % backwards compatibility: \let\prettyprintnumber=\pgfmathprintnumber% + \def\pgfplots@set@options#1{% \pgfplots@bb@isactivetrue \pgfplots@curplot@threedimfalse @@ -5394,22 +7711,18 @@ % Temporarily assign families to 'name' and 'alias' options. % This allows to get the names - they should not be appended to % 'every axis'! - \pgfkeys{% - /tikz/name/.belongs to family=/pgfplots/naming commands, - /tikz/alias/.belongs to family=/pgfplots/naming commands, - % - % - /pgf/key filter handlers/append filtered to/.install key filter handler=\pgfplots@rmopts, - }% + \pgfkeyssetfamily{/tikz/name}{/pgfplots/naming commands}% + \pgfkeyssetfamily{/tikz/alias}{/pgfplots/naming commands}% + \pgfkeyssetfamily{/tikz/variable}{/pgfplots}% + \pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@rmopts}% + % \let\tikz@alias=\pgfutil@empty \let\tikz@fig@name=\pgfutil@empty % % Step 1: acquire ONLY 'xmode' and 'ymode' (necessary to decide % which axis style shall be loaded): \let\pgfplots@rmopts=\pgfutil@empty - \pgfkeysinstallkeyfilter - {/pgf/key filters/active families or no family} - {{/pgf/key filters/false}{/pgf/key filters/false}} + \pgfkeysinstallkeyfilter{/pgf/key filters/active families and known}{}% % \pgfqkeysactivatesinglefamilyandfilteroptions{/pgfplots/scale}% {/pgfplots} @@ -5418,14 +7731,10 @@ % % Step 2: parse any pgfplots options out of styles. \pgfkeysactivatefamily{/pgfplots/style commands}% - \pgfkeysinstallkeyfilter - {/pgf/key filters/active families or no family}% DEBUG} - {{/pgf/key filters/is descendant of=/pgfplots}% for keys without family - {/pgf/key filters/false}% for unknown keys - }% + \pgfkeysinstallkeyfilter{/pgf/key filters/active families or descendants of}{/pgfplots} % \pgfkeysactivatefamilies - {/pgfplots,/pgfplots/naming commands,/pgfplots/tick,/pgfplots/legend,/pgfplots/descriptions,/pgfplots/scale} + {/pgfplots,/pgfplots/naming commands,/pgfplots/tick,/pgfplots/legend,/pgfplots/scale}%/pgfplots/descriptions,} {\pgfplots@deactivefamiliescmd}% \pgfplots@set@keys@from@tikz@style{every axis}% \pgfkeysdeactivatefamily{/pgfplots/scale}% @@ -5487,16 +7796,22 @@ % be set in its context. % \pgfkeysactivatefamily{/pgfplots/legend}% + % this special treatmeant allows the (usually illegal construction) + % 'legend style={legend pos=outer north east}': + \pgfkeysdef{/pgfplots/every axis legend/.append style}{\pgfkeysalso{##1}}% + % \pgfplots@set@keys@from@tikz@style{every axis legend}% \pgfkeysdeactivatefamily{/pgfplots/legend}% % - % - \pgfkeysactivatefamily{/pgfplots/descriptions}% - \pgfplots@set@keys@from@tikz@style{every axis label}% - \pgfplots@set@keys@from@tikz@style{every axis x label}% - \pgfplots@set@keys@from@tikz@style{every axis y label}% - \pgfplots@set@keys@from@tikz@style{every axis title}% - \pgfkeysdeactivatefamily{/pgfplots/descriptions}% + % FIXME : VERIFY! + % If I am not mistaken, these statements are only useful to allow + % 'xlabel style={xlabel=$x$}' --- which is not intuitive anyway. + %\pgfkeysactivatefamily{/pgfplots/descriptions}% + % \pgfplots@set@keys@from@tikz@style{every axis label}% + % \pgfplots@set@keys@from@tikz@style{every axis x label}% + % \pgfplots@set@keys@from@tikz@style{every axis y label}% + % \pgfplots@set@keys@from@tikz@style{every axis title}% + %\pgfkeysdeactivatefamily{/pgfplots/descriptions}% % \pgfkeysactivatefamily{/pgfplots/tick}% \pgfplots@set@keys@from@tikz@style{every tick}% @@ -5513,18 +7828,21 @@ % \pgfkeysdeactivatefamily{/pgfplots}% %-------------------------------------------------- % - \pgfkeysactivatefamily{/pgfplots/descriptions}% + % Attention: do NOT set the description styles here! Setting them + % must be postponed until |every 3d description| has been set (to + % ensure that \axis[<options>] take higher precedence). + %\pgfkeysactivatefamily{/pgfplots/descriptions}% \pgfkeysactivatefamily{/pgfplots/tick}% \pgfplots@set@keys@from@tikz@style{every x tick label}% \pgfplots@set@keys@from@tikz@style{every y tick label}% \pgfplots@set@keys@from@tikz@style{every tick label}% \pgfkeysdeactivatefamily{/pgfplots/tick}% - \pgfkeysdeactivatefamily{/pgfplots/descriptions}% + %\pgfkeysdeactivatefamily{/pgfplots/descriptions}% % % Step 3: Set all remaining options of '#1'. They should have % highest precedence. \pgfkeysactivatefamilies - {/pgfplots,/pgfplots/tick,/pgfplots/legend,/pgfplots/descriptions}% + {/pgfplots,/pgfplots/tick,/pgfplots/legend}%,/pgfplots/descriptions}% {\pgfplots@deactivefamiliescmd}% \expandafter \pgfplots@set@keys@and@append@remaining@to@style @@ -5532,7 +7850,7 @@ {\pgfplots@remaining@input}% {every axis}% \pgfplots@deactivefamiliescmd -%\pgfkeysgetvalue{/tikz/every axis/.@cmd}\pgfplots@loc@TMPa +%\pgfkeysgetvalue{/pgfplots/every axis/.@cmd}\pgfplots@loc@TMPa %\message{every axis is now '\meaning\pgfplots@loc@TMPa'}% % \pgfkeysdeactivatefamily{/pgfplots/style commands}% @@ -5565,10 +7883,7 @@ \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{/pgfplots/.search also=/tikz}% } \def\pgfplots@install@abbrev@commands{ @@ -5582,6 +7897,7 @@ \let\addplot=\pgfplots@addplot \let\plot=\addplot % + % \def\logten{2.3025851}% \def\reciproclogten{0.434294}% % @@ -5605,7 +7921,9 @@ }% % \let\legend=\pgfplots@command@legend + \let\addlegendimage=\pgfplots@rememberplotspec \let\addlegendentry=\pgfplots@addlegendentry + \let\addlegendentryexpanded=\pgfplots@addlegendentryexpanded } \def\pgfplots@environment{% @@ -5629,7 +7947,6 @@ \newif\ifpgfplots@apply@datatrafo@z \newif\ifpgfplots@apply@datatrafo \newif\ifpgfplots@datascaletrafo@initialised -\newif\ifpgfplots@draw@at@end % Extracts single components of an entry of % \pgfplots@stored@plotlist @@ -5657,20 +7974,28 @@ % The implementation for \label{foo} after \addplot. It allows to % \ref{foo} (it inserts the 'legend image code'). % +% With +% \addplot[scatter/classes={a={}}] ... ; +% \label[a]{my label} +% you can reference scatter/classes labels. +% % I only need to overwrite '\label'; the rest is done by LaTeX. % % THIS IS INCOMPATIBLE WITH plain TeX and ConTeXt! Don't use it, it % doesn't hurt. -\def\pgfplots@plot@label#1{% - \ifx\pgfplots@last@plot@style\pgfutil@empty - \pgfplots@error{Can't create \string\label{#1}: it needs to be called after \string\addplot.}% - \else +\def\pgfplots@plot@label{\pgfutil@ifnextchar[{\pgfplots@plot@label@}{\pgfplots@plot@label@[]}}% +\def\pgfplots@plot@label@[#1]#2{% + \ifpgfplots@has@label@information \begingroup % I'd like to get all options which are INDEPENDENT of % pgfplots. Idea: expand all /pgfplots-keys and collect % everything which belongs NOT to /pgfplots. This is the % completely expanded rest. At least, I hope so and it appears % to work. + % + % FIXME : this was a good approach before. Now, there ARE + % /pgfplots keys which should be maintained. So: maintain all + % of them! Why should that pose any problems? \pgfkeysinstallkeyfilter {/pgf/key filters/and} {{/pgf/key filters/is descendant of=/pgfplots}% @@ -5678,31 +8003,60 @@ \def\pgfplots@label@tikzopts{}% \pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@label@tikzopts}% \def\pgfplots@loc@TMPa{\pgfqkeysfiltered{/tikz}}% - \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@last@plot@style}% + \expandafter\let\expandafter\pgfplots@loc@TMPb\csname pgfplots@last@plot@style@#1\endcsname + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@loc@TMPb}% % \pgfkeysgetvalue{/pgfplots/every crossref picture/.@cmd}{\pgfplots@crossref@pic}% \pgfkeysgetvalue{/pgfplots/legend image code/.@cmd}{\pgfplots@curlegendcode}% \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}: + % 1. prepare /pgfplots/refstyle={#2}: + \if@filesw \immediate\write\@auxout{% \noexpand\expandafter\noexpand\gdef - \noexpand\csname pgfplots@labelstyle@#1\noexpand\endcsname{\the\t@pgfplots@tokb}% + \noexpand\csname pgfplots@labelstyle@#2\noexpand\endcsname{\the\t@pgfplots@tokb}% }% - % 2. prepare \ref{#1} and \pageref{#1}: + % 2. prepare \ref{#2} and \pageref{#2}: + % + % There are several nasty things to consider: + % a) macro expansion. I did not really understand what happens + % here... I only understand that it is enough if the new label + % makes it into the .aux file of latex. That is sufficient for + % me! So, I converted the label command to a string using the + % \meaning functionality. + % + % b) \protect . If the resulting \ref{} command occurs within + % a "moving argument" like \caption or so, we need to use + % proper '\protect'ion. + % + % this here is the low-level implementation of \ref{#2}. Write it into + % the .aux file: + \immediate\write\@auxout{% + \noexpand\expandafter\noexpand\gdef + \noexpand\csname pgfplots@show@ref@#2\noexpand\endcsname{% + \noexpand\begingroup + \noexpand\pgfplots@define@currentplotstyle@as{\the\t@pgfplots@tokb}% + \noexpand\pgfkeysdef{/pgfplots/every crossref picture}{\the\t@pgfplots@tokc}% + \noexpand\tikz[/pgfplots/every crossref picture]{\the\t@pgfplots@toka}% + \noexpand\endgroup% + }% + }% + \fi + % This here is the high-level implementation \ref{#2}. + % The \protect handles the cases of "moving arguments": \edef\pgfplots@loc@TMPa{% - \noexpand\begingroup - \noexpand\pgfkeysdef{/tikz/current plot style}{\noexpand\pgfkeysalso{\the\t@pgfplots@tokb}}% - \noexpand\pgfkeysdef{/pgfplots/every crossref picture}{\the\t@pgfplots@tokc}% - \noexpand\tikz[/pgfplots/every crossref picture]{\the\t@pgfplots@toka}% - \noexpand\endgroup% + \noexpand\expandafter + \noexpand\protect + \noexpand\csname pgfplots@show@ref@#2\noexpand\endcsname }% \pgfplots@command@to@string{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPa}% \global\let\pgfplots@glob@TMPb=\pgfplots@loc@TMPa \endgroup \let\@currentlabel=\pgfplots@glob@TMPb - \pgfplots@original@LaTeX@label{#1}% + \pgfplots@original@LaTeX@label{#2}% + \else + \pgfplots@error{Can't create \string\label{#2}: it needs to be called after \string\addplot.}% \fi }% @@ -5710,6 +8064,64 @@ \def\pgfplots@interruptdatabb{\pgfplots@bb@isactivefalse} \def\endpgfplots@interruptdatabb{\pgfplots@bb@isactivetrue} +% A helper method which defines +% `/tikz/current plot style' to be {#1} --- with properly set key +% search paths. +\def\pgfplots@define@currentplotstyle@as#1{% + \pgfkeysdef{/tikz/current plot style}{% + % make sure the search path is set. + % Inside of an axis, this is already ok. + \pgfkeysifdefined{/pgfplots/.unknown/.@cmd}% + {\relax}% search path in /pgfplots is already set + {% +%\message{DEBUG: re-initializing /pgfplots/.search also=/tikz in current plot style!}% + \pgfkeysalso{/pgfplots/.search also=/tikz}% + }% + % + % Make sure that + % \addplot[every mark/.append style={...}] + % or something like that is interpreted as /tikz/ key: + \pgfplots@invoke@pgfkeyscode{/handler config/full or existing/.@cmd}{}% restrict + % set both, pgfplots and tikz keys: + \pgfplotsset{#1}% + \pgfplots@invoke@pgfkeyscode{/handler config/all/.@cmd}{}% unrestrict + % + % remember these technical things: they will be + % reset in \draw, so we will need to re-activate + % them. + % The re-activation is done in 'every path' (see below). + % FIXME : is that portable!? + \pgfplots@assert@tikzinternal@exists{tikz@options}% + \pgfplots@assert@tikzinternal@exists{tikz@mode}% + \let\pgfplots@drawoptions=\tikz@options + \let\pgfplots@drawmodes=\tikz@mode + % + % As of February 22, the final plot processing uses + % foreach stored \addplot command : + % \scope[current plot style] + % <finalize coord stream> + % \draw <finalized coord stream> + % \endscope + % -> the problem: \draw reset the modes 'draw,fill' etc which + % have been set in \scope! + % -> ad-hoc-solution: + % restore the modes manually. + % + % This is done here. The \pgfplots@drawmodes is ONLY set + % inside of this scope, so we can check for that particular + % case: + \pgfkeys{/tikz/every path/.append code={% + \pgfutil@ifundefined{pgfplots@drawmodes}% + {\relax}% + {% + \let\tikz@mode=\pgfplots@drawmodes +% \let\tikz@options=\pgfplots@drawoptions + }% + }% + }% + }% +}% + % % \begin{axis}[#1] : % @@ -5735,6 +8147,7 @@ % - The same for 'max'. % - \pgfplots@invalidrange@[xyz]min % \pgfplots@invalidrange@[xyz]max +% \pgfplots@invalidrange@meta[max,min] % A value which is used for the axis limits before the % limit computation starts. % - \pgfplots@data@[xyz]min @@ -5750,9 +8163,13 @@ % in the original data range. % - \pgfplots@metamin % \pgfplots@metamax +% \pgfplots@axiswide@metamin +% \pgfplots@axiswide@metamax % - if meta data is active, these macros will contain the upper -% and lower bound for meta data. +% and lower bound for meta data, the first two on a per-plot +% basis the latter to globally for the complete axis. % - will be assigned globally. +% - meta data is ALWAYS collected in floating point. % - \pgfplots@numplots % - A count register indexing the current plot counter. Assigned % globally. @@ -5834,7 +8251,7 @@ % '1pt' here as well. \pgfsetxvec{\pgfqpoint{1pt}{0pt}}% \pgfsetyvec{\pgfqpoint{0pt}{1pt}}% - \pgfsetzvec{\pgfqpoint{1.2pt}{1.2pt}}% + \pgfsetzvec{\pgfqpoint{0pt}{0pt}}% % \pgfplots@set@options{#1}% % @@ -5846,9 +8263,9 @@ % -------------------- % Option preprocessing % -------------------- - \pgfplots@prepare@coord@filtering@for x - \pgfplots@prepare@coord@filtering@for y - \pgfplots@prepare@coord@filtering@for z + \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 @@ -5882,6 +8299,10 @@ \def\pgfplots@invalidrange@zmin{16300}% \def\pgfplots@invalidrange@zmax{-16300}% \fi + \pgfmathfloatcreate{1}{1.0}{2147483645}% + \let\pgfplots@invalidrange@metamin=\pgfmathresult + \pgfmathfloatcreate{2}{1.0}{2147483645}% + \let\pgfplots@invalidrange@metamax=\pgfmathresult % % These numbers will ONLY be filled for linear axis! \global\let\pgfplots@data@xmin=\pgfplots@invalidrange@xmin @@ -5890,6 +8311,8 @@ \global\let\pgfplots@data@ymax=\pgfplots@invalidrange@ymax \global\let\pgfplots@data@zmin=\pgfplots@invalidrange@zmin \global\let\pgfplots@data@zmax=\pgfplots@invalidrange@zmax + \global\let\pgfplots@axiswide@metamin=\pgfplots@invalidrange@metamin + \global\let\pgfplots@axiswide@metamax=\pgfplots@invalidrange@metamax % \pgfplots@autocompute@all@limitstrue \ifx\pgfplots@xmin\pgfutil@empty @@ -5931,29 +8354,30 @@ \pgfplots@autocompute@all@limitsfalse \fi % + % check for axis-wide 'point meta min' : + \pgfkeysgetvalue{/pgfplots/point meta min}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \def\pgfplots@axiswide@metamin@autocompute{1}% + \else + \def\pgfplots@axiswide@metamin@autocompute{0}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \global\let\pgfplots@axiswide@metamin=\pgfmathresult + \fi + \pgfkeysgetvalue{/pgfplots/point meta max}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \def\pgfplots@axiswide@metamax@autocompute{1}% + \else + \def\pgfplots@axiswide@metamax@autocompute{0}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \global\let\pgfplots@axiswide@metamax=\pgfmathresult + \fi + % % -------------------- % Start axis: - % either postponed to \end or directly. + % start survey phase! % -------------------- % - % Since I've introduced a public \numplots macro, I should - % 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 - \pgfplots@draw@at@endtrue - \fi - \ifpgfplots@apply@datatrafo - % ALWAYS TRUE. This allows to use inline plots because the data - % scale transformation will be applied after I know that it should - % be disabled. - \pgfplots@draw@at@endtrue - \fi \ifpgfplots@stackedmode - % Stacked plots require special attention: they are drawn in - % REVERSE order. - \pgfplots@draw@at@endtrue \else % we have no stacked plots and thus no reversing. \pgfplots@stacked@reversefalse @@ -5963,18 +8387,14 @@ \let\pgfplots@original@LaTeX@label=\label \let\label=\pgfplots@plot@label }% - \global\let\pgfplots@last@plot@style=\pgfutil@empty + % + \global\pgfplots@has@label@informationfalse % % any \path command is invalid inside of an axis. % Use \axispath instead: \def\numplots{\the\pgfplots@numplots}% \let\path=\pgfplots@replacement@for@tikz@path \let\closedcycle=\pgfplots@path@closed@cycle - \ifpgfplots@draw@at@end - \else - \expandafter% remove the '\fi' - \pgfplots@BEGIN@init@and@draw@axis - \fi } % \end{axis} : @@ -5990,82 +8410,65 @@ \let\plot=\pgfplots@orig@plot % %\end{axis}: + % + % create a leight-weight 'current axis' node for anchor references + % (which may happen during both, the axis descriptions or any + % path/plot commands). + \pgfmultipartnode{pgfplots@low@level@shape@INNER}{image}{current axis}{\pgfusepath{discard}}% + % % -------------------- % 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 - \pgfplots@stacked@initialise - \global\pgfplotslistnewempty\pgfplots@stored@markerlist + \pgfplots@BEGIN@init@and@draw@axis + \pgfplots@stacked@initialise + \pgfplots@install@local@bar@handlers + \global\pgfplotslistnewempty\pgfplots@stored@markerlist + \ifpgfplots@stacked@reverse + % This here applies any scaling trafos and assembles a + % NEW \pgfplots@stored@plotlist! + \pgfplots@stacked@finalize@stored@plots + \fi + \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 sets all required variables needed to + % finalize a plot. + % @see the stream preparation routines. + \pgfplots@stored@current@precmd + \ifx\pgfplots@stored@current@cmd\pgfutil@empty + \pgfplots@stored@current@data% + \else + % this code here means we REALLY have a plotting + % command! + \scope[current plot style] % this does set BOTH pgfplots and tikz options. + % + % 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 - % This here applies any scaling trafos and assembles a - % NEW \pgfplots@stored@plotlist! - \pgfplots@stacked@finalize@stored@plots + % has already been processed above, in \pgfplots@stacked@finalize@stored@plots. + \pgfplots@stacked@draw@reversed@plot + \else + % modifies \pgfplots@stored@markerlist if necessary. + \expandafter\pgfplots@coord@stream@finalize@storedcoords@START\pgfplots@stored@current@data\pgfplots@EOI \fi - \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 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 - \else - % modifies \pgfplots@stored@markerlist if necessary. - \expandafter\pgfplots@coord@stream@finalize@storedcoords@START\pgfplots@stored@current@data\pgfplots@EOI - \fi - \fi - \pgfplots@stored@current@postcmd - }% - \global\pgfplotslistnewempty\pgfplots@stored@plotlist% delete contents. - }% - \else - \let\pgfplots@nextcommand=\relax - \fi - \pgfplots@nextcommand + \endscope + \fi + \pgfplots@stored@current@postcmd + }% + \global\pgfplotslistnewempty\pgfplots@stored@plotlist% delete contents. + % \pgfplots@END@init@and@draw@axis % + \pgfplots@create@axis@descriptions % - \begingroup - % set coordinate system to (0,0) rectangle (1,1) for descriptions: - \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 leight-weight 'current axis' node for anchor references. - \pgfmultipartnode{pgfplots@low@level@shape@INNER}{south west}{current axis}{\pgfusepath{discard}}% - % - \pgfplots@create@axis@descriptions - \pgfkeysvalueof{/pgfplots/extra description/.@cmd}\pgfeov% - \endgroup \endtikzpicture% \begingroup % Protocol sizes for the axis-shape. - % I fear that needs to be done globally, do avoid all those + % That needs to be done globally, do avoid all those % \endgroup's in and after \endpgfinterruptpicture ... \ifdim\pgf@picmaxx=-16000pt\relax% \pgf@picmaxx=0pt\relax% @@ -6077,7 +8480,11 @@ \xdef\pgfplots@saveddimen@picminx{\the\pgf@picminx}% \xdef\pgfplots@saveddimen@picminy{\the\pgf@picminy}% % - \pgfplotspointsouthwest + \ifpgfplots@deprecated@anchors + \pgfplotspointminminmin + \else + \pgfplotspointbblowerleft + \fi \pgf@xa=\pgf@x \advance\pgf@xa by-\pgf@picminx \xdef\pgfplots@savedanchor@inner@lowerleft@x{\the\pgf@xa}% @@ -6086,27 +8493,47 @@ \advance\pgf@xa by-\pgf@picminy \xdef\pgfplots@savedanchor@inner@lowerleft@y{\the\pgf@xa}% % - \pgf@xa=\pgfplots@ZERO@x - \advance\pgf@xa by-\pgf@picminx - \xdef\pgfplots@ZERO@x{\the\pgf@xa}% - % - \pgf@xa=\pgfplots@ZERO@y - \advance\pgf@xa by-\pgf@picminy - \xdef\pgfplots@ZERO@y{\the\pgf@xa}% + \pgfplotspointaxisorigin + \advance\pgf@x by-\pgf@picminx + \advance\pgf@y by-\pgf@picminy + \xdef\pgfplotspointaxisorigin{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% \endgroup \endpgfinterruptpicture \egroup\egroup% end of pgfnodepartimagebox % \let\tikz@fig@name=\pgfplots@fig@name \tikz@fig@mustbenamed + % + % restore any shift transformations provided to an axis. + % These would be lost otherwise. + \pgftransformshift{\pgfplots@savedtransformshift}% + % + % allow positioning of colorbars with this hook. + % It is \relax unless this here is a color bar axis. + % Its intention is to re-define `\pgfplots@at': + \pgfplots@colorbar@position@hook% + % \pgftransformshift{\pgfplots@at}% - \pgfmultipartnode{pgfplots@low@level@shape}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% + % + \ifpgfplots@deprecated@anchors + \pgfplots@restore@deprecated@lowlevel@shape + \pgfmultipartnode{pgfplots@low@level@shape@deprecated}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% + \else + \pgfmultipartnode{pgfplots@low@level@shape}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% + \fi \pgfplots@fig@alias \pgfnodealias{current axis}{\tikz@fig@name}% % \pgfplots@finally@correct@child@node@positions \pgfplots@stacked@finalize + % + \ifpgfplots@colorbar + \pgfplots@colorbar@move@outside@scope@with@globalmacro{\pgfplots@glob@TMPa}% + \else + \global\let\pgfplots@glob@TMPa=\relax + \fi \endgroup + \pgfplots@glob@TMPa } % Now, we need to process all named nodes inside of our @@ -6171,7 +8598,7 @@ \def\pgfplots@environment@axis{% \pgfutil@ifnextchar[{\pgfplots@@environment@axis}{\pgfplots@@environment@axis[]}% } -\let\endpgfplots@environment@axis=\endpgfplots@environment@opt +\def\endpgfplots@environment@axis{\endpgfplots@environment@opt} \def\pgfplots@@environment@axis[#1]{% \pgfplots@environment@opt[/pgfplots/xmode=linear,/pgfplots/ymode=linear,#1]% } @@ -6179,7 +8606,7 @@ \def\pgfplots@environment@semilogxaxis{% \pgfutil@ifnextchar[{\pgfplots@@environment@semilogxaxis}{\pgfplots@@environment@semilogxaxis[]}% } -\let\endpgfplots@environment@semilogxaxis=\endpgfplots@environment@opt +\def\endpgfplots@environment@semilogxaxis{\endpgfplots@environment@opt} \def\pgfplots@@environment@semilogxaxis[#1]{% \pgfplots@environment@opt[/pgfplots/xmode=log,/pgfplots/ymode=linear,#1]% } @@ -6187,7 +8614,7 @@ \def\pgfplots@environment@semilogyaxis{% \pgfutil@ifnextchar[{\pgfplots@@environment@semilogyaxis}{\pgfplots@@environment@semilogyaxis[]}% } -\let\endpgfplots@environment@semilogyaxis=\endpgfplots@environment@opt +\def\endpgfplots@environment@semilogyaxis{\endpgfplots@environment@opt} \def\pgfplots@@environment@semilogyaxis[#1]{% \pgfplots@environment@opt[/pgfplots/xmode=linear,/pgfplots/ymode=log,#1]% } @@ -6195,7 +8622,7 @@ \def\pgfplots@environment@loglogaxis{% \pgfutil@ifnextchar[{\pgfplots@@environment@loglogaxis}{\pgfplots@@environment@loglogaxis[]}% } -\let\endpgfplots@environment@loglogaxis=\endpgfplots@environment@opt +\def\endpgfplots@environment@loglogaxis{\endpgfplots@environment@opt} \def\pgfplots@@environment@loglogaxis[#1]{% \pgfplots@environment@opt[/pgfplots/xmode=log,/pgfplots/ymode=log,#1]% } |