diff options
author | Karl Berry <karl@freefriends.org> | 2013-03-27 23:45:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-03-27 23:45:11 +0000 |
commit | cfb1e943eb2782734fb13768cf8242e6a03aa904 (patch) | |
tree | 59470eac1319852a3b8726e3308923e0e1019bb5 /Master/texmf-dist/tex | |
parent | 02aa64ea1b6cd28f8217d06507a941c70d39dd9a (diff) |
pgfplots
git-svn-id: svn://tug.org/texlive/trunk@29531 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
42 files changed, 4608 insertions, 1110 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex index 63f24068c41..e73f87a59d2 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex @@ -1,5 +1,4 @@ %-------------------------------------------- -% $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/libs/pgflibrarysurfshading.code.tex,v 1.18 2009/06/26 17:56:58 ludewich Exp $ % % Package pgfplots % @@ -8,7 +7,7 @@ % % It is based on Till Tantau's PGF package. % -% Copyright 2007/2008 by Christian Feuersänger. +% Copyright 2007-2012 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 @@ -49,13 +48,20 @@ %-------------------------------------------------- +\newif\ifpgfplotslibrarysurf@updatebb +\newif\ifpgfplotslibrarysurf@usecolormap +\pgfplotslibrarysurf@updatebbtrue + \pgfkeys{% - % the extends need to provided as \pgfpoint... The boundary box - % won't be computed manually! - /pgfplots/surf shading/south west corner/.initial={\pgfpointorigin},% - /pgfplots/surf shading/north east corner/.initial={\pgfqpoint{6cm}{6cm}},% /pgfplots/surf shading/anchor/.initial=\pgfpointorigin,% /pgfplots/surf shading/shading type/.initial=5,% triangles in form of lattice + % + % If this is true, the embedding picture's bounding box will be updated using + % the shading's bounding box. + % This bounding box may be (highly!) inaccurate for coons shadings and tensor product shadings. + % The 'patch' plot handler disables it and takes control over it explicitly (using interpolation + % points rather than bezier control points). + /pgfplots/surf shading/update BB/.is if=pgfplotslibrarysurf@updatebb, % % can only have values '' (empty) for binary encoding or % ASCIIHexEncode for base 16 encoding. Use this if some driver @@ -84,8 +90,13 @@ /pgfplots/surf shading/precision/postscript/.style={% /pgfplots/surf shading/precision/ps},% /pgfplots/surf shading/precision/ps,% + % columns: /pgfplots/surf shading/cols/.initial=,% - /pgfplots/surf shading/colorspace/.initial=rgb,% rgb or cmyk + /pgfplots/surf shading/colorspace/.initial=rgb,% rgb or cmyk or gray + % + % the colormap. If this key is empty, we assume that individual + % color components are provided for EVERY vertex for which cdata + % is expected. /pgfplots/surf shading/colormap/.initial={% << /FunctionType 2 @@ -121,17 +132,46 @@ >> }% },% + /pgfplots/surf shading/debug text/.initial=\the\c@pgfplotslibrarysurf@no, + /pgfplots/surf shading/every debug coord/.style={ + circle, + draw, + fill=yellow, + }, + /pgfplots/surf shading/debug/.is choice, + /pgfplots/surf shading/debug/false/.code={% + \let\pgfplotslibrarysurfprocesscoordinate=\pgfplotslibrarysurfprocesscoordinate@orig + \let\pgfplotslibrarysurfusepath=\pgfplotslibrarysurfusepath@orig + }, + /pgfplots/surf shading/debug/true/.code={% + \let\pgfplotslibrarysurfprocesscoordinate=\pgfplotslibrarysurfprocesscoordinate@debug + \def\pgfplotslibrarysurfusepath{\pgfusepath{stroke,fill}} + }, + /pgfplots/surf shading/debug/.default=true, }% -\def\pgfplotslibrarysurf@corner@sw{\pgfkeysvalueof{/pgfplots/surf shading/south west corner}} -\def\pgfplotslibrarysurf@corner@ne{\pgfkeysvalueof{/pgfplots/surf shading/north east corner}}% +\def\pgfplotslibrarysurf@corner@sw{\pgfplots@error{This is unavailable until \string\pgfplotslibrarysurfstreamend}} +\let\pgfplotslibrarysurf@corner@ne\pgfplotslibrarysurf@corner@sw +% parametric colors (colormap) are always in [0,1000]. I +% 2 bytes suffice for that range. +\def\pgfplotslibrarysurf@bytespercomponent{2}% +\def\pgfplotslibrarysurf@bitspercomponent{16}% \def\pgfplotslibrarysurf@decode{% -16383.999992 16384 % see the docs of \pgfplotsbinaryencodedimenmaplinearly -16383.999992 16384 % + \pgfplotslibrarysurf@decode@colors +}% +\def\pgfplotslibrarysurf@decode@colors@colormap{% 0 \pgfplotscolormappdfmax % map [0,2^BitsPerComponent-1] linearly to [0 1] for parametric color data }% +\def\pgfplotslibrarysurf@decode@colors@explicit@one@component{% + % this is just one component for explicit color data. + % it will be replicated for every color component. + 0 1 % the target value for color component values. +}% + \def\pgfplotslibrarysurf@count{0}% \newcount\c@pgfplotslibrarysurf@no @@ -148,8 +188,7 @@ \def\pgfplotslibrarysurf@advancestreamlen#1{}% \def\pgfplotslibrarysurfstreamstart{% - \pgfplotslibrarysurf@translate@colorspace - \let\pgfplotslibrarysurf@colorspace=\pgfplotsretval + \pgfplotslibrarysurfstreamstart@init@colors \pgfkeysgetvalue{/pgfplots/surf shading/shading type}\pgfplotslibrarysurf@type \pgfplotsapplistXglobalnewempty\pgfplotslibrarysurf@binarystream@accum \pgfplotslibrarysurf@initstream @@ -157,6 +196,10 @@ \def\pgfplotslibrarysurf@filter@encode{binary encoding}% \fi \pgfkeysalso{/pgfplots/bin/\pgfplotslibrarysurf@filter@encode}% + % + \pgfplotsbinarysetbytes1% + \pgfplotsbinaryencodeunsigned{0}% use this method - it respects any special encodings. + \let\pgfplots@loc@TMPa=\pgfplotsbinaryresult \ifcase\pgfplotslibrarysurf@type\relax % 0 \pgfplotslibrarysurf@initstream@wrongtype @@ -167,7 +210,7 @@ \or% 3 \or% 4 % ok, triangle meshes. - \def\pgfplotslibrarysurf@edgeflag{\pgfplotscharno{0}}% + \let\pgfplotslibrarysurf@edgeflag=\pgfplots@loc@TMPa \or% 5 triangles in lattice form. disable edge flag: \let\pgfplotslibrarysurf@edgeflag=\pgfutil@empty \or% 6 coons patches: @@ -175,31 +218,92 @@ \global\c@pgfplotslibrarysurf@no=0 \def\pgfplotslibrarysurf@cubicpatch@numverts{12}% \let\pgfplotslibrarysurfstreamcoord=\pgfplotslibrarysurfstreamcoord@cubicpatch - \def\pgfplotslibrarysurf@edgeflag{\pgfplotscharno{0}}% + \let\pgfplotslibrarysurf@edgeflag=\pgfplots@loc@TMPa \or% 7 full tensor product cubic bezier patches: \global\let\pgfplotslibrarysurf@cubicpatch@cdata=\pgfutil@empty \global\c@pgfplotslibrarysurf@no=0 \def\pgfplotslibrarysurf@cubicpatch@numverts{16}% \let\pgfplotslibrarysurfstreamcoord=\pgfplotslibrarysurfstreamcoord@cubicpatch - \def\pgfplotslibrarysurf@edgeflag{\pgfplotscharno{0}}% + \let\pgfplotslibrarysurf@edgeflag=\pgfplots@loc@TMPa \else \pgfplotslibrarysurf@initstream@wrongtype \fi + % + % + % we want to establish a bounding box for THIS shading only! Otherwise the pdf XFORM might have a larger bounding box than we want. Is that ok here? Or does it hurt somewhere? + \pgf@getpathsizes{\pgfplots@loc@TMPa}% + \global\let\pgfplotslibrarysurf@pathsizes@before=\pgfplots@loc@TMPa }% + + +\def\pgfplotslibrarysurfstreamstart@init@colors{% + % + \pgfkeysgetvalue{/pgfplots/surf shading/colormap}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \pgfplotslibrarysurf@usecolormapfalse + \else + \pgfplotslibrarysurf@usecolormaptrue + \fi + % + \ifpgfplotslibrarysurf@usecolormap + \let\pgfplotslibrarysurf@decode@colors=\pgfplotslibrarysurf@decode@colors@colormap + \else + \pgfplotscolorspacegetcomponents{\pgfkeysvalueof{/pgfplots/surf shading/colorspace}}% + \c@pgf@counta=0 % + \c@pgf@countb=\pgfplotsretval\relax + % + \def\pgfplotslibrarysurf@decode@colors{}% + \pgfplotslibrarysurf@decode@colors@loop + \fi + % + \pgfplotslibrarysurf@translate@colorspace + \let\pgfplotslibrarysurf@colorspace=\pgfplotsretval +}% + +\def\pgfplotslibrarysurf@decode@colors@loop{% + \ifnum\c@pgf@counta<\c@pgf@countb + % + \edef\pgfplotslibrarysurf@decode@colors{% + \pgfplotslibrarysurf@decode@colors + \pgfplotslibrarysurf@decode@colors@explicit@one@component + }% + \advance\c@pgf@counta by1 % + % + \expandafter\pgfplotslibrarysurf@decode@colors@loop + \fi +}% + \def\pgfplotslibrarysurf@initstream@wrongtype{% \pgfplots@error{CRITICAL: shader=interp: got unsupported pdf shading type '\pgfplotslibrarysurf@type'. This may corrupt your pdf!}% }% \def\pgfplotslibrarysurfstreamend{% \pgfplotsapplistXgloballet\pgfplotslibrarysurf@binarystream=\pgfplotslibrarysurf@binarystream@accum \pgfplotsapplistXglobalnewempty\pgfplotslibrarysurf@binarystream@accum + % + \pgfplotslibrarysurfstreamend@set@BB +} + +\def\pgfplotslibrarysurfstreamend@set@BB{% + \xdef\pgfplotslibrarysurf@corner@sw{% + \global\pgf@x=\the\pgf@pathminx\space + \global\pgf@y=\the\pgf@pathminy\space + }% + \xdef\pgfplotslibrarysurf@corner@ne{% + \global\pgf@x=\the\pgf@pathmaxx\space + \global\pgf@y=\the\pgf@pathmaxy\space + }% + \pgf@setpathsizes\pgfplotslibrarysurf@pathsizes@before }% +% ATTENTION: see also \pgfplotslibrarysurfstreamcoord@cubicpatch % #1: a pgf point. % #2: a color coordinate in the range [0,1000] \def\pgfplotslibrarysurfstreamcoord#1#2{% \pgfplotsbinarysetbytes\pgfplotslibrarysurf@bytespercoordinate% + \pgfplotslibrarysurf@advancestreamlen{\pgfplotslibrarysurf@bytespercoordinate}% + \pgfplotslibrarysurf@advancestreamlen{\pgfplotslibrarysurf@bytespercoordinate}% %\pgf@process{#1}% this here causes `{retaining \pgf@x}' messages and pollutes the save stack! Avoid it. See \tracingrestores=2 - #1% + \pgfplotslibrarysurfprocesscoordinate{#1}% % The idea is to map % the low-level point coordinates LINEARLY into [0,2^{8*<bytes>}]. % @@ -223,9 +327,56 @@ \pgfplotsbinaryencodedimenmaplinearly\pgf@ya %\message{ENCODING(y=\the\pgf@y)=\pgfplotsbinaryresult.}% \t@pgfplots@tokb=\expandafter{\pgfplotsbinaryresult}% - {% + % + \pgfplotslibrarysurf@encode@cdata{#2}% +%\message{\pgfplotsbinaryresult.}% + \t@pgfplots@tokc=\expandafter{\pgfplotsbinaryresult}% + \ifx\pgfplotslibrarysurf@edgeflag\pgfutil@empty + \else + % for shading type 4, the edge flag is given for EVERY + % coordinate (unlike all other shading types). + \pgfplotslibrarysurf@advancestreamlen{1}% + \fi + \edef\pgfplots@loc@TMPa{\pgfplotslibrarysurf@edgeflag\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% + \expandafter\pgfplotsapplistXglobalpushback\pgfplots@loc@TMPa\to\pgfplotslibrarysurf@binarystream@accum +} + +% defines \pgfplotsbinaryresult to contain the result of a CDATA +% entry and advances the stream counters. +\def\pgfplotslibrarysurf@encode@cdata#1{% + \ifpgfplotslibrarysurf@usecolormap + \pgfplotslibrarysurf@map@to@FFF@colormap{#1}% + \else + % oh. No cdata. Ok, then encode stuff individually! + % We expect data of the form + % {<comma-separated-components>} + \edef\pgfplots@loc@TMPa{#1}% + \def\pgfplotsretval{}% + \expandafter\pgfplotslibrarysurf@encode@cdata@loop\pgfplots@loc@TMPa,,% + \let\pgfplotsbinaryresult=\pgfplotsretval + \fi +} + +\def\pgfplotslibrarysurf@encode@cdata@loop#1,{% + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + % + % + \pgfplotslibrarysurf@map@to@FFF@component{#1}% + \edef\pgfplotsretval{\pgfplotsretval\pgfplotsbinaryresult}% + % + % + % continue loop: + \expandafter\pgfplotslibrarysurf@encode@cdata@loop + \fi +}% + +% Defines \pgfplotsbinaryresult +\def\pgfplotslibrarysurf@map@to@FFF@colormap#1{% + \begingroup % read fixed point input (in the range [0,1000]). - \pgf@xa=#2pt + \pgf@xa=#1pt % % convert to integer (= *65536): \c@pgf@counta=\pgf@xa % provide map [0,1000] -> [0,2^16-1] @@ -242,14 +393,38 @@ % Now, we have CDATA in the range [0,65535] \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% %\message{ENCODING(C=\pgfplots@glob@TMPa\space for \the\pgf@xa)=}% - }% - \pgfplotsbinarysetbytes2% + \endgroup + \pgfplotsbinarysetbytes\pgfplotslibrarysurf@bytespercomponent% \pgfplotsbinaryencodeunsigned\pgfplots@glob@TMPa -%\message{\pgfplotsbinaryresult.}% - \t@pgfplots@tokc=\expandafter{\pgfplotsbinaryresult}% - \edef\pgfplots@loc@TMPa{\pgfplotslibrarysurf@edgeflag\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% - \expandafter\pgfplotsapplistXglobalpushback\pgfplots@loc@TMPa\to\pgfplotslibrarysurf@binarystream@accum - \pgfplotslibrarysurf@advancestreamlen{10}% + \pgfplotslibrarysurf@advancestreamlen{\pgfplotslibrarysurf@bytespercomponent}% +} + +% Defines \pgfplotsbinaryresult +\def\pgfplotslibrarysurf@map@to@FFF@component#1{% + \begingroup + % read fixed point input (in the range [0,1]). + \pgf@xa=#1pt % + % convert to integer (= *65536): + \c@pgf@counta=\pgf@xa + % provide map [0,1] -> [0,2^16-1] + % well, there is nothing to do! it was in [0,1], we multiplied by 65536 implicitly... that's it. + % + % now, we have \c@pgf@counta in [0,2^16]. Simply strip it into + % the required range, that's ok. + \ifnum\c@pgf@counta<0 + \c@pgf@counta=0 + \else + \ifnum\c@pgf@counta>65535 + \c@pgf@counta=65535 + \fi + \fi + % Now, we have CDATA in the range [0,65535] + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% +%\message{ENCODING(C=\pgfplots@glob@TMPa\space for \the\pgf@xa)=}% + \endgroup + \pgfplotsbinarysetbytes\pgfplotslibrarysurf@bytespercomponent% + \pgfplotsbinaryencodeunsigned\pgfplots@glob@TMPa + \pgfplotslibrarysurf@advancestreamlen{\pgfplotslibrarysurf@bytespercomponent}% } \def\pgfplotslibrarysurf@translate@colorspace{% @@ -267,13 +442,61 @@ \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPd \def\pgfplotsretval{CMY}% \else - \pgfplots@error{Sorry, the 'surfshading' lib failed to recognise the '/pgfplots/surf shading=\pgfplots@loc@TMPd\space choice... maybe you misspelled it?}% - \def\pgfplotsretval{RGB}% + \def\pgfplots@loc@TMPa{gray}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPd + \def\pgfplotsretval{Gray}% + \else + \pgfplots@error{Sorry, the 'surfshading' lib failed to recognise the choice '/pgfplots/surf shading/colorspace=\pgfplots@loc@TMPd'... maybe you misspelled it?}% + \def\pgfplotsretval{RGB}% + \fi \fi \fi \fi }% +\def\pgfplotslibrarysurfusepath{\pgfusepath{fill}} +\let\pgfplotslibrarysurfusepath@orig=\pgfplotslibrarysurfusepath + +% We DO want to protocol the size of the shading. In fact, we NEED a +% bounding box which contains the whole shading, otherwise it will be +% clipped. More precisely, it will be packed into a pdf XForm object +% and that appears to need a correct bounding box. +% +% But we do NOT want to update the picture's bounding box, only that +% of the pdf XForm. The picture's bounding box will be updated as soon +% as we *use* the shading anyway (in +% \pgfplotslibrarysurfdrawinpicture). This here takes care of that detail: +\def\pgfplotslibrarysurf@protocolsizes@#1#2{% + \ifpgf@relevantforpicturesize + \pgfplots@loc@tmptrue + \else + \pgfplots@loc@tmpfalse + \fi + \pgf@relevantforpicturesizefalse + \pgf@protocolsizes{#1}{#2}% + \ifpgfplots@loc@tmp + \pgf@relevantforpicturesizetrue + \fi +}% + +\def\pgfplotslibrarysurfprocesscoordinate#1{% + #1\relax% + \pgfplotslibrarysurf@protocolsizes@{\pgf@x}{\pgf@y}% +}% +\let\pgfplotslibrarysurfprocesscoordinate@orig=\pgfplotslibrarysurfprocesscoordinate% + +\def\pgfplotslibrarysurfprocesscoordinate@debug#1{% + \pgfinterruptpath + \scope + \pgftransformshift{#1}% + \node[/pgfplots/surf shading/every debug coord] at (0pt,0pt) {\pgfkeysvalueof{/pgfplots/surf shading/debug text}};% + \endscope + \endpgfinterruptpath + #1\relax% + \pgfplotslibrarysurf@protocolsizes@{\pgf@x}{\pgf@y}% +}% + +% ATTENTION: see also \pgfplotslibrarysurfstreamcoord % special routine for coons type patches and cubic tensor product type % patches. It has FIRST all vertices, % THEN the cdata. Furthermore, it only has 4 CDATA points, but a total @@ -283,8 +506,10 @@ % #2: a color coordinate in the range [0,1000] \def\pgfplotslibrarysurfstreamcoord@cubicpatch#1#2{% \pgfplotsbinarysetbytes\pgfplotslibrarysurf@bytespercoordinate% + \pgfplotslibrarysurf@advancestreamlen{\pgfplotslibrarysurf@bytespercoordinate}% + \pgfplotslibrarysurf@advancestreamlen{\pgfplotslibrarysurf@bytespercoordinate}% %\pgf@process{#1}% this here causes `{retaining \pgf@x}' messages and pollutes the save stack! Avoid it. See \tracingrestores=2 - #1% + \pgfplotslibrarysurfprocesscoordinate{#1}% % The idea is to map % the low-level point coordinates LINEARLY into [0,2^{8*<bytes>}]. % @@ -313,6 +538,7 @@ \def\pgfplotslibrarysurf@cubicpatch@hascdata{1}% % prepend edge flag. it is a new patch. \t@pgfplots@toka=\expandafter{\expandafter\pgfplotslibrarysurf@edgeflag\the\t@pgfplots@toka}% + \pgfplotslibrarysurf@advancestreamlen{1}% \else \ifnum\c@pgfplotslibrarysurf@no=3 \def\pgfplotslibrarysurf@cubicpatch@hascdata{1}% @@ -327,28 +553,8 @@ \fi \fi \if1\pgfplotslibrarysurf@cubicpatch@hascdata - {% - % read fixed point input (in the range [0,1000]). - \pgf@xa=#2pt - % convert to integer (= *65536): - \c@pgf@counta=\pgf@xa - % provide map [0,1000] -> [0,2^16-1] - \divide\c@pgf@counta by1000 - % now, we have \c@pgf@counta in [0,2^16]. Simply strip it into - % the required range, that's ok. - \ifnum\c@pgf@counta<0 - \c@pgf@counta=0 - \else - \ifnum\c@pgf@counta>65535 - \c@pgf@counta=65535 - \fi - \fi - % Now, we have CDATA in the range [0,65535] - \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% - %\message{ENCODING(C=\pgfplots@glob@TMPa\space for \the\pgf@xa)=}% - }% - \pgfplotsbinarysetbytes2% - \pgfplotsbinaryencodeunsigned\pgfplots@glob@TMPa + % + \pgfplotslibrarysurf@encode@cdata{#2}% %\message{\pgfplotsbinaryresult.}% \t@pgfplots@tokc=\expandafter{\pgfplotslibrarysurf@cubicpatch@cdata}% \xdef\pgfplotslibrarysurf@cubicpatch@cdata{% @@ -369,7 +575,6 @@ % vertex) \edef\pgfplots@loc@TMPa{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% \expandafter\pgfplotsapplistXglobalpushback\pgfplots@loc@TMPa\to\pgfplotslibrarysurf@binarystream@accum - %\pgfplotslibrarysurf@advancestreamlen{10}% } \def\pgfplotslibrarysurfactivateshadefill{% @@ -386,9 +591,28 @@ \def\pgfplotslibrarysurfdrawinpicture{% \begingroup - \pgftransformshift{\pgfplotslibrarysurf@corner@sw}% - \pgftext[at=\pgfqpoint{0pt}{0pt},left,bottom] {% + % this statement will modify both the picture's BB and the path's BB + % unless we take control. + % + % Note that the path's BB will eventually be updated into the + % picture's BB as well (meaning that 'overlay' is of no use inside + % of this group). + % + % Implement the 'surf shading/update BB' functionality here: + \let\pgfplots@@protocolsizes=\pgf@protocolsizes + \ifpgfplotslibrarysurf@updatebb + \else + % NO update to any BB. this implies 'overlay' + % *and* disables updates to the path's BB. + \def\pgf@protocolsizes##1##2{\relax}% + \fi + \pgftext[at=\pgfplotslibrarysurf@corner@sw,left,bottom] {% + \begingroup + % inside of this box, we *always* need bounding boxes. + % restore functionality. + \let\pgf@protocolsizes=\pgfplots@@protocolsizes \pgfplotslibrarysurfdraw + \endgroup % this does NOT work because I can't undo the box' shift: %\pgfplotssys@do@surfshading }% diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex index 4923e310c5b..94344c62860 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex @@ -40,6 +40,10 @@ }{% \def\pgfplots@glob@TMPa{0}% }% +\pgfutil@ifundefined{tikzexternal@getnextfilename@resetglobals}{% + \def\pgfplots@glob@TMPa{0}% +}{}% + \if1\pgfplots@glob@TMPa \usetikzlibrary{external}% \else diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex index dd7a735e252..74f7cd56a43 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex @@ -127,6 +127,12 @@ },% /tikz/trim axis group right/.style={/pgfplots/trim axis group right}, } +\pgfkeys{ + /pgfplots/warning/groupplots/too many plots/.code 2 args={% + \pgfplotsthrow@warning{You are adding more plots than you specified, current plots=#1\space vs. total allowed + plots=#2.}% + }, +} \def\nextgroupplot{% \pgfutil@ifnextchar[{\pgfplots@group@nextplot}{\pgfplots@group@nextplot[]}%} @@ -138,8 +144,7 @@ \def\pgfplots@group@nextplot[#1]{% % Check if it legal to produce another plot \ifnum\pgfplots@group@current@plot=\pgfplots@group@totalplots\relax - \pgfplots@warning{You are adding more plots than you specified, current plots=\the\pgfplots@group@current@plot\space vs. total allowed - plots=\pgfplots@group@totalplots.} + \pgfplotswarning{groupplots/too many plots}{\the\pgfplots@group@current@plot}{\pgfplots@group@totalplots}\pgfeov \else % % If there has been other plots before then end the plot diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex index 933f48854d2..9e885f380ba 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex @@ -64,10 +64,8 @@ % segmment, <right> the function value at the right end, and <middle> % the function value in the middle of the spline segment. \pgfplotsdeclarepatchclass{quadratic spline}{% - allow matrix=0, - uses view depth=0, - get dimension=1, - supports global path=1, + get dimension=\def\pgfplotsretval{1}, + supports global path=\def\pgfplotsretval{1}, new=\def\pgfplotspatchclass@qspline@no{A}, set next vertex={% % EXPECTED ORDERING: first 2 corners, then 1 mid nodes @@ -148,7 +146,7 @@ \pgfplotsplothandlermesh@setlastpoint{\expandafter\pgfplotspointpatchvertex\PC\endvertex}% \endgroup }, - triangulate class=line, + triangulate class=\def\pgfplotsretval{line}, triangulate={% \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass \def\pgfplotsplothandlermesh@patchclass{line}% @@ -185,14 +183,12 @@ % },% get pdf shading type=0, - get num vertices=3, + get num vertices=\def\pgfplotsretval{3}, }% \pgfplotsdeclarepatchclass{cubic spline}{% - allow matrix=0, - uses view depth=0, - get dimension=1, - supports global path=1, + get dimension=\def\pgfplotsretval{1}, + supports global path=\def\pgfplotsretval{1}, new=\def\pgfplotspatchclass@cspline@no{A}, set next vertex={% % EXPECTED ORDERING: first 2 corners, then 1 mid nodes @@ -256,7 +252,7 @@ {\pgfplotspatchclass@cspline@B}% \pgfplotsplothandlermesh@setlastpoint{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@B\endvertex}% }, - triangulate class=line, + triangulate class=\def\pgfplotsretval{line}, triangulate={% \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass \def\pgfplotsplothandlermesh@patchclass{line}% @@ -347,7 +343,7 @@ #1% }, get pdf shading type=0, - get num vertices=4, + get num vertices=\def\pgfplotsretval{4}, }% \def\pgfplotspathcubicfrominterpolation#1#2#3#4{% @@ -407,8 +403,7 @@ % A 3-point interpolatory patch which draws quadratic polynomial % splines (functions f(x), x 1d). \pgfplotsdeclarepatchclass{triangle quadr}{% - allow matrix=0, - uses view depth=1, + uses view depth=\def\pgfplotsretval{1},% used by the shader: we reorder corners. new=\def\pgfplotspatchclass@qtri@no{A}\let\pgfplotspatchclass@qtrie@AB\relax, set next vertex={% % EXPECTED ORDERING: first 3 corners, then 3 mid nodes. @@ -474,6 +469,11 @@ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@E\endvertex #1% \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@F\endvertex #1% }, + foreach cdata vertex={% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@A\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@B\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@C\endvertex #1% + }, fill path={% \begingroup % Draw the patch boundary using three bezier curves. @@ -811,7 +811,8 @@ % },% get pdf shading type=6, - get num vertices=6, + get num vertices=\def\pgfplotsretval{6}, + get num cdata vertices=\def\pgfplotsretval{3}, }% @@ -902,7 +903,7 @@ % bilinear is the same as 'rectangle', but it uses a different shader. \pgfplotsdeclarepatchclass{bilinear}{% - allow matrix=1, + allow matrix=\def\pgfplotsretval{1}, new=\def\pgfplotspatchclass@rect@no{0}, set next vertex={% \ifcase\pgfplotspatchclass@rect@no\relax @@ -1004,29 +1005,12 @@ \pgfplotscoordmath{meta}{parsenumber}{0.25}% \let\pgfplots@loc@scale=\pgfmathresult % - \pgf@xa=0pt - \pgf@ya=0pt - \pgf@yb=0pt - \pgfplotscoordmath{meta}{zero}% - \def\pgfplots@loc@accum@mean{% - \advance\pgf@xa by\pgfplotspatchvertexx\relax - \advance\pgf@ya by\pgfplotspatchvertexy\relax - \pgfplotscoordmath{meta}{op}{add}{{\pgfmathresult}{\pgfplotspatchvertexmeta}}% - \ifx\pgfplotspatchvertexdepth\pgfutil@empty - \else - \advance\pgf@yb by\pgfplotspatchvertexdepth pt\relax - \fi - }% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex \pgfplots@loc@accum@mean% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@B\endvertex \pgfplots@loc@accum@mean% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@C\endvertex \pgfplots@loc@accum@mean% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@D\endvertex \pgfplots@loc@accum@mean% - % - \divide\pgf@xa by4 - \divide\pgf@ya by4 - \divide\pgf@yb by4 - \pgfplotscoordmath{meta}{op}{multiply}{{\pgfmathresult}{\pgfplots@loc@scale}}% - \edef\pgfplotspatchclass@rect@M{{\the\pgf@xa}{\the\pgf@ya}{\pgfmathresult}\ifx\pgfplotspatchvertexdepth\pgfutil@empty\else \pgf@sys@tonumber\pgf@yb\fi:}% + \pgfplotspatchvertexaccumstart + \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@A\endvertex\times{0.25}% + \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@B\endvertex\times{0.25}% + \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@C\endvertex\times{0.25}% + \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@rect@D\endvertex\times{0.25}% + \pgfplotspatchvertexfinish\pgfplotspatchclass@rect@M % \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass \def\pgfplotsplothandlermesh@patchclass{triangle}% @@ -1062,7 +1046,7 @@ serialize except vertices=\let\pgfplotsretval\pgfutil@empty,% deserialize except vertices=, get pdf shading type=6, - get num vertices=4, + get num vertices=\def\pgfplotsretval{4}, }% \pgfplotsdeclarepatchclass{rectangle}{% @@ -1202,7 +1186,7 @@ serialize except vertices=\let\pgfplotsretval\pgfutil@empty,% deserialize except vertices=, get pdf shading type=4, - get num vertices=\pgfkeysvalueof{/pgfplots/vertex count}, + get num vertices=\def\pgfplotsretval{\pgfkeysvalueof{/pgfplots/vertex count}}, }% \def\pgfplotspatchclass@poly@checkcount{% \ifnum\pgfkeysvalueof{/pgfplots/vertex count}>0 @@ -1271,7 +1255,6 @@ % i*(1 - xi^2) (1 - eta^2) % here, a,b,...,i are the 9 nodes. \pgfplotsdeclarepatchclass{biquadratic}{% - allow matrix=0, new=\def\pgfplotspatchclass@biquad@no{A}\let\pgfplotspatchclass@biquade@AB\relax, set next vertex={% % defines \pgfplotspatchclass@biquad@A ... \pgfplotspatchclass@biquad@I (9 points) @@ -1325,6 +1308,12 @@ \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@H\endvertex #1% \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@I\endvertex #1% }, + foreach cdata vertex={% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@A\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@B\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@C\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@D\endvertex #1% + }, fill path={% \begingroup % Visualize the patch boundary using four bezier curves. @@ -1407,36 +1396,235 @@ %-------------------------------------------------- stream to shader={% \begingroup + % + % An early version of this shader used Coons patch shadings + % (which provides coordinates only for the 9 boundary + % vertices, not for the inner vertices). That is a little bit + % simpler than what you see in the following lines of code: a + % transformation to a tensor bezier shading. + % + % What we need is to map the 3x3 data from lagrangrian + % (interpolation) representation to 4x4 cubic bezier - and + % handle the four INNER nodes correctly. + % + % The algorithm to convert from 1d curves with 3 point langrange to 4 point + % bezier is well-known and relatively simple. Fortunately, the + % extension to 3x3 -> 4x4 can be boiled down to a successive + % application of the 1d algorithm - applied to horizontal and + % vertical lines in the data matrizes. + % + % NOTE: the algorithm in the following lines results in + % EXACTLY THE SAME four cubic boundary curves as the approach + % in 'fill path'. The only difference is that it also does the + % right thing for the inner node. + % + % STEP 1: ensure that the patch's coordinates are streamed in + % a sequence which is compatible with the DEPTH of the + % corners. + % + % we use + % \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth + % which works for bilinear, biquadratic, and bicubic \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth {pgfplotspatchclass@biquad@}{\Pcur}{\Pnextseq}% % - \let\Pstartidx\Pcur% - \pgfutil@namelet{Pstart}{pgfplotspatchclass@biquad@\Pcur}% + % STEP 2: + % now, translate the result into our matrix form. + % This means to (a) identify the FIRST point which needs to be + % streamed (it is stored in \Pcur as 'A', 'B', 'C', or 'D') + % and (b) keep in mind that we have to take care of the + % sequence in which points are streamed ("forward" means to + % rotate the matrix elements and "backward" means to transpose + % the "forward" result). % - % create a tensor cubic bezier patch. + % This can be seen as conversion from the "linearized" + % numbering to matrix indexing - while respecting the "start + % point". % - % Again, the outer boundary involves a map from 3 point lagrange - % representation to 4 point cubic bezier. + % INPUT: % - % The main complication arises to support the INNER node (\pgfplotspatchclass@biquad@I) . - % We need the four inner bezier control points to get it - % correctly. + % D G C + % H I F + % A E B % - % this here handles only the OUTER shaper. It is the same as - % for 'fill path'. - % See 'fill path' for docs. + \if A\Pcur + % Ah - the point "A" needs to be streamed as first. + % + % Well, this is simple: take the matrix as-is! + % simply copy 1:1 + % + % i.e. convert + % D G C + % H I F + % A E B + % + % to + % + % AC BC CC + % AB BB CB + % AA BA CA + \let\P@AA=\pgfplotspatchclass@biquad@A + \let\P@BA=\pgfplotspatchclass@biquad@E + \let\P@CA=\pgfplotspatchclass@biquad@B + \let\P@AB=\pgfplotspatchclass@biquad@H + \let\P@BB=\pgfplotspatchclass@biquad@I + \let\P@CB=\pgfplotspatchclass@biquad@F + \let\P@AC=\pgfplotspatchclass@biquad@D + \let\P@BC=\pgfplotspatchclass@biquad@G + \let\P@CC=\pgfplotspatchclass@biquad@C + \fi + \if B\Pcur + % the "B" point needs to be streamed as first. + % + % i.e. reorder + % D G C + % H I F + % A E B + % + % to + % A H D AC BC CC + % E I G =: AB BB CB + % B F C AA BA CA + % + \let\P@AA=\pgfplotspatchclass@biquad@B + \let\P@BA=\pgfplotspatchclass@biquad@F + \let\P@CA=\pgfplotspatchclass@biquad@C + \let\P@AB=\pgfplotspatchclass@biquad@E + \let\P@BB=\pgfplotspatchclass@biquad@I + \let\P@CB=\pgfplotspatchclass@biquad@G + \let\P@AC=\pgfplotspatchclass@biquad@A + \let\P@BC=\pgfplotspatchclass@biquad@H + \let\P@CC=\pgfplotspatchclass@biquad@D + \fi + \if C\Pcur + % the "C" point needs to be streamed as first. + % + % i.e. reorder + % D G C + % H I F + % A E B + % + % to + % B E A AC BC CC + % F I H =: AB BB CB + % C G D AA BA CA + % + \let\P@AA=\pgfplotspatchclass@biquad@C + \let\P@BA=\pgfplotspatchclass@biquad@G + \let\P@CA=\pgfplotspatchclass@biquad@D + \let\P@AB=\pgfplotspatchclass@biquad@F + \let\P@BB=\pgfplotspatchclass@biquad@I + \let\P@CB=\pgfplotspatchclass@biquad@H + \let\P@AC=\pgfplotspatchclass@biquad@B + \let\P@BC=\pgfplotspatchclass@biquad@E + \let\P@CC=\pgfplotspatchclass@biquad@A + \fi + \if D\Pcur + % the "D" point needs to be streamed as first. + % + % i.e. reorder + % D G C + % H I F + % A E B + % + % to + % C F B AC BC CC + % G I E =: AB BB CB + % D H A AA BA CA + % + \let\P@AA=\pgfplotspatchclass@biquad@D + \let\P@BA=\pgfplotspatchclass@biquad@H + \let\P@CA=\pgfplotspatchclass@biquad@A + \let\P@AB=\pgfplotspatchclass@biquad@G + \let\P@BB=\pgfplotspatchclass@biquad@I + \let\P@CB=\pgfplotspatchclass@biquad@E + \let\P@AC=\pgfplotspatchclass@biquad@C + \let\P@BC=\pgfplotspatchclass@biquad@F + \let\P@CC=\pgfplotspatchclass@biquad@B + \fi + \ifx\Pnextseq\pgfutil@empty + \else + % reverse the ordering. This means to transpose the + % matrix: + \pgfplotspatchclass@biquad@transpose + \fi + % + % + % Step: convert to tensor bezier representation. + % + % Converting a 2d tensor product lagrangian interpoland to a + % 2d tensor product bezier interpoland can be achieved by + % means of 1d algorithms along LINES in the matrix. + % + % The underlying proof for this is related to the tensor + % product form: the U and V coordinates are orthogonal to each + % other, so we can redistribute all intermediate results. (I + % do not have the real proof, so this hand-waving argument has + % to be enough). I verified its results experimentally. + % + % Note that the underlying 1d operation is the same as for + % 'patch type=quadratic spline' . We only need to apply it to all + % lines in U direction and afterwards to all lines in V + % direction. % - \pgfplotspatchclass@biquad@coonsedge + \def\pgfplotspatchvertexaddXY@expanded##1\times{% + \edef\pgfplots@loc@TMPa{##1}% + \expandafter\pgfplotspatchvertexaddXY\pgfplots@loc@TMPa\times + }% % - \pgfplotspatchclass@biquad@coonsedge + % this macro operates on \pgfplots@line{[ABC]} and defines + % \pgfplots@line{[ABCD]} (i.e. one dimension more!) + \def\pgfplots@apply@to@line{% + \pgfplotspatchvertexaccumstart + \pgfplotspatchvertexaddXY@expanded\pgfplots@line{B}\times{1.333333}% + \pgfplotspatchvertexaddXY@expanded\pgfplots@line{C}\times{-0.333333}% + \pgfplotspatchvertexfinish\pgfplots@controlpoint@A + % + \pgfplotspatchvertexaccumstart + \pgfplotspatchvertexaddXY@expanded\pgfplots@line{A}\times{-0.333333}% + \pgfplotspatchvertexaddXY@expanded\pgfplots@line{B}\times{1.333333}% + \pgfplotspatchvertexfinish\pgfplots@controlpoint@B + % + % ... we output 4 points (cubic!). + % A= left endpoint (untouched) + % B= first control + % C= second control + % D= right endpoint (untouched, is formerly called 'C') + \edef\pgfplots@loc@TMPa{\pgfplots@line{C}}% + \expandafter\expandafter\expandafter\let\pgfplots@line{B}=\pgfplots@controlpoint@A + \expandafter\expandafter\expandafter\let\pgfplots@line{C}=\pgfplots@controlpoint@B + \expandafter\expandafter\expandafter\let\pgfplots@line{D}=\pgfplots@loc@TMPa + }% % - \pgfplotspatchclass@biquad@coonsedge + \def\pgfplots@line##1{\csname P@##1A\endcsname}% + \pgfplots@apply@to@line % - \pgfplotspatchclass@biquad@coonsedge + \def\pgfplots@line##1{\csname P@##1B\endcsname}% + \pgfplots@apply@to@line % - % FIXME: - % \pgfplotspatchclass@biquad@innercontrolpoints + \def\pgfplots@line##1{\csname P@##1C\endcsname}% + \pgfplots@apply@to@line + % + % Now, we have a 3x4 matrix. + % + % + \def\pgfplots@line##1{\csname P@A##1\endcsname}% + \pgfplots@apply@to@line % + \def\pgfplots@line##1{\csname P@B##1\endcsname}% + \pgfplots@apply@to@line + % + \def\pgfplots@line##1{\csname P@C##1\endcsname}% + \pgfplots@apply@to@line + % + \def\pgfplots@line##1{\csname P@D##1\endcsname}% + \pgfplots@apply@to@line + % + % OK. The tensor product representation is READY. + % + % in particular, we have a 4x4 matrix right now: + % + \pgfplotsplothandlermesh@shade@cubic@tensor \endgroup },% triangulate={% @@ -1749,10 +1937,22 @@ #1% % },% - get pdf shading type=6, - get num vertices=9, + get pdf shading type*={% + \if1\b@pgfplotsplothandlermesh@enable@fixed@biquadratic + \def\pgfplotsretval{7}% + \else + \def\pgfplotsretval{6}% + \fi + },% + get num vertices=\def\pgfplotsretval{9}, + get num cdata vertices=\def\pgfplotsretval{4}, }% +% set this to 0 to revert to an older implementation (which was buggy, +% though) +\def\b@pgfplotsplothandlermesh@enable@fixed@biquadratic{1}% + + % see docs in 'biquadratic::stream to shader' for details. % PRECONDITION: to be used inside of 'stream to shader'. \def\pgfplotspatchclass@biquad@coonsedge{% @@ -1881,7 +2081,6 @@ % Direct interface to coons patches (pdf shading type 6). % See manual and/or pdf reference \pgfplotsdeclarepatchclass{coons}{% - allow matrix=0, new=\def\pgfplotspatchclass@coons@no{A}, set next vertex={% % defines \pgfplotspatchclass@coons@A ... \pgfplotspatchclass@coons@L (12 points) @@ -1934,14 +2133,13 @@ serialize except vertices=\let\pgfplotsretval\pgfutil@empty,% deserialize except vertices=, get pdf shading type=6, - get num vertices=12, - get num cdata vertices=4, + get num vertices=\def\pgfplotsretval{12}, + get num cdata vertices=\def\pgfplotsretval{4}, }% % Direct interface to tensor product bezier patches (pdf shading type 7). % See manual and/or pdf reference \pgfplotsdeclarepatchclass{tensor bezier}{% - allow matrix=0, new=\def\pgfplotspatchclass@tensor@no{A}, set next vertex={% % defines \pgfplotspatchclass@tensor@A ... \pgfplotspatchclass@tensor@P (16 points) @@ -1998,8 +2196,8 @@ serialize except vertices=\let\pgfplotsretval\pgfutil@empty,% deserialize except vertices=, get pdf shading type=7, - get num vertices=16, - get num cdata vertices=4, + get num vertices=\def\pgfplotsretval{16}, + get num cdata vertices=\def\pgfplotsretval{4}, }% % A bicubic patch with 16 points. @@ -2012,7 +2210,6 @@ % AA BA CA DA % \pgfplotsdeclarepatchclass{bicubic}{% - allow matrix=0, new=\def\pgfplotspatchclass@bicubic@row{A}\def\pgfplotspatchclass@bicubic@col{A}, set next vertex={% % defines \pgfplotspatchclass@bicubic@AA ... \pgfplotspatchclass@bicubic@DD (16 points) @@ -2125,22 +2322,22 @@ {\pgfplotspatchclass@bicubic@AA} {\pgfplotspatchclass@bicubic@BA} {\pgfplotspatchclass@bicubic@CA} - {\pgfplotspatchclass@bicubic@DA} + {\pgfplotspatchclass@bicubic@DA}% \pgfplotspathcubicfrominterpolation {\pgfplotspatchclass@bicubic@DA} {\pgfplotspatchclass@bicubic@DB} {\pgfplotspatchclass@bicubic@DC} - {\pgfplotspatchclass@bicubic@DD} + {\pgfplotspatchclass@bicubic@DD}% \pgfplotspathcubicfrominterpolation {\pgfplotspatchclass@bicubic@DD} {\pgfplotspatchclass@bicubic@CD} {\pgfplotspatchclass@bicubic@BD} - {\pgfplotspatchclass@bicubic@AD} + {\pgfplotspatchclass@bicubic@AD}% \pgfplotspathcubicfrominterpolation {\pgfplotspatchclass@bicubic@AD} {\pgfplotspatchclass@bicubic@AC} {\pgfplotspatchclass@bicubic@AB} - {\pgfplotspatchclass@bicubic@AA} + {\pgfplotspatchclass@bicubic@AA}% \pgfpathclose }, stream to shader={% @@ -2368,46 +2565,7 @@ % % OK. The tensor product representation is READY. % - % Stream it to the shader. Note that the shader has a - % DIFFERENT ordering; it expects points in the cyclic ordering - % - % AA BA CA DA DB DC DD CD BD AD AC AB BB CB CC BC - % - % note furthermore that only the corners have "point meta" in - % this shading :-( - % - \expandafter\pgfplotspatchvertex\P@AA\endvertex - \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta - \pgfplotsaxisvisphasetransformpointmeta - \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}% - \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BA\endvertex}{\pgfplotspointmetatransformed}% - \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CA\endvertex}{\pgfplotspointmetatransformed}% - \expandafter\pgfplotspatchvertex\P@DA\endvertex - \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta - \pgfplotsaxisvisphasetransformpointmeta - \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}% - % - \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@DB\endvertex}{\pgfplotspointmetatransformed}% - \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@DC\endvertex}{\pgfplotspointmetatransformed}% - \expandafter\pgfplotspatchvertex\P@DD\endvertex - \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta - \pgfplotsaxisvisphasetransformpointmeta - \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}% - % - \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CD\endvertex}{\pgfplotspointmetatransformed}% - \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BD\endvertex}{\pgfplotspointmetatransformed}% - \expandafter\pgfplotspatchvertex\P@AD\endvertex - \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta - \pgfplotsaxisvisphasetransformpointmeta - \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}% - % - \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@AC\endvertex}{\pgfplotspointmetatransformed}% - \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@AB\endvertex}{\pgfplotspointmetatransformed}% - % - \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BB\endvertex}{\pgfplotspointmetatransformed}% - \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CB\endvertex}{\pgfplotspointmetatransformed}% - \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CC\endvertex}{\pgfplotspointmetatransformed}% - \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BC\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotsplothandlermesh@shade@cubic@tensor \endgroup }, triangulate={% @@ -2462,8 +2620,8 @@ serialize except vertices=\let\pgfplotsretval\pgfutil@empty,% deserialize except vertices=, get pdf shading type=7, - get num vertices=16, - get num cdata vertices=4, + get num vertices=\def\pgfplotsretval{16}, + get num cdata vertices=\def\pgfplotsretval{4}, }% % Transpose a bicubic matrix (4x4). @@ -2486,4 +2644,79 @@ \pgfplotsutil@swap\P@BD\P@DB \pgfplotsutil@swap\P@DC\P@CD } + +% Transpose a bicubic matrix (4x4). +% +% Reorder +% AC BC CC +% AB BB CB +% AA BA CA +% to +% CA CB CC +% BA BB BC +% AA AB AC +\def\pgfplotspatchclass@biquad@transpose{% + \pgfplotsutil@swap\P@AB\P@BA + \pgfplotsutil@swap\P@CA\P@AC + \pgfplotsutil@swap\P@CB\P@BC +} + +% Expects that a 4x4 matrix in tensor bezier representation where +% A = left end point +% B = first control point +% C = second control point +% D = right end point +% +% and the coordinates are stored in \csname P@[ABCD][ABCD]\endcsname +% +% Streaming starts with \P@AA and is applied rowwise. +\def\pgfplotsplothandlermesh@shade@cubic@tensor{% + % Stream it to the shader. Note that the shader has a + % DIFFERENT ordering; it expects points in the cyclic ordering + % + % AA BA CA DA DB DC DD CD BD AD AC AB BB CB CC BC + % + % note furthermore that only the corners have "point meta" in + % this shading :-( + % + \expandafter\pgfplotspatchvertex\P@AA\endvertex + \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta + \pgfplotsaxisvisphasetransformpointmeta + \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BA\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CA\endvertex}{\pgfplotspointmetatransformed}% + \expandafter\pgfplotspatchvertex\P@DA\endvertex + \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta + \pgfplotsaxisvisphasetransformpointmeta + \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}% + % + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@DB\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@DC\endvertex}{\pgfplotspointmetatransformed}% + \expandafter\pgfplotspatchvertex\P@DD\endvertex + \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta + \pgfplotsaxisvisphasetransformpointmeta + \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}% + % + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CD\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BD\endvertex}{\pgfplotspointmetatransformed}% + \expandafter\pgfplotspatchvertex\P@AD\endvertex + \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta + \pgfplotsaxisvisphasetransformpointmeta + \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}% + % + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@AC\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@AB\endvertex}{\pgfplotspointmetatransformed}% + % + % + \pgfplotspatchclass{\pgfplotspatchclassname}{get pdf shading type}% + \if 7\pgfplotsretval + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BB\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CB\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CC\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BC\endvertex}{\pgfplotspointmetatransformed}% + \else + % assume 'get pdf shading type=6' - it does not contain the + % inner vertices. + \fi +} \endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.smithchart.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.smithchart.code.tex index e1561bb96ac..003196bab83 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.smithchart.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.smithchart.code.tex @@ -239,6 +239,12 @@ } } +\pgfkeys{ + /pgfplots/warning/smithchart/no such tick/.code 2 args={% + \pgfplotsthrow@warning{There is no #1tick with index '#2'. Skipping it.}% + }, +} + \def\pgfplots@smithchartaxis@activate{% \def\axisdefaultwidth{207pt}% \def\axisdefaultheight{207pt}% @@ -904,7 +910,7 @@ \fi \expandafter\pgfplots@gridlines@stop@at@unpack\entry\relax \pgfutil@ifundefined{pgfplots@#3tick@num@to@pos@\pgfplots@grid@stop@at}{% - \pgfplots@warning{There is no #3tick with index '\pgfplots@grid@stop@at'. Skipping it.}% + \pgfplotswarning{smithchart/no such tick}{#3}{\pgfplots@grid@stop@at}\pgfeov \let\entry=\pgfutil@empty }{% \edef\entry{\csname pgfplots@#3tick@num@to@pos@\pgfplots@grid@stop@at\endcsname:\pgfplots@grid@stop@at@eachnth}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.statistics.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.statistics.code.tex new file mode 100644 index 00000000000..8ccf4abf610 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.statistics.code.tex @@ -0,0 +1,1057 @@ +%-------------------------------------------- +% +% Package pgfplots, library for statistical plots (boxplots in the first version) +% +% Copyright 2007-2012 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 +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +%-------------------------------------------- + +\newif\ifpgfplotsplothandlerboxplot@variable@width + +\pgfplotsset{ + boxplot/.code={% + \def\tikz@plot@handler{\pgfplotsplothandlerboxplot}% + \pgfkeysalso{% + /pgfplots/every boxplot, + /pgfplots/boxplot/.cd, + #1% + }% + }, + boxplot prepared/.code={% + \def\tikz@plot@handler{\pgfplotsplothandlerboxplotprepared}% + \pgfkeysalso{% + /pgfplots/every boxplot, + /pgfplots/boxplot/.cd, + #1% + }% + }, + boxplot/data value/.code =\pgfplots@set@source@for{boxplot/data}{#1}{0},% + boxplot/data/.code =\pgfplots@set@source@for{boxplot/data}{#1}{1},% + boxplot/data filter/.code=, + boxplot/data value=\pgfkeysvalueof{/data point/y}, + % + every boxplot/.style={% + }, + % + % 'auto' means "if possible". + % For boxplot prepared, this is equivalent to "disabled" (empty value). + % For boxplot, it means "compute it". + % Empty value means disabled. + boxplot/median/.initial=auto, + boxplot/lower quartile/.initial=auto, + boxplot/upper quartile/.initial=auto, + boxplot/lower whisker/.initial=auto, + boxplot/upper whisker/.initial=auto, + boxplot/average/.initial=, + % + boxplot/lower quartile off/.initial=0.25, + boxplot/upper quartile off/.initial=0.75, + boxplot/whisker range/.initial=1.5, + % + % + % the size of whisker lines in axis units. + % The default is to make it relative to 'box extend' + boxplot/whisker extend/.initial=\pgfkeysvalueof{/pgfplots/boxplot/box extend}*0.8, + % + % the size of the box in axis units. Note that this has been + % chosen to fit the initial 'draw position': + boxplot/box extend/.initial=0.8, + % draw direction=x|y + boxplot/draw direction/.initial=x, + % + % Activates "dynamic size" feature + boxplot/variable width/.is if=pgfplotsplothandlerboxplot@variable@width, + boxplot/variable width/.default=true, + % + boxplot/sample size/.initial=auto, + % + % a transformation which is applied to anything related to + % sample size. + boxplot/variable width expr/.code=\pgfmathparse{sqrt(#1)}, + % + % will be computed automatically if needed. If it is present, it + % will not contribute to the axis-wide limit unless it has been + % given axis-wide. + boxplot/sample size min/.initial=, + boxplot/sample size max/.initial=, + % + % this factor times 'box extend' is the size for + % 'sample size min'. The max value gets 'box extend'. + boxplot/variable width min target/.initial=0.2, + % + % + % defines where how the "free" position is chosen. The idea is to + % place one box at each "y" position and to number these + % 1,2,3,4,... . This should probably simplify tick (label) generation. + boxplot/draw position/.initial=1+\plotnumofactualtype, + % + % draw relative anchor=0: + % | |---| | + % | | | | + % |----|---|--| + % + % draw relative anchor=0.5: + % | |---| | + % |----| |--| + % | |---| | + % + % draw relative anchor=1: + % |----|---|--| + % | | | | + % | |---| | + boxplot/draw relative anchor/.initial=0.5, + % + boxplot/every whisker/.style={% + }, + boxplot/every box/.style={% + }, + boxplot/every median/.style={% + }, + boxplot/every average/.style={% + /tikz/mark=diamond*, + }, + boxplot/draw/lower whisker/.style={% + /pgfplots/boxplot/draw/whisker=% + {\pgfplotsboxplotvalue{lower quartile}} + {\pgfplotsboxplotvalue{lower whisker}} + }, + boxplot/draw/upper whisker/.style={% + /pgfplots/boxplot/draw/whisker=% + {\pgfplotsboxplotvalue{upper quartile}} + {\pgfplotsboxplotvalue{upper whisker}}% + }, + boxplot/draw/whisker/.code 2 args={% + \draw[/pgfplots/boxplot/every whisker/.try] + (boxplot cs:#1) -- (boxplot cs:#2) + (boxplot whisker cs:#2,0) + -- + (boxplot whisker cs:#2,1) + ; + },% + % + boxplot/draw/box/.code={% + \draw[/pgfplots/boxplot/every box/.try] + (boxplot box cs:\pgfplotsboxplotvalue{lower quartile},0) + rectangle + (boxplot box cs:\pgfplotsboxplotvalue{upper quartile},1) + ; + },% + % + boxplot/draw/average/.code={% + \draw[/pgfplots/boxplot/every average/.try] + \pgfextra + % do NOT use \draw[mark=*] plot coordinates because + % boxplots uses the same plot handler to draw its + % outliers. + \pgftransformshift{% + \pgfplotsboxplotpointabbox + {\pgfplotsboxplotvalue{average}} + {0.5}% + }% + \pgfuseplotmark{\tikz@plot@mark}% + \endpgfextra + ; + }, + % + boxplot/draw/median/.code={% + \draw[/pgfplots/boxplot/every median/.try] + (boxplot box cs:\pgfplotsboxplotvalue{median},0) + -- + (boxplot box cs:\pgfplotsboxplotvalue{median},1) + ; + },% +} + + +\def\pgfplotsplothandlerboxplot{% + \pgfplotsresetplothandler + \def\pgf@plotstreamstart{% + \pgfplotsset{/pgfplots/boxplot prepared}% + \pgfplotsresetplothandler + \tikz@plot@handler + \pgf@plotstreamstart + }% + \def\pgfplotsplothandlername{boxplot}% + \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@boxplot + \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@boxplot + \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@boxplot +} + + +\def\pgfplotsplothandlersurveystart@boxplot{% + \pgfplots@prepare@source@parser@for{boxplot/}{data}{\pgfplotsplothandlerboxplot@parse}% + % + \pgfplotscoordmath{float}{zero}% + \let\pgfplotsplothandlerboxplot@sum=\pgfmathresult + % + \pgfplotscoordmath{float}{min limit}% + \let\pgfplotsplothandlerboxplot@last=\pgfmathresult + % + \def\b@pgfplotsplothandlerboxplot@issorted{1}% + % + % FIXME : the decision to store the input points into a SINGLY + % LINKED LIST is based on the observation that huge TeX arrays + % (with one macro per index) run into out-of-memory easily. + % The list does not: it does not need that many macros and uses a + % different memory limit... + % + % However, the linked-list is bought off for a high price... the + % statistics computation takes linear time instead of constant. + % But we have linear time anyway, so it does not destroy the + % asymptotics... and it appears to be better to get it into main + % memory (?) + \pgfplotsapplistXnewempty\pgfp@boxplot@@ + \def\c@pgfplotsplothandlerboxplot@num{0}% + \c@pgfplots@coordindex=0 +}% + +\def\pgfplotsplothandlersurveyend@boxplot{% + \pgfplots@curplot@threedimfalse + % + \pgfplotsapplistXlet\pgfplots@boxplot@data=\pgfp@boxplot@@ + \pgfplotsapplistXnewempty\pgfp@boxplot@@ + % + \if0\b@pgfplotsplothandlerboxplot@issorted + \pgfplotsplothandlersurveyend@boxplot@sort + \fi + % + % + \edef\numcoords{\pgfplots@current@point@coordindex}% + % + %% + \pgfplotsset{% + /pgfplots/boxplot prepared={% + data value=\pgfplots@current@point@data, + },% + }% + \pgfplotsresetplothandler + % + \let\pgfplotsplothandlerboxplotprepared@normalize@values@@=\pgfplotsplothandlerboxplotprepared@normalize@values + \def\pgfplotsplothandlerboxplotprepared@normalize@values{\relax}% + % + \tikz@plot@handler + % + \pgfplotsplothandlersurveystart + % + % this will report outliers as point stream: + \pgfplotsplothandlersurveyend@boxplot@computestats + \let\pgfplots@boxplot@data=\relax + % + \let\pgfplotsplothandlerboxplotprepared@normalize@values=\pgfplotsplothandlerboxplotprepared@normalize@values@@ + \pgfplotsplothandlerboxplotprepared@normalize@values + % + % + \pgfplotsplothandlersurveyend +}% + +\def\pgfplotsplothandlersurveyend@boxplot@sort{% + % how bad. we have to convert to array, sort, convert back to + % list... it would have been better if we had worked with arrays + % right away! But see the docs in front of the line + % '\pgfplotsapplistXnewempty\pgfp@boxplot@@' somewhere in this + % file... + % + \begingroup + \pgfplotsarraynewempty{P}% + \pgfplotsarrayresize{P}{\c@pgfplots@coordindex}% + % + \c@pgfplots@coordindex=0 + \let\pgfplotsplothandlersurveyend@boxplot@computestats@=\pgfplots@boxplot@fillarray + \expandafter\pgfplotsplothandlersurveyend@boxplot@computestats@loop\pgfplots@boxplot@data\pgfplots@EOI + % + \pgfkeysdef{/pgfplots/array/unscope pre}{% + \pgfplotsapplistXnewempty\pgfp@boxplot@@ + \pgfplotsarrayforeachungrouped{##1}\as\elem{% + \edef\elem{{\elem}}% + \expandafter\pgfplotsapplistXpushback\expandafter{\elem}\to\pgfp@boxplot@@ + }% + \pgfplotsapplistXlet\pgfplots@boxplot@data=\pgfp@boxplot@@ + \global\let\pgfplots@glob@boxplot@TMPd=\pgfplots@boxplot@data + }% + \pgfkeysdef{/pgfplots/array/unscope post}{% + }% + % + %\message{[}\pgfplotsarrayforeach{P}\as\elem{\message{\elem,}}\message{]^^J}% + % + \pgfkeys{/pgfplots/float <}% + \pgfplotsarraysort{P}% + % + \endgroup + \let\pgfplots@boxplot@data=\pgfplots@glob@boxplot@TMPd + %\message{-> \meaning\pgfplots@boxplot@data^^J}% +}% + +\def\pgfplots@boxplot@fillarray{% + \def\pgfplots@loc@TMPa{\pgfplotsarrayset\c@pgfplots@coordindex\of{P}\to}% + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@current@point@data}% +} + +%%%% + +% +% OUTPUT: +% \pgfplotsretval: the result of #1 * #2 as integer +% \pgfplotsretvalb = 1 iff #1 * #2 is an integer (without loss) +\def\pgfplots@boxplot@get@quantile@offset#1#2{% + \pgfplotscoordmath{float}{parsenumber}{#2}% + \pgfplotscoordmath{float}{op}{multiply}{{\pgfmathresult}{#1}}% + \pgfplotscoordmath{float}{tofixed}{\pgfmathresult}% + \afterassignment\pgfplots@boxplot@get@quantile@remainder + \c@pgf@countd=\pgfmathresult\relax + \edef\pgfplotsretval{\the\c@pgf@countd}% +}% + +\def\pgfplots@boxplot@get@quantile@remainder#1\relax{% + \ifdim #1pt>0.001pt + \def\pgfplotsretvalb{0}% + \else + \def\pgfplotsretvalb{1}% + \fi +}% + +\def\pgfplotsplothandlersurveyend@boxplot@computestats{ + % + % compute TMPa := float(\numcoords - 1) + \pgfplotscoordmath{float}{one}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \pgfplotscoordmath{float}{parsenumber}{\numcoords}% + \let\pgfplots@boxplot@numcoords=\pgfmathresult + \pgfplotscoordmath{float}{op}{subtract}{{\pgfmathresult}{\pgfplots@loc@TMPa}}% + \let\pgfplots@boxplot@numcoords@minus@one=\pgfmathresult + % + % compute the indices into the coordinate arrays: + \pgfplots@boxplot@get@quantile@offset{\pgfplots@boxplot@numcoords@minus@one}{\pgfplotsboxplotvalue{lower quartile off}}% + \let\c@pgfplotsplothandlerboxplot@lowerquartile=\pgfplotsretval + \let\b@pgfplotsplothandlerboxplot@lowerquartile@isint=\pgfplotsretvalb + \pgfplots@boxplot@get@quantile@offset{\pgfplots@boxplot@numcoords@minus@one}{0.5}% + \let\c@pgfplotsplothandlerboxplot@median=\pgfplotsretval + \let\b@pgfplotsplothandlerboxplot@median@isint=\pgfplotsretvalb + \pgfplots@boxplot@get@quantile@offset{\pgfplots@boxplot@numcoords@minus@one}{\pgfplotsboxplotvalue{upper quartile off}}% + \let\c@pgfplotsplothandlerboxplot@upperquartile=\pgfplotsretval + \let\b@pgfplotsplothandlerboxplot@upperquartile@isint=\pgfplotsretvalb + % + % hm. I once had the idea to support quartile-based whisker + % definitions... but I did not implement them. + \let\c@pgfplotsplothandlerboxplot@lowerwhisker=\pgfutil@empty + \let\c@pgfplotsplothandlerboxplot@upperwhisker=\pgfutil@empty + % + % + % These here are the VALUES that will be communicated to 'boxplot prepared' + % They need to be computed below. + \let\pgfplotsplothandlerboxplot@lowerwhisker=\pgfutil@empty + \let\pgfplotsplothandlerboxplot@lowerquartile=\pgfutil@empty + \let\pgfplotsplothandlerboxplot@median=\pgfutil@empty + \let\pgfplotsplothandlerboxplot@upperquartile=\pgfutil@empty + \let\pgfplotsplothandlerboxplot@upperwhisker=\pgfutil@empty + % + \c@pgfplots@coordindex=0 % + \def\pgfplots@boxplot@@next@target{lowerquartile}% + \def\pgfplots@boxplot@next@@lowerquartile{median}% + \def\pgfplots@boxplot@next@@median{upperquartile}% + \def\pgfplots@boxplot@next@@upperquartile{}% + \let\pgfplotsplothandlersurveyend@boxplot@computestats@=\pgfplotsplothandlersurveyend@boxplot@computestats@quantile + \expandafter\pgfplotsplothandlersurveyend@boxplot@computestats@loop\pgfplots@boxplot@data\pgfplots@EOI + % + % + \pgfplotscoordmath{float}{op}{divide}{{\pgfplotsplothandlerboxplot@sum}{\pgfplots@boxplot@numcoords}}% + \let\pgfplotsplothandlerboxplot@average=\pgfmathresult + % + % communicate and set results to pgfkeys - and to the plot + % specification option list: + \pgfplotsplothandlersurveyend@boxplot@set{lower whisker}{\pgfplotsplothandlerboxplot@lowerwhisker}% + \pgfplotsplothandlersurveyend@boxplot@set{lower quartile}{\pgfplotsplothandlerboxplot@lowerquartile}% + \pgfplotsplothandlersurveyend@boxplot@set{median}{\pgfplotsplothandlerboxplot@median}% + \pgfplotsplothandlersurveyend@boxplot@set{average}{\pgfplotsplothandlerboxplot@average}% + \pgfplotsplothandlersurveyend@boxplot@set{upper quartile}{\pgfplotsplothandlerboxplot@upperquartile}% + \pgfplotsplothandlersurveyend@boxplot@set{upper whisker}{\pgfplotsplothandlerboxplot@upperwhisker}% + \pgfplotsplothandlersurveyend@boxplot@set{sample size}{\pgfplots@boxplot@numcoords}% + % + % Ok, now make sure that we use the FINAL variables from the user, + % i.e. that we respect manual overrides. This is only necessary + % for quartiles from what I see here. + \pgfplotsplothandlersurveyend@boxplot@get{\pgfplotsplothandlerboxplot@lowerquartile}{lower quartile}% + \pgfplotsplothandlersurveyend@boxplot@get{\pgfplotsplothandlerboxplot@upperquartile}{upper quartile}% + % + \pgfplotscoordmath{float}{parsenumber}{\pgfplotsboxplotvalue{whisker range}}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \pgfplotscoordmath{float}{op}{subtract}{{\pgfplotsplothandlerboxplot@upperquartile}{\pgfplotsplothandlerboxplot@lowerquartile}}% + \pgfplotscoordmath{float}{op}{multiply}{{\pgfmathresult}{\pgfplots@loc@TMPa}}% + \let\pgfplots@boxplot@whisker@width=\pgfmathresult + \pgfplotscoordmath{float}{op}{add}{{\pgfplotsplothandlerboxplot@upperquartile}{\pgfplots@boxplot@whisker@width}}% + \let\pgfplotsplothandlerboxplot@upperwhisker@value=\pgfmathresult + \pgfplotscoordmath{float}{op}{subtract}{{\pgfplotsplothandlerboxplot@lowerquartile}{\pgfplots@boxplot@whisker@width}}% + \let\pgfplotsplothandlerboxplot@lowerwhisker@value=\pgfmathresult + % + \c@pgfplots@coordindex=0 % + \let\pgfplotsplothandlersurveyend@boxplot@computestats@=\pgfplotsplothandlersurveyend@boxplot@computestats@valuebased + \expandafter\pgfplotsplothandlersurveyend@boxplot@computestats@loop\pgfplots@boxplot@data\pgfplots@EOI + % + \pgfplotsplothandlersurveyend@boxplot@set{lower whisker}{\pgfplotsplothandlerboxplot@lowerwhisker}% + \pgfplotsplothandlersurveyend@boxplot@set{upper whisker}{\pgfplotsplothandlerboxplot@upperwhisker}% + % +}% + +% takes a key #1 which is expected in /pgfplots/boxplot/#1, +% and overwrites its value with #2 if that is allowed. +% +% More specifically, if the current value of '#1' is 'auto', it is +% replaced by #2. In all other cases, it will not be modified. +% +% The "replaced by #2" means to set the value right away and to modify +% the plot's option list to reflect the new value. +\def\pgfplotsplothandlersurveyend@boxplot@set#1#2{% + \pgfkeysgetvalue{/pgfplots/boxplot/#1}\pgfplots@loc@TMPa + \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}% + \def\pgfplots@loc@TMPc{auto}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPc + \edef\pgfmathresult{#2}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfplotscoordmath{float}{tostring}{#2}% + \edef\pgfplots@loc@TMPb{\noexpand\pgfplotsplothandlersurveyaddoptions{/pgfplots/boxplot/#1={\pgfmathresult}}}% + \pgfplots@loc@TMPb + \fi + \fi +}% + +\def\pgfplotsplothandlersurveyend@boxplot@get#1#2{% + \pgfkeysgetvalue{/pgfplots/boxplot/#2}\pgfplots@loc@TMPa + \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}% + \def\pgfplots@loc@TMPc{auto}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPc + \else + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \pgfmathparse{\pgfplots@loc@TMPa}% + \let#1=\pgfmathresult + \fi + \fi +} + + +% Assuming that the input coordinates are in a LIST, we have to loop +% over that list. +\def\pgfplotsplothandlersurveyend@boxplot@computestats@loop#1{% + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfplots@EOI + \else + % + \let\pgfplots@current@point@data=\pgfplots@loc@TMPa + \pgfplotsplothandlersurveyend@boxplot@computestats@ + % + \advance\c@pgfplots@coordindex by1 % + \expandafter\pgfplotsplothandlersurveyend@boxplot@computestats@loop + \fi +}% + +% Really computes stats. +% +% This method computes ALL quantiles (one after the other). These are 0.25, +% 0.5, and 0.75. Perhaps I add quantile-based whiskers eventually. +% +% XXX : this method is quite inefficient because it iterates through a +% loop for what would be 3 arrays lookups otherwise. If I would have enough +% courage to store the points into an array, both this and the +% whisker-loop would be more efficient. But in TeX, arrays are not +% necessarily that efficient ... they run out of memory easily! +% +% The data is in \pgfplots@current@point@data. +\def\pgfplotsplothandlersurveyend@boxplot@computestats@quantile{% + % + \c@pgf@countd=\csname c@pgfplotsplothandlerboxplot@\pgfplots@boxplot@@next@target\endcsname\relax + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplotsplothandlerboxplot@\pgfplots@boxplot@@next@target\endcsname + % + \ifnum\c@pgf@countd=\c@pgfplots@coordindex\relax + % Ah - we found the occurence of the current search target! + \expandafter\let\csname pgfplotsplothandlerboxplot@\pgfplots@boxplot@@next@target\endcsname=\pgfplots@current@point@data + % + \expandafter\let\expandafter\pgfplots@loc@TMPb\csname b@pgfplotsplothandlerboxplot@\pgfplots@boxplot@@next@target @isint\endcsname + \if 1\pgfplots@loc@TMPb + % accept the match! + % ... and search for the next search target. + \expandafter\let\expandafter\pgfplots@boxplot@@next@target\csname pgfplots@boxplot@next@@\pgfplots@boxplot@@next@target\endcsname + \else + % ... continue searching for the same target in order to + % compute the mean. + \fi + \else + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + % Ah! this can *only* happen if we have to compute a + % mean between the previous and this data point. + % + % The current search target is 0.5 * (value + next): + \pgfplotscoordmath{float}{op}{add}{{\pgfplots@current@point@data}{\pgfplots@loc@TMPa}}% + \let\pgfplots@loc@TMPb=\pgfmathresult + \pgfplotscoordmath{float}{parsenumber}{0.5}% + \pgfplotscoordmath{float}{op}{multiply}{{\pgfmathresult}{\pgfplots@loc@TMPb}}% + % + \expandafter\let\csname pgfplotsplothandlerboxplot@\pgfplots@boxplot@@next@target\endcsname + =\pgfmathresult + % + % ... and search for the next search target. + \expandafter\let\expandafter\pgfplots@boxplot@@next@target\csname pgfplots@boxplot@next@@\pgfplots@boxplot@@next@target\endcsname + % + \fi + \fi + % + \ifx\pgfplots@boxplot@@next@target\pgfutil@empty + % stop searching. + \let\pgfplotsplothandlersurveyend@boxplot@computestats@=\relax + \fi +} + +\def\pgfplotsplothandlersurveyend@boxplot@computestats@valuebased{% + \ifx\pgfplotsplothandlerboxplot@lowerwhisker\pgfutil@empty + \pgfplotscoordmath{float}{if less than}{\pgfplots@current@point@data}{\pgfplotsplothandlerboxplot@lowerwhisker@value}{% + % Ah. an outlier. + \pgfplotsplothandlerboxplot@outlier + }{% + \let\pgfplotsplothandlerboxplot@lowerwhisker=\pgfplots@current@point@data + }% + \fi + % + % it would be so cool if we could simply check the list in reverse + % order. but not if it really is a singly-linked list... + \pgfplotscoordmath{float}{if less than}{\pgfplotsplothandlerboxplot@upperwhisker@value}{\pgfplots@current@point@data}{% + % Ah. an outlier. + \pgfplotsplothandlerboxplot@outlier + }{% + \ifx\pgfplotsplothandlerboxplot@upperwhisker\pgfutil@empty + \let\pgfplotsplothandlerboxplot@upperwhisker=\pgfplots@current@point@data + \else + \pgfplotscoordmath{float}{max}{\pgfplotsplothandlerboxplot@upperwhisker}{\pgfplots@current@point@data}% + \let\pgfplotsplothandlerboxplot@upperwhisker=\pgfmathresult + \fi + }% +} + +\def\pgfplotsplothandlerboxplot@outlier{% + \def\pgfplots@current@point@x{0}% + \def\pgfplots@current@point@y{0}% + \def\pgfplots@current@point@z{0}% + \pgfplotsplothandlersurveypoint +}% + +%%% + +\def\pgfplotsplothandlersurveypoint@boxplot{% + \pgfplotsplothandlerboxplot@parse + \let\pgfplots@current@point@data=\pgfmathresult + % + \ifx\pgfplots@current@point@data\pgfutil@empty + \else + \pgfplotscoordmath{float}{if is bounded}{\pgfplots@current@point@data}{% + % + \pgfplotsplothandlersurveypoint@boxplot@ + }{% + }% + \fi +}% + +\def\pgfplotsplothandlersurveypoint@boxplot@{% + \pgfplotsutil@advancestringcounter\c@pgfplotsplothandlerboxplot@num + % + \if1\b@pgfplotsplothandlerboxplot@issorted + \pgfplotscoordmath{float}{if less than}{\pgfplots@current@point@data}{\pgfplotsplothandlerboxplot@last}{% + \def\b@pgfplotsplothandlerboxplot@issorted{0}% + }{% + }% + \fi + % + % + \pgfplotscoordmath{float}{op}{add}{{\pgfplots@current@point@data}{\pgfplotsplothandlerboxplot@sum}}% + \let\pgfplotsplothandlerboxplot@sum=\pgfmathresult + % + % store parsed result. + \edef\pgfmathresult{{\pgfplots@current@point@data}}% + \expandafter\pgfplotsapplistXpushback\expandafter{\pgfmathresult}\to\pgfp@boxplot@@ + % + \let\pgfplotsplothandlerboxplot@last=\pgfplots@current@point@data + % + \advance\c@pgfplots@coordindex by1 +} +% ============================================================= + +\def\pgfplotsplothandlerboxplotprepared{% + \ifpgfplots@stackedmode + \pgfplotsthrow{unsupported operation}{Sorry, 'stacked plots' are currently unsupported for box plots. See the manual for 'boxplot/draw position' for how to achieve the effect (using \string\plotnumofactualtype)}\pgfeov + \else + \pgfplotsplothandlerboxplotprepared@ + \fi +} +\def\pgfplotsplothandlerboxplotprepared@{% + \pgfplotsresetplothandler + % + \def\pgfplotsplothandlername{boxplot prepared}% + % + \let\pgf@plotstreamstart=\pgfplotsplothandlervisstart@boxplot@prepared + \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@boxplot@prepared + \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@boxplot@prepared + \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@boxplot@prepared + % + \pgfplotsplothandlerboxplotprepared@normalize@values + % + \pgfkeysgetvalue{/pgfplots/boxplot/draw direction}\pgfplots@loc@TMPa + \if x\pgfplotsboxplotvalue{draw direction}% + \else + \if y\pgfplotsboxplotvalue{draw direction}% + \else + \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Invalid choice boxplot/draw direction=\pgfplots@loc@TMPa}\pgfeov% + \def\pgfplots@loc@TMPa{x}% + \fi + \fi + \csname pgfplotsplothandlerboxplotprepared@setxy@\pgfplots@loc@TMPa\endcsname + % + \def\pgfplotsboxplotpointab##1##2{% + \begingroup + \pgfkeys{/pgf/fpu}% + \pgfmathparse{##1}% + \let\pgfplotsplothandlerboxplot@@=\pgfmathresult + \pgfmathparse{\pgfplotsboxplotvalue{draw position} + ##2}% + \xdef\pgfplots@glob@TMPa{{\pgfplotsplothandlerboxplot@@}{\pgfmathresult}}% + \expandafter\pgfplotsboxplotpointab@\pgfplots@glob@TMPa{\pgfplotspointaxisxy}% + \pgf@process{}% + \endgroup + }% + \def\pgfplotsboxplotpointab@survey##1##2{% + \edef\pgfmathresult{##1}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathparse{\pgfmathresult}% + \fi + \let\pgfplotsplothandlerboxplot@@=\pgfmathresult + \pgfmathparse{\pgfplotsboxplotvalue{draw position} + ##2}% + \xdef\pgfplots@glob@TMPa{{\pgfplotsplothandlerboxplot@@}{\pgfmathresult}}% + \let\pgfplotsplothandlerboxplot@modified@draw@position=\pgfmathresult% + \expandafter\pgfplotsboxplotpointab@\pgfplots@glob@TMPa{\pgfplotsboxplotpointab@@define@current@xy}% + }% +}% + +\def\pgfplotsplothandlerboxplotprepared@normalize@values{% + \def\pgfplots@loc@TMPa{auto}% + \pgfplotsforeachentryinCSV{\value}{% + lower whisker,% + lower quartile,% + median,% + average,% + upper quartile,% + upper whisker,% + sample size% + }{% + \pgfkeysgetvalue{/pgfplots/boxplot/\value}\pgfplots@loc@TMPb + \edef\pgfplots@loc@TMPb{\pgfplots@loc@TMPb}% + \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa + \pgfkeyslet{/pgfplots/boxplot/\value}\pgfutil@empty + \fi + }% +}% + +\def\pgfplotsboxplotpointab@@define@current@xy#1#2{% + \edef\pgfplots@current@point@x{#1}% + \edef\pgfplots@current@point@y{#2}% +}% + +\def\pgfplotsplothandlerboxplotprepared@setxy@x{% + \def\pgfplotsboxplotpointab@##1##2##3{% + ##3{##1}{##2}% + }% +}% +\def\pgfplotsplothandlerboxplotprepared@setxy@y{% + \def\pgfplotsboxplotpointab@##1##2##3{% + ##3{##2}{##1}% + }% +}% + +\def\pgfplotsplothandlersurveypoint@boxplot@collect@limits{% + \pgfplotsaxisparsecoordinate + \pgfplotsaxispreparecoordinate + \ifpgfplotsaxisparsecoordinateok + \pgfplotsaxisupdatelimitsforcoordinate\pgfplots@current@point@x\pgfplots@current@point@y\pgfplots@current@point@z + \fi + % + % do NOT store the processed coordinate! the coordinate stream + % is ONLY for outliers. + % + % ... but update this stuff to avoid a "plot without coordinates" + % case + \pgfplotscoordstream@firstlast@update +} + +\def\pgfplotsplothandlersurveystart@boxplot@prepared{% + \pgfplots@prepare@source@parser@for{boxplot/}{data}{\pgfplotsplothandlerboxplot@parse}% + % + \let\pgfplotsboxplotpointab=\pgfplotsboxplotpointab@survey + % + \pgfplotsplothandlersurveystart@default +} + +\def\pgfplotsplothandlersurveypoint@boxplot@prepared{% + % seems the "parse" routine is stupid ... the /data point/ stuff + % is redefined although it should not. Strange... + \pgfkeyslet{/data point/x}\pgfplots@current@point@x + \pgfkeyslet{/data point/y}\pgfplots@current@point@y + \pgfkeyslet{/data point/z}\pgfplots@current@point@z + \pgfplotsplothandlerboxplot@parse + % + \pgfplotsboxplotpointab{\pgfmathresult}{0}% + % + \pgfplotsplothandlersurveypoint@default +} + +\def\pgfplotsplothandlersurveyend@boxplot@prepared{% + \let\pgfplots@invoke@filter@xyz@old=\pgfplots@invoke@filter@xyz + \let\pgfplots@invoke@filter@xyz=\relax + \let\pgfplots@invoke@filter@old=\pgfplots@invoke@filter + \def\pgfplots@invoke@filter##1##2{}% + \let\pgfplots@invoke@prefilter@old=\pgfplots@invoke@prefilter + \let\pgfplots@invoke@prefilter=\relax + % + \pgfmathparse{\pgfplotsboxplotvalue{draw position}}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \ifpgfplots@usefpu + \pgfmathfloattofixed\pgfmathresult + \fi + % remember it for later - it might have been retrieved from some + % table column! If you used something like + % 'draw position=\thisrow{position}, the position of the LAST data point + % will be used (because we are in end survey here). + \edef\pgfplots@loc@TMPb{\noexpand\pgfplotsplothandlersurveyaddoptions{/pgfplots/boxplot/draw position=\pgfmathresult}}% + \pgfplots@loc@TMPb + % + % ... this here will make things faster if the FPU is active. + \pgfkeyslet{/pgfplots/boxplot/draw position}\pgfplots@loc@TMPa + % + % + % + % + \pgfplotsboxplotpointabwhisker + {\pgfplotsboxplotvalue{lower whisker}} + {0}% + \pgfplotsplothandlersurveypoint@boxplot@collect@limits + % + \pgfplotsboxplotpointabwhisker + {\pgfplotsboxplotvalue{lower whisker}} + {1}% + \pgfplotsplothandlersurveypoint@boxplot@collect@limits + % + % + \pgfplotsboxplotpointabbox + {\pgfplotsboxplotvalue{lower quartile}}% + {0}% + \pgfplotsplothandlersurveypoint@boxplot@collect@limits + % + \pgfplotsboxplotpointabbox + {\pgfplotsboxplotvalue{lower quartile}}% + {1}% + \pgfplotsplothandlersurveypoint@boxplot@collect@limits + % + % + \pgfplotsboxplotpointabbox + {\pgfplotsboxplotvalue{median}} + {0}% + \pgfplotsplothandlersurveypoint@boxplot@collect@limits + % + \pgfplotsboxplotpointabbox + {\pgfplotsboxplotvalue{median}} + {1}% + \pgfplotsplothandlersurveypoint@boxplot@collect@limits + % + % + \pgfplotsboxplotpointabbox + {\pgfplotsboxplotvalue{average}} + {0}% + \pgfplotsplothandlersurveypoint@boxplot@collect@limits + % + \pgfplotsboxplotpointabbox + {\pgfplotsboxplotvalue{average}} + {1}% + \pgfplotsplothandlersurveypoint@boxplot@collect@limits + % + % + \pgfplotsboxplotpointabbox + {\pgfplotsboxplotvalue{upper quartile}}% + {0}% + \pgfplotsplothandlersurveypoint@boxplot@collect@limits + % + \pgfplotsboxplotpointabbox + {\pgfplotsboxplotvalue{upper quartile}}% + {1}% + \pgfplotsplothandlersurveypoint@boxplot@collect@limits + % + % + % + \pgfplotsboxplotpointabwhisker + {\pgfplotsboxplotvalue{upper whisker}}% + {1}% + \pgfplotsplothandlersurveypoint@boxplot@collect@limits + % + \pgfplotsboxplotpointabwhisker + {\pgfplotsboxplotvalue{upper whisker}}% + {0}% + \pgfplotsplothandlersurveypoint@boxplot@collect@limits + % + \let\pgfplots@invoke@prefilter=\pgfplots@invoke@prefilter@old + \let\pgfplots@invoke@filter=\pgfplots@invoke@filter@old + \let\pgfplots@invoke@filter@xyz=\pgfplots@invoke@filter@xyz@old + % + \pgfplotsplothandlerboxplotsurvey@variable@width% + % + \pgfplotsplothandlersurveyend@default +}% + +\def\pgfplotsplothandlerboxplotsurvey@variable@width{% + \ifnum\plotnumofactualtype=0 % + % Ah - the first boxplot in this axis. Init the global + % counter: + \pgfplotscoordmath{default}{max limit}% + \global\let\g@pgfplotsplothandlerboxplot@widthkey@min=\pgfmathresult + \pgfplotscoordmath{default}{min limit}% + \global\let\g@pgfplotsplothandlerboxplot@widthkey@max=\pgfmathresult + \fi + % + % + \ifpgfplotsplothandlerboxplot@variable@width + \pgfkeysgetvalue{/pgfplots/boxplot/sample size}\pgfmathresult + \edef\pgfmathresult{\pgfmathresult}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfplotsplothandlerboxplot@variable@width@expr{\pgfmathresult}% + % + \let\pgfplots@widthkey@=\pgfmathresult + % + \pgfkeysgetvalue{/pgfplots/boxplot/sample size min}\pgfmathresult + \edef\pgfplotsplothandlerboxplot@widthkey@min{\pgfmathresult}% + % + \pgfkeysgetvalue{/pgfplots/boxplot/sample size max}\pgfmathresult + \edef\pgfplotsplothandlerboxplot@widthkey@max{\pgfmathresult}% + % + % + \ifx\pgfplotsplothandlerboxplot@widthkey@min\pgfutil@empty + \let\pgfplotsplothandlerboxplot@widthkey@min=\g@pgfplotsplothandlerboxplot@widthkey@min + \def\pgfplotsplothandlerboxplot@widthkey@min@autocompute{1}% + \else + \pgfplotsplothandlerboxplot@variable@width@expr{\pgfplotsplothandlerboxplot@widthkey@min}% + \let\pgfplotsplothandlerboxplot@widthkey@min=\pgfmathresult + \def\pgfplotsplothandlerboxplot@widthkey@min@autocompute{0}% + \fi + \ifx\pgfplotsplothandlerboxplot@widthkey@max\pgfutil@empty + \let\pgfplotsplothandlerboxplot@widthkey@max=\g@pgfplotsplothandlerboxplot@widthkey@max + \def\pgfplotsplothandlerboxplot@widthkey@max@autocompute{1}% + \else + \pgfplotsplothandlerboxplot@variable@width@expr{\pgfplotsplothandlerboxplot@widthkey@max}% + \def\pgfplotsplothandlerboxplot@widthkey@max@autocompute{0}% + \fi + % + \if1\pgfplotsplothandlerboxplot@widthkey@max@autocompute + \pgfmathparse{max(\pgfplotsplothandlerboxplot@widthkey@max,\pgfplots@widthkey@)}% + \global\let\g@pgfplotsplothandlerboxplot@widthkey@max=\pgfmathresult + \let\pgfplotsplothandlerboxplot@widthkey@max=\pgfmathresult + % + \pgfmathparse{min(\pgfplotsplothandlerboxplot@widthkey@min,\pgfplots@widthkey@)}% + \global\let\g@pgfplotsplothandlerboxplot@widthkey@min=\pgfmathresult + \let\pgfplotsplothandlerboxplot@widthkey@min=\pgfmathresult + \fi + % + % + \fi + \fi + % +%\message{sample size=\pgfplots@widthkey@. interval = \pgfplotsplothandlerboxplot@widthkey@min:\pgfplotsplothandlerboxplot@widthkey@max^^J}% +}% + +\def\pgfplotsplothandlerboxplot@variable@width@expr#1{% + \begingroup + \pgfkeys{/pgf/fpu}% + \let\pgfmathresult=#1% + \pgfplotsboxplotvalue{variable width expr/.@cmd}#1\pgfeov + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let#1=\pgfmathresult +}% + +\def\pgfplotsplothandlerboxplotvisualization@variable@width{% + \ifpgfplotsplothandlerboxplot@variable@width + \pgfkeysgetvalue{/pgfplots/boxplot/sample size}\pgfmathresult + \edef\pgfmathresult{\pgfmathresult}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfplotsplothandlerboxplot@variable@width@expr{\pgfmathresult}% + \let\pgfplots@widthkey@=\pgfmathresult + % + \pgfkeysgetvalue{/pgfplots/boxplot/sample size min}\pgfmathresult + \edef\pgfplotsplothandlerboxplot@widthkey@min{\pgfmathresult}% + % + \pgfkeysgetvalue{/pgfplots/boxplot/sample size max}\pgfmathresult + \edef\pgfplotsplothandlerboxplot@widthkey@max{\pgfmathresult}% + % + % + \ifx\pgfplotsplothandlerboxplot@widthkey@min\pgfutil@empty + \let\pgfplotsplothandlerboxplot@widthkey@min=\g@pgfplotsplothandlerboxplot@widthkey@min + \else + \pgfplotsplothandlerboxplot@variable@width@expr{\pgfplotsplothandlerboxplot@widthkey@min}% + \fi + \ifx\pgfplotsplothandlerboxplot@widthkey@max\pgfutil@empty + \let\pgfplotsplothandlerboxplot@widthkey@max=\g@pgfplotsplothandlerboxplot@widthkey@max + \else + \pgfplotsplothandlerboxplot@variable@width@expr{\pgfplotsplothandlerboxplot@widthkey@max}% + \fi + % + \pgfkeysgetvalue{/pgfplots/boxplot/variable width min target}\pgfplots@widthkey@mintrg + \pgfkeysgetvalue{/pgfplots/boxplot/box extend}\pgfplots@loc@TMPa + %\message{sample size=\pgfplots@widthkey@. interval = \pgfplotsplothandlerboxplot@widthkey@min:\pgfplotsplothandlerboxplot@widthkey@max. Target = [\pgfplots@widthkey@mintrg:1]^^J}% + \begingroup + \pgfkeys{/pgf/fpu}% + \pgfmathparse{ + (\pgfplots@widthkey@mintrg + + max(0,min(1,(\pgfplots@widthkey@ - \pgfplotsplothandlerboxplot@widthkey@min) / + (\pgfplotsplothandlerboxplot@widthkey@max - \pgfplotsplothandlerboxplot@widthkey@min))) + * (1-\pgfplots@widthkey@mintrg)) * \pgfplots@loc@TMPa}% + \pgfmathfloattofixed\pgfmathresult + \pgfmath@smuggleone\pgfmathresult + \endgroup + \pgfkeyslet{/pgfplots/boxplot/box extend}\pgfmathresult + \fi + \fi +}% + +\def\pgfplotsplothandlervisstart@boxplot@prepared{% + % + \pgfplotsplothandlerboxplotvisualization@variable@width + % + \global\let\pgf@plotstreampoint=\pgfutil@gobble + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\relax + % + \pgfplotsplothandlervisstart@boxplot@prepared@draw +}% + +\def\pgfplotsplothandlervisstart@boxplot@prepared@draw{% + \def\b@pgfplots@boxplot@hasbox{1}% + \edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{lower quartile}}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \def\b@pgfplots@boxplot@hasbox{0}% + \fi + \edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{upper quartile}}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \def\b@pgfplots@boxplot@hasbox{0}% + \fi + % + \if0\b@pgfplots@boxplot@hasbox + % hm. we have no box. Very strange boxplot, I'd say. + % + % But anyway: if someone has whiskers without box, + % short-circuit the whiskers: + \edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{lower whisker}}% + \edef\pgfplots@loc@TMPb{\pgfplotsboxplotvalue{upper whisker}}% + \pgfkeyslet{/pgfplots/boxplot/lower quartile}\pgfplots@loc@TMPb + \pgfkeyslet{/pgfplots/boxplot/upper quartile}\pgfplots@loc@TMPa + \fi + % + % + \edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{lower whisker}}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \pgfplotsboxplotvalue{draw/lower whisker/.@cmd}\pgfeov + \fi + % + \edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{upper whisker}}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \pgfplotsboxplotvalue{draw/upper whisker/.@cmd}\pgfeov + \fi + % + \if1\b@pgfplots@boxplot@hasbox + \pgfplotsboxplotvalue{draw/box/.@cmd}\pgfeov + \fi + % + \edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{median}}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \pgfplotsboxplotvalue{draw/median/.@cmd}\pgfeov + \fi + % + \edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{average}}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \pgfplotsboxplotvalue{draw/average/.@cmd}\pgfeov + \fi +}% + +\def\pgfplots@boxplot@cs@decompose#1{% + \edef\pgfplots@loc@TMPa{#1}% + \expandafter\pgfutil@in@\expandafter,\expandafter{\pgfplots@loc@TMPa}% + \ifpgfutil@in@ + \def\pgfplots@loc@TMPb##1,##2\pgfplots@EOI{% + \def\pgfplots@boxplotcs@a{##1}% + \def\pgfplots@boxplotcs@b{##2}% + }% + \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\pgfplots@EOI + \else + \let\pgfplots@boxplotcs@a=\pgfplots@loc@TMPa% + \def\pgfplots@boxplotcs@b{0}% + \fi +}% + +\def\pgfplotsboxplotvalue#1{\pgfkeysvalueof{/pgfplots/boxplot/#1}}% + +\tikzaddtikzonlycommandshortcutlet\boxplotvalue\pgfplotsboxplotvalue + +% A helper which implements 'draw relative anchor'. It expands to a +% math expression which is suitable as second argument for 'boxplot cs'; +% i.e. it needs to be added to 'boxplot/draw position'. +% +% More precisely, this macro is to be used in a context where lines of +% 'box extend' length have to be drawn. +% +% The argument is shifted by 'draw relative anchor' and is scaled by +% 'box extend'. +% +% #1: the coordinate. 0 is the means "lower part of the construct +% which is to be drawn". 1 means the "upper part of that construct" +% and 0.5 is in the middle. +\def\pgfplots@boxplot@anchor@value#1{% + (#1-\pgfplotsboxplotvalue{draw relative anchor})*\pgfplotsboxplotvalue{box extend}% +} + +% same as \pgfplots@boxplot@anchor@value, but for drawing constructs +% which are at most 'whisker extend' long. +\def\pgfplots@boxplot@anchor@value@whisker#1{% + (#1-\pgfplotsboxplotvalue{draw relative anchor})*\pgfplotsboxplotvalue{whisker extend}% +} + +\def\pgfplotsboxplotpointabbox#1#2{% + \pgfplotsboxplotpointab{#1}{\pgfplots@boxplot@anchor@value{#2}}% +}% +\def\pgfplotsboxplotpointabwhisker#1#2{% + \pgfplotsboxplotpointab{#1}{\pgfplots@boxplot@anchor@value@whisker{#2}}% +}% + +\tikzdeclarecoordinatesystem{boxplot}{% + \pgfplots@boxplot@cs@decompose{#1}% + \pgfplotsboxplotpointab{\pgfplots@boxplotcs@a}{\pgfplots@boxplotcs@b}% +}% + +\tikzdeclarecoordinatesystem{boxplot box}{% + \pgfplots@boxplot@cs@decompose{#1}% + \pgfplotsboxplotpointabbox{\pgfplots@boxplotcs@a}{\pgfplots@boxplotcs@b}% +}% + +\tikzdeclarecoordinatesystem{boxplot whisker}{% + \pgfplots@boxplot@cs@decompose{#1}% + \pgfplotsboxplotpointabwhisker{\pgfplots@boxplotcs@a}{\pgfplots@boxplotcs@b}% +}% +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsmatrix.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsmatrix.code.tex index abc273378e0..ddaf323e7da 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsmatrix.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsmatrix.code.tex @@ -330,7 +330,7 @@ \fi }% \def\pgfplotsmatrixLUdecompwarnsingular{% - \pgfplots@warning{Linear system is singular up to machine precision! Continuing with small threshold.}% + \pgfplotswarning{linear system singular}\pgfeov% }% \def\pgfplotsmatrixLUdecomp@mainloop@j@i{% \ifnum\pgfplotsmat@i<\pgfplotsmat@j diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex index 54c29ff4959..19e19fb3fe1 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex @@ -182,6 +182,13 @@ % or % columns={[index]2,name2,name3,[index]5} /pgfplots/table/columns/.initial=, + % + % this choice allows + % \pgfplotstableset{ + % column name={}, % means: the column's display name is an empty string! + % column name=\pgfkeysnovalue, % means: no value specified. In this case, + % the column's display name will default to column's name. + % } /pgfplots/table/column name/.initial=\pgfkeysnovalue, % % this thing here allows to MODIFY 'column name'. @@ -1537,9 +1544,10 @@ } % processes the option 'assign column name' +% FIXME : seems to be deprecated \def\pgfplotstabletypeset@assign@final@colname#1#2{% \pgfkeysifdefined{/pgfplots/table/assign column name/.@cmd}{% - \pgfkeysdef{/pgfplots/table/column name}{#1}% + \pgfkeyssetvalue{/pgfplots/table/column name}{#1}% \pgfkeysvalueof{/pgfplots/table/assign column name/.@cmd}#1\pgfeov \pgfkeysgetvalue{/pgfplots/table/column name}{#2}% }{}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex index 37eed5ad6ce..da14efc159f 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex @@ -646,7 +646,7 @@ % this employs a side effect: \futurelet gobbles any spaces % (including newlines). }% -\def\pgfplotstablecollectoneargwithpreparecatcodes@end#1#2{% +\long\def\pgfplotstablecollectoneargwithpreparecatcodes@end#1#2{% \endgroup #1{#2}% }% @@ -1265,7 +1265,7 @@ % entries. \long\def\pgfplotstableread@impl@DO#1#2{% \ifpgfplotstable@trimcells - \def\pgfplotstableread@impl@ITERATE@NEXT@##1{% + \long\def\pgfplotstableread@impl@ITERATE@NEXT@##1{% \pgfkeys@spdef\pgfplotstableread@impl@ITERATE@NEXT@@@{##1}% \expandafter#1\expandafter{\pgfplotstableread@impl@ITERATE@NEXT@@@}% }% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex index 3c8fde67285..8b73f91fbf0 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex @@ -57,6 +57,10 @@ } {}% +\pgfutil@IfUndefined{pgfmathdeclarefunction}{ + \pgfplots@warning{Parts of pgfplots require PGF 2.10; you have PGF 2.00 . Consider upgrading if you experience problems.}% +}{% +}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex index f9f260b1d7d..abaf662bc40 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex @@ -1,13 +1,40 @@ % ====================================================== % compatibility with PGF 2.10 % ====================================================== +% \def\pgfdeclarelayer#1{% \pgfutil@ifundefined{pgf@layerbox@#1}{% - \expandafter\pgf@newbox\csname pgf@layerbox@#1\endcsname% - \expandafter\pgf@newbox\csname pgf@layerboxsaved@#1\endcsname% + \expandafter\expandafter\csname pgf@newbox\endcsname\csname pgf@layerbox@#1\endcsname% + \expandafter\expandafter\csname pgf@newbox\endcsname\csname pgf@layerboxsaved@#1\endcsname% }{}% } +\def\pgfutil@insertatbegincurrentpagefrombox@WRONG#1{% + \global\setbox\pgfutil@abb\hbox{\unhbox\pgfutil@abb#1}% +} + +% needed for dvipdfmx and shader=interp +\def\pgfutil@insertatbegincurrentpagefrombox@FIXED#1{% + \edef\pgf@temp{\the\wd\pgfutil@abb}% + \global\setbox\pgfutil@abb\hbox{% + \unhbox\pgfutil@abb + % + % the order in which \pgfutil@insertatbegincurrentpagefrombox + % matters unless we make the following -shift! + % To see this, consider writing two such statements. The second + % one will (naturally) be placed more to the right, although there + % is no apparent reason why it should. + % + % CF observed problems when placing patterns in XObjects without + % this skip (dvipdfmx driver for pgfplots shader=interp) + \hskip-\pgf@temp\relax + #1% + }% +} +\expandafter\ifx\csname pgfutil@insertatbegincurrentpagefrombox\endcsname\pgfutil@insertatbegincurrentpagefrombox@WRONG + \let\pgfutil@insertatbegincurrentpagefrombox=\pgfutil@insertatbegincurrentpagefrombox@FIXED +\fi + % check if \endtikzpicture deals with layerlist: \expandafter\pgfutil@in@\expandafter\pgf@remember@layerlist@globally\expandafter{\endtikzpicture}% \ifpgfutil@in@ diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex index 487856a5a01..1929b2faccf 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorelayers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorelayers.code.tex index 8379e1d4f1a..613a1993cc0 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorelayers.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorelayers.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% @@ -27,7 +27,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorelayers.code.tex,v 1.4 2011/10/02 17:36:05 ludewich Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorelayers.code.tex,v 1.5 2012/11/07 19:23:16 ludewich Exp $ % Creates a new pgf layer @@ -42,8 +42,8 @@ \def\pgfdeclarelayer#1{% \pgfutil@ifundefined{pgf@layerbox@#1}{% - \expandafter\pgf@newbox\csname pgf@layerbox@#1\endcsname% - \expandafter\pgf@newbox\csname pgf@layerboxsaved@#1\endcsname% + \expandafter\expandafter\csname pgf@newbox\endcsname\csname pgf@layerbox@#1\endcsname% + \expandafter\expandafter\csname pgf@newbox\endcsname\csname pgf@layerboxsaved@#1\endcsname% }{}% } \let\pgf@newbox=\newbox % avoid plain TeX outer problem diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorescopes.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorescopes.code.tex index e2b22b73890..08d1e5e6d92 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorescopes.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorescopes.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% @@ -27,7 +27,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.37 2011/10/01 16:25:25 ludewich Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.38 2012/11/30 12:00:51 tantau Exp $ % Globals @@ -599,5 +599,4 @@ \let\pgf@savelayers=\relax \let\pgf@restorelayers=\relax - \endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex index 3afa39b2a2d..e505a111825 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex index cdbb8e0b541..9db17f509b6 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex index efb75e10b9c..352e13e9e46 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex index 6801918d200..c4a141cc566 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex index 0532c6876b2..94625bf7aee 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex index d7df866355c..933080daadd 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% @@ -146,6 +146,7 @@ \begingroup \catcode`\_=12 \gdef\pgfmanualpdf@underscore{_}% + \catcode`\ =13\relax\gdef\pgfmanualpdf@install@active@space{\def {\space}}% \endgroup \gdef\pgfmanualpdf@installreplacements{% @@ -157,6 +158,10 @@ \def\\{\textbackslash}% \def\space{:}% \edef\ {\space}% + \edef\SPACE{\` \relax}% + \ifnum\the\catcode`\ =13 % + \pgfmanualpdf@install@active@space + \fi \edef\#{}% \def\printanat{@}% \def\protect{}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex index 8b0770245c8..a2ab1d2fada 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex index 10aeaa849fb..f7889097516 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty index 7f42aaec1b8..e039fbc7984 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex index eabbcad77b7..23f088e84e4 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% @@ -755,6 +755,7 @@ \def\tikzexternalgetnextfilename#1{% \begingroup \let\tikzexternal@getnextfilename@advancecount\relax% NOP + \let\tikzexternal@getnextfilename@resetglobals=\relax% NOP \def\tikzexternal@protocol@to@file##1{}% NOP \tikzexternal@getnextfilename#1% \pgfmath@smuggleone#1% @@ -819,11 +820,15 @@ \fi \fi % + \tikzexternal@getnextfilename@resetglobals% + % + \tikzexternal@protocol@to@file#1% +}% + +\def\tikzexternal@getnextfilename@resetglobals{% % Reset global flags: \global\let\tikzexternal@nextfile=\pgfutil@empty \global\tikzexternalexportnexttrue - % - \tikzexternal@protocol@to@file#1% }% % #1: the image file name which should be protocolled. (can be a @@ -1464,6 +1469,7 @@ \ifeof\r@pgf@reada \else % read first line... + \endlinechar=-1 % older versions did not have a '%' at the end-of-line. Avoid spurious spaces. \read\r@pgf@reada to\pgf@tempa % ... and execute it. \pgf@tempa @@ -1486,7 +1492,7 @@ \else \tikzexternal@file@isuptodatefalse \immediate\openout\w@pgf@writea=\tikzexternal@curfilename\tikzexternal@check@uptodate@ext\relax% - \immediate\write\w@pgf@writea{\tikzexternal@hashfct@serialize{\tikzexternal@lastkey@new}}% + \immediate\write\w@pgf@writea{\tikzexternal@hashfct@serialize{\tikzexternal@lastkey@new}\tikzexternal@PERCENTchar}% \immediate\closeout\w@pgf@writea \fi \fi diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex index 49a7f10f8a4..bcef9c1eda1 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% +%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex index 7edbb15a4c3..f4906039522 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex @@ -144,6 +144,13 @@ \pgfutil@IfUndefined{pgfp@cyclist@\string#1@}{#3}{#2}% }% +\def\pgfplots@label@upgrade@warning{% + \ifpgfplots@threedim + \pgfplotswarning{center lines upgrade required}\pgfeov% + \global\let\pgfplots@label@upgrade@warning=\relax + \fi +}% + % Creates a named plot cycle list. % % #1: the name of the final list. Can be used in 'cycle list name' @@ -581,6 +588,8 @@ /pgfplots/every axis/.style={}, /pgfplots/every axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis}}, /pgfplots/every axis/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis post/.style={}, + /pgfplots/every axis post/.belongs to family=/pgfplots/scale, /pgfplots/every semilogx axis/.style={}, /pgfplots/every semilogx axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every semilogx axis}}, /pgfplots/every semilogx axis/.belongs to family=/pgfplots/style commands, @@ -616,7 +625,7 @@ % /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/every y tick scale label/.style={at={(yticklabel* cs:1.03,-0.3em)},/pgfplots/near ticklabel align=outside,anchor=near yticklabel opposite,inner sep=0pt}, },% /pgfplots/ylabel absolute/.style={% /pgfplots/every axis y label/.style={at={(0,0.5)},xshift=-35pt,rotate=90}, @@ -804,7 +813,8 @@ /pgfplots/extra z tick style/.code={% \pgfkeysalso{/pgfplots/every extra z tick/.append style={#1}}% }, - /pgfplots/every z tick scale label/.style={at={(zticklabel cs:1.2,-\pgfplotsvalueoflargesttickdimen z -0.3em)},anchor=near zticklabel,inner sep=0pt}, + % FIXME : this is replicated in 'axis z line=box'! + /pgfplots/every z tick scale label/.style={at={(zticklabel* cs:1.2,-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}, @@ -835,20 +845,30 @@ /pgfplots/colorbar source/.code={\pgfplots@error{Sorry, you can only set `colorbar source' inside of \string\addplot\space (or a cycle list)}}, /pgfplots/colorbar source/.default=true, /pgfplots/colorbar pos*/.initial=,% one of 'rltb' (right, left, top, bottom). for internal use, to handle checks. + /pgfplots/every colorbar global/.style={ + data cs=cart, + axis on top, + title=, + xlabel=, + ylabel=, + zlabel=, + legend entries=, + grid=none, + enlargelimits=false, + scale only axis, + xtick=, + xticklabel=, + ytick=, + yticklabel=, + }, /pgfplots/colorbar right/.style={% /pgfplots/colorbar=true, /pgfplots/colorbar pos*=r, /pgfplots/colorbar shift/.style={xshift=0.3cm}, /pgfplots/every colorbar/.style={% - title=, - xlabel=, - ylabel=, - zlabel=, - legend entries=, - axis on top, + /pgfplots/every colorbar global, at={(parent axis.right of north east)}, anchor=north west, - grid=none, xmin=0, xmax=1, ymin=\pgfkeysvalueof{/pgfplots/point meta min}, @@ -857,14 +877,9 @@ 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},% width=\pgfkeysvalueof{/pgfplots/colorbar/width}, xtick=\empty, - xticklabel=, - ytick=, - yticklabel=, yticklabel pos=right,% ATTENTION: I check for this setting in 'colorbar sampled line', see below! colorbar vertical/lowlevel, }% @@ -884,15 +899,9 @@ /pgfplots/colorbar pos*=b, /pgfplots/colorbar shift/.style={yshift=-0.3cm}, /pgfplots/every colorbar/.style={% - title=, - xlabel=, - ylabel=, - zlabel=, - legend entries=, - axis on top, + /pgfplots/every colorbar global, at={(parent axis.below south west)}, anchor=north west, - grid=none, ymin=0, ymax=1, xmin=\pgfkeysvalueof{/pgfplots/point meta min}, @@ -901,13 +910,9 @@ 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},% height=\pgfkeysvalueof{/pgfplots/colorbar/width}, xticklabel pos=left, - xtick=, - xticklabel=, ytick=\empty, colorbar horizontal/lowlevel, }% @@ -1428,6 +1433,13 @@ /pgfplots/anchor/.belongs to family=/pgfplots, /pgfplots/anchor/.store in= \pgfplots@anchorname, /pgfplots/anchor=south west, + % + % will be evaluated for *every* 'near ticklabel' anchor: + /pgfplots/near ticklabel align/.is choice, + /pgfplots/near ticklabel align/inside/.code= \def\pgfplots@borderanchor@align{0}, + /pgfplots/near ticklabel align/center/.code= \def\pgfplots@borderanchor@align{1}, + /pgfplots/near ticklabel align/outside/.code=\def\pgfplots@borderanchor@align{2}, + /pgfplots/near ticklabel align/center, /pgfplots/cell picture/.is choice, /pgfplots/cell picture/false/.code=\def\pgfplots@cell@picture@mode{0}, /pgfplots/cell picture/true/.code=\def\pgfplots@cell@picture@mode{1}, @@ -1662,6 +1674,10 @@ % graphical elements): /pgfplots/clip mode/individual/.code= \def\pgfplots@clipmode{2}, /pgfplots/clip mode=global, + /pgfplots/clip bounding box/.is choice, + /pgfplots/clip bounding box/default tikz/.code=\def\pgfplots@clip@BB@mode{0}, + /pgfplots/clip bounding box/upper bound/.code=\def\pgfplots@clip@BB@mode{1}, + /pgfplots/clip bounding box=default tikz, % the compat stuff. this is for backw. compat. % will be used if it exists: /pgfplots/axis background/.style={}, /pgfplots/axis background style/.style={/pgfplots/axis background/.append style={#1}}, @@ -1905,9 +1921,9 @@ /pgfplots/enlarge z limits/.initial=auto, /pgfplots/enlarge z limits/.default=true, /pgfplots/enlargelimits/.style={% - /pgfplots/enlarge x limits=#1,% - /pgfplots/enlarge y limits=#1,% - /pgfplots/enlarge z limits=#1,% + /pgfplots/enlarge x limits={#1},% + /pgfplots/enlarge y limits={#1},% + /pgfplots/enlarge z limits={#1},% },% /pgfplots/enlargelimits/.default=true, /pgfplots/enlargelimits respects figure size/.is if=pgfplots@enlargelimits@respect@figure@size, @@ -2222,38 +2238,6 @@ /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, - /pgfplots/axis x line/box/.style ={ - /pgfplots/axis x line*/box, - /pgfplots/every boxed x axis - }, - /pgfplots/axis x line/bottom/.style ={ - /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}}% - \else - \pgfkeysalso{/pgfplots/every axis x label/.style={at={(current axis.right of origin)},anchor=south east}}% - \fi - \pgfkeysalso{/pgfplots/axis x line*/middle, - /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{ - /pgfplots/every axis y label/.style={at={(current axis.below origin)},anchor=south west}}% - \fi - \pgfkeysalso{% - /pgfplots/axis x line*/top, - /pgfplots/every axis x label/.style={at={(0.5,1)},anchor=south,yshift=15pt}, - /pgfplots/every non boxed x axis}% - }, - /pgfplots/axis x line/none/.style ={axis x line*/none,hide x axis}, % sets \pgfplots@yaxislinesnum to % box=0 % left=1 @@ -2268,41 +2252,6 @@ /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, - /pgfplots/axis y line/box/.style ={ - /pgfplots/axis y line*/box, - /pgfplots/every boxed y axis - }, - /pgfplots/axis y line/left/.style ={ - /pgfplots/axis y line*/left, - /pgfplots/every non boxed y axis - }, - /pgfplots/axis y line/center/.code ={ - \ifnum\pgfplots@xaxislinesnum=3 % if 'axis x line==top' then - \pgfkeysalso{% - /pgfplots/every axis y label/.style={at={(current axis.below origin)},anchor=south west}}% - \else - \pgfkeysalso{% - /pgfplots/every axis y label/.style={at={(current axis.above origin)},anchor=north west}}% - \fi - \pgfkeysalso{% - /pgfplots/axis y line*/center, - /pgfplots/every non boxed y axis}% - }, - /pgfplots/axis y line/middle/.style ={/pgfplots/axis y line/center}, - /pgfplots/axis y line/right/.code ={% - \ifnum\pgfplots@xaxislinesnum=2 - \pgfkeysalso{every axis x label/.style={at={(current axis.left of origin)},anchor=south west}}% - \fi - \pgfkeysalso{ - axis 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 - }% - },% - /pgfplots/axis y line/none/.style ={axis y line*/none,hide y axis}, % % sets \pgfplots@zaxislinesnum to % box=0 @@ -2318,40 +2267,9 @@ /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 x line/.is choice, + /pgfplots/axis y line/.is choice, /pgfplots/axis z line/.is choice, - /pgfplots/axis z line/box/.style ={ - /pgfplots/axis z line*/box, - /pgfplots/every boxed z axis - }, - /pgfplots/axis z line/left/.style ={ - /pgfplots/axis z line*/left, - /pgfplots/every non boxed z axis - }, - /pgfplots/axis z line/center/.code ={ - % \ifnum\pgfplots@xaxislinesnum=3 % if 'axis x line==top' then - % \pgfkeysalso{% - % /pgfplots/every axis z label/.style={at={(current axis.below origin)},anchor=south west}}% - % \else - \pgfkeysalso{% - /pgfplots/every axis z label/.style={at={(current axis.above origin)},anchor=north west}}% - % \fi - \pgfkeysalso{% - /pgfplots/axis z line*/center, - /pgfplots/every non boxed z axis}% - }, - /pgfplots/axis z line/middle/.style ={/pgfplots/axis z line/center}, - /pgfplots/axis z line/right/.code ={% - \ifnum\pgfplots@xaxislinesnum=2 - \pgfkeysalso{every axis x label/.style={at={(current axis.left of origin)},anchor=south west}}% - \fi - \pgfkeysalso{ - axis z line*/right, - %every axis y label/.style={at={(1,1)},anchor=north west,xshift=15pt}, - every axis z label/.style={at={(1,0.5)},xshift=33pt,rotate=90}, - /pgfplots/every non boxed z axis - }% - },% - /pgfplots/axis z line/none/.style ={axis z line*/none,hide z axis}, /pgfplots/axis lines/.style={% axis x line=#1,% axis y line=#1,% @@ -2362,6 +2280,254 @@ axis y line*=#1,% axis z line*=#1% }, + /pgfplots/compat/axis line style pre 1.8/.style={% + % ALL INSIDE OF THIS STYLE IS DEPRECATED. + /pgfplots/axis x line/box/.style ={ + /pgfplots/axis x line*/box, + /pgfplots/every boxed x axis + }, + /pgfplots/axis x line/bottom/.style ={ + /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}}% + \else + \pgfkeysalso{/pgfplots/every axis x label/.style={at={(current axis.right of origin)},anchor=south east}}% + \fi + \pgfkeysalso{/pgfplots/every axis x label/.append code={\pgfplots@label@upgrade@warning}}% + \pgfkeysalso{/pgfplots/axis x line*/middle, + /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{ + /pgfplots/every axis y label/.style={at={(current axis.below origin)},anchor=south west}}% + \fi + \pgfkeysalso{% + /pgfplots/axis x line*/top, + /pgfplots/every axis x label/.style={at={(0.5,1)},anchor=south,yshift=15pt}, + /pgfplots/every non boxed x axis}% + }, + /pgfplots/axis x line/none/.style ={axis x line*/none,hide x axis}, + % + % Y : + /pgfplots/axis y line/box/.style ={ + /pgfplots/axis y line*/box, + /pgfplots/every boxed y axis + }, + /pgfplots/axis y line/left/.style ={ + /pgfplots/axis y line*/left, + /pgfplots/every non boxed y axis + }, + /pgfplots/axis y line/center/.code ={ + \ifnum\pgfplots@xaxislinesnum=3 % if 'axis x line==top' then + \pgfkeysalso{% + /pgfplots/every axis y label/.style={at={(current axis.below origin)},anchor=south west}}% + \else + \pgfkeysalso{% + /pgfplots/every axis y label/.style={at={(current axis.above origin)},anchor=north west}}% + \fi + \pgfkeysalso{/pgfplots/every axis y label/.append code={\pgfplots@label@upgrade@warning}}% + \pgfkeysalso{% + /pgfplots/axis y line*/center, + /pgfplots/every non boxed y axis}% + }, + /pgfplots/axis y line/middle/.style ={/pgfplots/axis y line/center}, + /pgfplots/axis y line/right/.code ={% + \ifnum\pgfplots@xaxislinesnum=2 + \pgfkeysalso{every axis x label/.style={at={(current axis.left of origin)},anchor=south west}}% + \fi + \pgfkeysalso{ + axis 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 + }% + },% + /pgfplots/axis y line/none/.style ={axis y line*/none,hide y axis}, + % + % + % Z : + % + /pgfplots/axis z line/box/.style ={ + /pgfplots/axis z line*/box, + /pgfplots/every boxed z axis + }, + /pgfplots/axis z line/left/.style ={ + /pgfplots/axis z line*/left, + /pgfplots/every non boxed z axis + }, + /pgfplots/axis z line/center/.code ={ + % \ifnum\pgfplots@xaxislinesnum=3 % if 'axis x line==top' then + % \pgfkeysalso{% + % /pgfplots/every axis z label/.style={at={(current axis.below origin)},anchor=south west}}% + % \else + \pgfkeysalso{% + /pgfplots/every axis z label/.style={at={(current axis.above origin)},anchor=north west}}% + % \fi + \pgfkeysalso{/pgfplots/every axis z label/.append code={\pgfplots@label@upgrade@warning}}% + \pgfkeysalso{% + /pgfplots/axis z line*/center, + /pgfplots/every non boxed z axis}% + }, + /pgfplots/axis z line/middle/.style ={/pgfplots/axis z line/center}, + /pgfplots/axis z line/right/.code ={% + \ifnum\pgfplots@xaxislinesnum=2 + \pgfkeysalso{every axis x label/.style={at={(current axis.left of origin)},anchor=south west}}% + \fi + \pgfkeysalso{ + axis z line*/right, + %every axis y label/.style={at={(1,1)},anchor=north west,xshift=15pt}, + every axis z label/.style={at={(1,0.5)},xshift=33pt,rotate=90}, + /pgfplots/every non boxed z axis + }% + },% + /pgfplots/axis z line/none/.style ={axis z line*/none,hide z axis}, + }, + /pgfplots/compat/axis line style post 1.8/.style={% + /pgfplots/axis x line/box/.style ={ + /pgfplots/axis x line*/box, + /pgfplots/xlabel near ticks, + /pgfplots/every boxed x axis + }, + /pgfplots/axis x line/bottom/.style ={ + /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={ + /pgfplots/near ticklabel align=inside,at={(ticklabel* cs:0)},anchor=near ticklabel opposite}}% + \else + \pgfkeysalso{/pgfplots/every axis x label/.style={ + /pgfplots/near ticklabel align=inside,at={(ticklabel* cs:1)},anchor=near ticklabel opposite}}% + \fi + \pgfkeysalso{/pgfplots/axis x line*/middle, + /pgfplots/every x tick scale label/.code={% + \ifpgfplotsthreedim + \pgfkeysalso{at={(xticklabel* cs:1.03)},/pgfplots/near ticklabel align=outside,anchor=near xticklabel}% + \else + \pgfkeysalso{at={(xticklabel cs:0.9,5pt)},anchor=near xticklabel,inner sep=0pt}% + \fi + },% + /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{/pgfplots/every axis y label/.style={ + /pgfplots/near ticklabel align=inside,at={(ticklabel* cs:0)},anchor=near ticklabel opposite}}% + \fi + \pgfkeysalso{% + /pgfplots/axis x line*/top, + /pgfplots/every axis x label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel},% + /pgfplots/every y tick scale label/.style={at={(yticklabel cs:0)},anchor=near yticklabel}, + /pgfplots/every non boxed x axis}% + }, + /pgfplots/axis x line/none/.style ={axis x line*/none,hide x axis}, + % + % Y : + /pgfplots/axis y line/box/.style ={ + /pgfplots/axis y line*/box, + /pgfplots/ylabel near ticks, + /pgfplots/every boxed y axis + }, + /pgfplots/axis y line/left/.style ={ + /pgfplots/axis y line*/left, + /pgfplots/every non boxed y axis + }, + /pgfplots/axis y line/center/.code ={ + \ifnum\pgfplots@xaxislinesnum=3 % if 'axis x line==top' then + \pgfkeysalso{% + /pgfplots/every axis y label/.style={ + /pgfplots/near ticklabel align=outside,at={(ticklabel* cs:0)},anchor=near ticklabel opposite}}% + \else + \pgfkeysalso{% + /pgfplots/every axis y label/.style={ + /pgfplots/near ticklabel align=inside,at={(ticklabel* cs:1)},anchor=near ticklabel opposite}}% + \fi + \pgfkeysalso{% + /pgfplots/axis y line*/center, + /pgfplots/every y tick scale label/.code={% + \ifpgfplotsthreedim + \pgfkeysalso{at={(yticklabel* cs:1.03)},/pgfplots/near ticklabel align=outside,anchor=near yticklabel}% + \else + \pgfkeysalso{at={(yticklabel* cs:1.03,-0.3em)},/pgfplots/near ticklabel align=outside,anchor=near yticklabel opposite,inner sep=0pt}% + \fi + },% + /pgfplots/every non boxed y axis}% + }, + /pgfplots/axis y line/middle/.style ={/pgfplots/axis y line/center}, + /pgfplots/axis y line/right/.code ={% + \ifnum\pgfplots@xaxislinesnum=2 + \pgfkeysalso{ + /pgfplots/every axis x label/.style={ + /pgfplots/near ticklabel align=outside,at={(ticklabel* cs:0)},anchor=near ticklabel opposite}}% + \fi + \pgfkeysalso{ + axis y line*/right, + /pgfplots/every axis y label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel, + /utils/exec={% + \ifpgfplotsthreedim\else \pgfkeysalso{rotate=90}\fi + },% + }, + /pgfplots/every y tick scale label/.code={ + \ifpgfplotsthreedim + \pgfkeysalso{at={(yticklabel cs:0)},anchor=near yticklabel}% + \else + \pgfkeysalso{at={(yticklabel cs:1)},anchor=near yticklabel}% + \fi + },% + /pgfplots/every non boxed y axis + }% + },% + /pgfplots/axis y line/none/.style ={axis y line*/none,hide y axis}, + % + % + % Z : + % + /pgfplots/axis z line/box/.style ={ + /pgfplots/axis z line*/box, + /pgfplots/every axis z label/.style={at={(ticklabel cs:0.5)},rotate=90, anchor=near ticklabel}, + /pgfplots/every z tick scale label/.style={at={(zticklabel* cs:1.2,-0.3em)},anchor=near zticklabel,inner sep=0pt}, + /pgfplots/every boxed z axis + }, + /pgfplots/axis z line/left/.style ={ + /pgfplots/axis z line*/left, + /pgfplots/every non boxed z axis + }, + /pgfplots/axis z line/center/.code ={ + \pgfkeysalso{% + /pgfplots/every axis z label/.style={ + /pgfplots/near ticklabel align=inside,at={(ticklabel* cs:1)},anchor=near ticklabel opposite}}% + \pgfkeysalso{% + /pgfplots/axis z line*/center, + /pgfplots/every non boxed z axis}% + }, + /pgfplots/axis z line/middle/.style ={/pgfplots/axis z line/center}, + /pgfplots/axis z line/right/.code ={% + \ifnum\pgfplots@xaxislinesnum=2 + \pgfkeysalso{ + /pgfplots/every axis z label/.style={ + /pgfplots/near ticklabel align=outside,at={(ticklabel* cs:0)},anchor=near ticklabel opposite}}% + \fi + \pgfkeysalso{ + axis z line*/right, + every axis z label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel,rotate=90}, + /pgfplots/every z tick scale label/.style={at={(zticklabel cs:0)},anchor=near zticklabel}, + /pgfplots/every non boxed z axis + }% + },% + /pgfplots/axis z line/none/.style ={axis z line*/none,hide z axis}, + }, /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}},% @@ -2530,7 +2696,8 @@ \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% + \def\pgfplots@loc@TMPa{x}% + \ifx\pgfplotspointmetainputhandler\pgfplots@loc@TMPa% % point meta=x: \def\pgfplots@nodes@near@coords@align{horizontal}% \else @@ -2662,6 +2829,7 @@ /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=6pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0pt,0.8em)};}, }, /pgfplots/ybar/.style={ + bar direction=y, bar cycle list, xtick align=outside, ybar legend, @@ -2693,7 +2861,14 @@ /pgfplots/single xbar legend/.style={ /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=6pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0pt,0.8em)};}, }, + /pgfplots/bar direction/.is choice, + /pgfplots/bar direction/auto/.code=\def\pgfplots@bar@direction@choice{a},% + /pgfplots/bar direction/x/.code=\def\pgfplots@bar@direction@choice{x},% + /pgfplots/bar direction/y/.code=\def\pgfplots@bar@direction@choice{y},% + /pgfplots/bar direction=auto, + % /pgfplots/xbar/.style={ + bar direction=x, bar cycle list, ytick align=outside, /pgfplots/xbar legend, @@ -2723,6 +2898,7 @@ /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={% + bar direction=y, /pgfplots/set point meta if empty=f(x),% bar cycle list, x tick label as interval, @@ -2739,6 +2915,7 @@ /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={% + bar direction=x, /pgfplots/set point meta if empty=x,% bar cycle list, y tick label as interval, @@ -2752,6 +2929,7 @@ }, /pgfplots/xbar interval/.default=1, /pgfplots/xbar stacked/.style={ + bar direction=x, /pgfplots/set point meta if empty=x,% bar cycle list, single xbar legend, @@ -2761,6 +2939,7 @@ }, /pgfplots/xbar stacked/.default=plus, /pgfplots/ybar stacked/.style={ + bar direction=y, /pgfplots/set point meta if empty=f(x),% bar cycle list, single ybar legend, @@ -2770,6 +2949,7 @@ }, /pgfplots/ybar stacked/.default=plus, /pgfplots/xbar interval stacked/.style={ + bar direction=x, /pgfplots/set point meta if empty=x,% bar cycle list, single xbar legend, @@ -2779,6 +2959,7 @@ }, /pgfplots/xbar interval stacked/.default=plus, /pgfplots/ybar interval stacked/.style={ + bar direction=y, /pgfplots/set point meta if empty=f(x),% bar cycle list, single ybar legend, @@ -2876,6 +3057,35 @@ /pgfplots/patch/.code={% \pgfkeysalso{/pgfplots/surf=#1,/pgfplots/mesh input=patches,/pgfplots/every patch}% },% + % + /pgfplots/mesh/color input/.is choice, + /pgfplots/mesh/color input/colormap/.code=\def\pgfplotsplothandlermesh@colorinput{0},% + /pgfplots/mesh/color input/explicit/.code={% + \def\pgfplotsplothandlermesh@colorinput{1}% + \def\pgfplotsplothandlermesh@colorinput@mathparse{0}% + % + \pgfplotsaxisifhaspointmeta{% + \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname + % ok. + \else + % oh. the point meta is numeric, i.e. it will be + % mapped. Change to symbolic for explicit color input: + \pgfkeysalso{/pgfplots/point meta/explicit symbolic}% + \fi + }{% + % there is no point meta. Set it to "reasonable" defaults: + \pgfkeysalso{/pgfplots/point meta/explicit symbolic}% + }% + },% + /pgfplots/mesh/color input/explicit mathparse/.code={% + \pgfkeysalso{/pgfplots/mesh/color input/explicit}% + \def\pgfplotsplothandlermesh@colorinput@mathparse{1}% + },% + /pgfplots/mesh/color input=colormap, + % + /pgfplots/mesh/colorspace explicit color output/.initial=rgb, + /pgfplots/mesh/colorspace explicit color input/.initial=rgb, + % /pgfplots/every patch/.style={miter limit=1}, /pgfplots/patch table/value/.initial=, /pgfplots/patch table/.code={ @@ -3112,6 +3322,7 @@ /pgfplots/point meta/TeX code/.value required, /pgfplots/point meta/TeX code symbolic/.code={\pgfplotssetpointmetainput{TeX code symbolic}{#1}},% /pgfplots/point meta/TeX code symbolic/.value required, + /pgfplots/point meta/symbolic/.style={/pgfplots/point meta/TeX code symbolic={\def\pgfplotspointmeta{#1}}}, /pgfplots/set point meta if empty/.code={% \ifx\pgfplotspointmetainputhandler\pgfutil@empty \pgfkeysalso{/pgfplots/point meta/#1}% @@ -3135,7 +3346,8 @@ \pgfkeysalso{/pgfplots/colormap name=#1}% }, /pgfplots/colormap/hot/.style={ - colormap name=hot + % attention: copied from pgfplots.colormap.code.tex: + /pgfplots/colormap={hot}{color(0cm)=(blue); color(1cm)=(yellow); color(2cm)=(orange); color(3cm)=(red)} }, /pgfplots/colormap/hot2/.style={ /pgfplots/colormap={hot2}{[1cm]rgb255(0cm)=(0,0,0) rgb255(3cm)=(255,0,0) rgb255(6cm)=(255,255,0) rgb255(8cm)=(255,255,255)} @@ -3153,10 +3365,10 @@ /pgfplots/colormap={redyellow}{rgb255(0cm)=(255,0,0); rgb255(1cm)=(255,255,0)} }, /pgfplots/colormap/blackwhite/.style={ - colormap={blackwhite}{gray(0cm)=(0); gray(1cm)=(1)} + /pgfplots/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/colormap={violet}{rgb255=(25,25,122) color=(white) rgb255=(238,140,238)} }, /pgfplots/colormap/jet/.style={ /pgfplots/colormap={jet}{rgb255(0cm)=(0,0,128) rgb255(1cm)=(0,0,255) rgb255(3cm)=(0,255,255) rgb255(5cm)=(255,255,0) rgb255(7cm)=(255,0,0) rgb255(8cm)=(128,0,0)} @@ -3340,6 +3552,7 @@ /pgfplots/compat/anchors/1.5.1/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/1.6/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/1.7/.style= {/pgfplots/compat/anchors/1.3},% + /pgfplots/compat/anchors/1.8/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/newest/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/default/.style={/pgfplots/compat/anchors/1.3},% % @@ -3351,6 +3564,7 @@ /pgfplots/compat/empty line/1.5.1/.style= {/pgfplots/compat/empty line/1.4},% /pgfplots/compat/empty line/1.6/.style= {/pgfplots/compat/empty line/1.4},% /pgfplots/compat/empty line/1.7/.style= {/pgfplots/compat/empty line/1.4},% + /pgfplots/compat/empty line/1.8/.style= {/pgfplots/compat/empty line/1.4},% /pgfplots/compat/empty line/newest/.style= {/pgfplots/compat/empty line/1.4},% /pgfplots/compat/empty line/default/.style= {/pgfplots/compat/empty line/1.4},% % @@ -3362,15 +3576,18 @@ /pgfplots/compat/path replacement/1.5.1/.code= {\pgfplots@path@replace@ellipsetrue},% /pgfplots/compat/path replacement/1.6/.style= {/pgfplots/compat/path replacement/1.5.1}, /pgfplots/compat/path replacement/1.7/.style= {/pgfplots/compat/path replacement/1.5.1}, + /pgfplots/compat/path replacement/1.8/.style= {/pgfplots/compat/path replacement/1.5.1}, /pgfplots/compat/path replacement/newest/.style= {/pgfplots/compat/path replacement/1.5.1},% /pgfplots/compat/path replacement/default/.style= {/pgfplots/compat/path replacement/pre 1.3},% %ellipse/.is if=pgfplots@path@replace@ellipse, % /pgfplots/compat/labels/.is choice, /pgfplots/compat/labels/pre 1.3/.style={% + /pgfplots/compat/axis line style pre 1.8, /pgfplots/xlabel absolute, /pgfplots/ylabel absolute},% /pgfplots/compat/labels/1.3/.style={% + /pgfplots/compat/axis line style pre 1.8, /pgfplots/xlabel near ticks, /pgfplots/ylabel near ticks},% /pgfplots/compat/labels/1.4/.style= {/pgfplots/compat/labels/1.3},% @@ -3378,7 +3595,11 @@ /pgfplots/compat/labels/1.5.1/.style= {/pgfplots/compat/labels/1.3},% /pgfplots/compat/labels/1.6/.style= {/pgfplots/compat/labels/1.3},% /pgfplots/compat/labels/1.7/.style= {/pgfplots/compat/labels/1.3},% - /pgfplots/compat/labels/newest/.style= {/pgfplots/compat/labels/1.3},% + /pgfplots/compat/labels/1.8/.style= { + /pgfplots/compat/labels/1.3, + /pgfplots/compat/axis line style post 1.8, + },% + /pgfplots/compat/labels/newest/.style= {/pgfplots/compat/labels/1.8},% /pgfplots/compat/labels/default/.style= {/pgfplots/compat/labels/pre 1.3},% maintain backwards compatibility for labels :-( % % search for the \pgfplots@compat@scaling@coordmath -- using float @@ -3403,6 +3624,7 @@ \def\pgfplots@compat@scaling@coordmath@final{float}% }, /pgfplots/compat/scaling/1.7/.style={/pgfplots/compat/scaling/1.6}, + /pgfplots/compat/scaling/1.8/.style={/pgfplots/compat/scaling/1.6}, /pgfplots/compat/scaling/newest/.style={/pgfplots/compat/scaling/1.6}, /pgfplots/compat/scaling/default/.style={/pgfplots/compat/scaling/1.4}, % @@ -3414,6 +3636,7 @@ /pgfplots/compat/scale mode/1.5.1/.style= {/pgfplots/compat/scale mode/pre 1.3}, /pgfplots/compat/scale mode/1.6/.code=\def\pgfplots@compat@scale@mode@compatible@mode{0}, /pgfplots/compat/scale mode/1.7/.style={/pgfplots/compat/scale mode/1.6}, + /pgfplots/compat/scale mode/1.8/.style={/pgfplots/compat/scale mode/1.6}, /pgfplots/compat/scale mode/newest/.style={/pgfplots/compat/scale mode/1.6}, /pgfplots/compat/scale mode/default/.style={/pgfplots/compat/scale mode/1.5}, % @@ -3426,6 +3649,7 @@ /pgfplots/compat/plot3graphics/1.5.1/.style= {/pgfplots/compat/plot3graphics/1.5},% /pgfplots/compat/plot3graphics/1.6/.code= {\def\b@pgfplots@compat@plot@graphics@threedim{2}},% /pgfplots/compat/plot3graphics/1.7/.style= {/pgfplots/compat/plot3graphics/1.6},% + /pgfplots/compat/plot3graphics/1.8/.style= {/pgfplots/compat/plot3graphics/1.6},% /pgfplots/compat/plot3graphics/newest/.style= {/pgfplots/compat/plot3graphics/1.6},% /pgfplots/compat/plot3graphics/default/.style= {/pgfplots/compat/plot3graphics/1.5},% % @@ -3464,24 +3688,38 @@ /pgfplots/compat/bar width by units/1.5.1/.style= {/pgfplots/compat/bar width by units/pre 1.3},% /pgfplots/compat/bar width by units/1.6/.style= {/pgfplots/compat/bar width by units/pre 1.3},% /pgfplots/compat/bar width by units/1.7/.code= {\def\b@pgfplots@compat@bar@width@units{0}},% + /pgfplots/compat/bar width by units/1.8/.code= {\def\b@pgfplots@compat@bar@width@units{0}},% /pgfplots/compat/bar width by units/newest/.style= {/pgfplots/compat/bar width by units/1.7}, /pgfplots/compat/bar width by units/default/.style={/pgfplots/compat/bar width by units/pre 1.3}, % + /pgfplots/compat/BB/.is choice, + /pgfplots/compat/BB/pre 1.3/.style={/pgfplots/clip bounding box=default tikz},% + /pgfplots/compat/BB/1.3/.style= {/pgfplots/compat/BB/pre 1.3}, + /pgfplots/compat/BB/1.4/.style= {/pgfplots/compat/BB/pre 1.3},% + /pgfplots/compat/BB/1.5/.style= {/pgfplots/compat/BB/pre 1.3},% + /pgfplots/compat/BB/1.5.1/.style= {/pgfplots/compat/BB/pre 1.3},% + /pgfplots/compat/BB/1.6/.style= {/pgfplots/compat/BB/pre 1.3},% + /pgfplots/compat/BB/1.7/.style= {/pgfplots/compat/BB/pre 1.3},% + /pgfplots/compat/BB/1.8/.style= {/pgfplots/clip bounding box=upper bound},% + /pgfplots/compat/BB/newest/.style= {/pgfplots/compat/BB/1.8}, + /pgfplots/compat/BB/default/.style={/pgfplots/compat/BB/pre 1.3}, + % /pgfplots/compat/general/.is choice, /pgfplots/compat/general/pre 1.3/.style={/pgfplots/log origin=infty},% /pgfplots/compat/general/1.3/.style= {/pgfplots/compat/general/pre 1.3}, /pgfplots/compat/general/1.4/.style= {/pgfplots/compat/general/pre 1.3},% - /pgfplots/compat/general/1.5/.style= {/pgfplots/compat/general/newest},% - /pgfplots/compat/general/1.5.1/.style= {/pgfplots/compat/general/newest},% - /pgfplots/compat/general/1.6/.style= {/pgfplots/compat/general/newest},% - /pgfplots/compat/general/1.7/.style= {/pgfplots/compat/general/newest},% - /pgfplots/compat/general/newest/.style= {/pgfplots/log origin=0}, - /pgfplots/compat/general/default/.style={/pgfplots/compat/general/newest}, + /pgfplots/compat/general/1.5/.style= {/pgfplots/log origin=0},% + /pgfplots/compat/general/1.5.1/.style= {/pgfplots/compat/general/1.5},% + /pgfplots/compat/general/1.6/.style= {/pgfplots/compat/general/1.5},% + /pgfplots/compat/general/1.7/.style= {/pgfplots/compat/general/1.5},% + /pgfplots/compat/general/1.8/.style= {/pgfplots/compat/general/1.5},% + /pgfplots/compat/general/newest/.style= {/pgfplots/compat/general/1.8}, + /pgfplots/compat/general/default/.style={/pgfplots/compat/general/1.5}, % /pgfplots/compat/show suggested version/.is if=pgfplots@show@suggested@version, /pgfplots/compat/show suggested version=true, /pgfplots/compat/current/.initial=, - /pgfplots/compat/mostrecent/.initial=1.7, + /pgfplots/compat/mostrecent/.initial=1.8, /pgfplots/compat/.style={% % ATTENTION: *every* /pgfplots/compat/ setting needs to accept % the same choices due to this construction: @@ -3492,6 +3730,7 @@ /pgfplots/compat/scaling=#1,% /pgfplots/compat/scale mode=#1,% /pgfplots/compat/general=#1,% + /pgfplots/compat/BB=#1,% /pgfplots/compat/path replacement=#1,% /pgfplots/compat/plot3graphics=#1,% /pgfplots/compat/bar width by units=#1,% @@ -3501,32 +3740,22 @@ % /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}% + \def\length{15} + \def\pgfplots@@draw@normal####1####2{% + \pgfpathmoveto{####1} \pgfpathlineto{% \pgfpointadd - {#1} - {\pgfqpointscale{\length}{\pgfplotspointouternormalvectorofticklabelaxis{y}}}% + {####1} + {\pgfqpointscale{\length}{\pgfplotspointouternormalvectorofticklabelaxis{####2}}}% }% - }; + }% + \draw[->,blue] \pgfextra{\pgfplots@@draw@normal{#1}{x}}; + \draw[->,blue] \pgfextra{\pgfplots@@draw@normal{\pgfplotsqpointoutsideofticklabelaxisrel{x}{1}{0}}{x}}; + \draw[->,red] \pgfextra{\pgfplots@@draw@normal{#1}{y}}; + \draw[->,red] \pgfextra{\pgfplots@@draw@normal{\pgfplotsqpointoutsideofticklabelaxisrel{y}{1}{0}}{y}}; \ifpgfplots@threedim - \draw[->,black] \pgfextra{% - \pgfpathmoveto{#1}% - \pgfpathlineto{% - \pgfpointadd - {#1} - {\pgfqpointscale{\length}{\pgfplotspointouternormalvectorofticklabelaxis{z}}}% - }% - }; + \draw[->,black] \pgfextra{\pgfplots@@draw@normal{#1}{z}}; + \draw[->,black] \pgfextra{\pgfplots@@draw@normal{\pgfplotsqpointoutsideofticklabelaxisrel{z}{1}{0}}{z}}; \fi }, }, @@ -3702,7 +3931,7 @@ \def\pgfplots@warn@if@log@basis@unset@#1#2{% \pgfkeysgetvalue{/pgfplots/log basis #1}\pgfplots@loc@TMPa \ifx\pgfplots@loc@TMPa\pgfutil@empty - \pgfplots@warning{Some input argument (#2) explicitly relies on the log basis of #1 (which is e). Please verify that this is intended and set 'log basis #1=10' otherwise. This warning will be shown only once per document.}% + \pgfplotswarning{log basis required}{#1}{#2}\pgfeov \fi \gdef\pgfplots@warn@if@log@basis@unset##1##2{}% }% @@ -3727,6 +3956,7 @@ % % Both things are not necessary - but they *can* be used. \tikzdeclarecoordinatesystem{ticklabel}{\pgfplotspointticklabelcs[\pgfkeysvalueof{/pgfplots/#1label shift}]{#1}{##1}}% + \tikzdeclarecoordinatesystem{ticklabel*}{\pgfplotspointticklabelnoshiftcs{#1}{##1}}% \pgfplotsdeclareborderanchorforticklabelaxis{#1}{near ticklabel}% % \pgfkeysgetvalue{/tikz/sloped/.@cmd}\pgfplots@loc@TMPa @@ -3809,6 +4039,13 @@ % ATTENTION: this thing is used IF AND ONLY IF d=2 and the axis is % drawn as box. \def\pgfplots@drawaxis@outerlines@cycledpath{% + \pgfplots@loc@tmptrue + \ifpgfplots@hide@x + \ifpgfplots@hide@y + \pgfplots@loc@tmpfalse + \fi + \fi +\ifpgfplots@loc@tmp \draw[ /pgfplots/every outer x axis line, % using these outer styles is only useful in conjunction with 'separate axis lines=true' /pgfplots/every outer y axis line] @@ -3847,13 +4084,12 @@ % make sure that we do not have any of the axis discontinuities % here - they should not be closed. \if0\pgfplots@xaxisdiscontnum - \else \if0\pgfplots@yaxisdiscontnum - \else -- cycle \fi \fi ;% +\fi }% % Assigns the macros @@ -3881,8 +4117,9 @@ \def\discontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}% \advance \disend by -8pt \fi + \pgfplotscoordmath{#1}{datascaletrafo get params}% % if #1max + shift < 0pt (shift is 0 without the scaling trafo) - \ifdim\csname pgfplots@#1max@reg\endcsname<-\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname pt + \ifdim\csname pgfplots@#1max@reg\endcsname<-\pgfplotsretvalb pt % swap start and end \disstart=\disend \disend=4pt @@ -4020,7 +4257,7 @@ % 2. we need to remember all these options inside of % 'current plot style' -- otherwise, they would not appear % inside of legend images and markers. - \pgfplotsplothandlersurveyaddoptions{#1}% + \pgfplotssurveyphaseaddoptionsbeforesurveybegins{#1}% }% \def\pgfplots@replacement@for@endscope{% \endgroup @@ -4667,7 +4904,7 @@ \def\pgfplotslegendfromname@#1{% \pgfutil@IfUndefined{pgfplots@legend@to@name@#1}{% \pgfutil@IfUndefined{ref}{% - \pgfplots@warning{There is no `legend to name=#1', sorry. I am skipping it}% + \pgfplotswarning{no such legend to name}{#1}\pgfeov \string\pgfplotslegendfromname{#1}: ??% }{% \ref{\string\pgfplotslegendfromname{#1}}% @@ -4683,7 +4920,7 @@ \def\pgfplotscolorbarfromname@#1{% \pgfutil@IfUndefined{pgfplots@colorbar@to@name@#1}{% \pgfutil@IfUndefined{ref}{% - \pgfplots@warning{There is no `colorbar to name=#1', sorry. I am skipping it}% + \pgfplotswarning{no such colorbar to name}{#1}\pgfeov \string\pgfplotscolorbarfromname{#1}: ??% }{% \ref{\string\pgfplotscolorbarfromname{#1}}% @@ -4699,7 +4936,7 @@ \def\pgfplotsplotfromname@#1{% \pgfutil@IfUndefined{pgfplots@show@ref@#1}{% \pgfutil@IfUndefined{ref}{% - \pgfplots@warning{There is no \string\addplot\space label `#1', sorry. I am skipping it}% + \pgfplotswarning{no such addplot label}{#1}\pgfeov \string\pgfplotsplotfromname{#1}: ??% }{% \ref{\string\pgfplotsplotfromname{#1}}% @@ -5052,7 +5289,7 @@ \fi \ifx\pgfplotsretval\pgfutil@empty \else - \pgfplots@warning{enlargelimits respects figure size=true: could not respect the prescribed width/height (\pgfplotsretval). The size and/or aspect ratio of your image will be different than expected. You can try to modify BOTH width and height.}% + \pgfplotswarning{enlargelimits respects figure size failed}\pgfeov% \fi \fi \fi @@ -5268,7 +5505,7 @@ } \def\pgfplots@handle@invalid@range{% % COMPLETELY EMPTY AXIS: - \pgfplots@warning{You have an axis with empty range. Replacing it with a default range and clearing all plots.}% + \pgfplotswarning{empty range cleared axis}\pgfplots@loc@TMPa\pgfeov \pgfplots@handle@invalid@range@defaultlimits % \pgfplots@threedimfalse @@ -5283,24 +5520,31 @@ } \def\pgfplots@check@invalid@range{% \pgfplots@limits@are@computedtrue + \def\pgfplots@loc@TMPa{}% \ifx\pgfplots@xmin\pgfplots@invalidrange@xmin \pgfplots@limits@are@computedfalse + \edef\pgfplots@loc@TMPa{x}% \fi \ifx\pgfplots@xmax\pgfplots@invalidrange@xmax \pgfplots@limits@are@computedfalse + \edef\pgfplots@loc@TMPa{x}% \fi \ifx\pgfplots@ymin\pgfplots@invalidrange@ymin \pgfplots@limits@are@computedfalse + \edef\pgfplots@loc@TMPa{y}% \fi \ifx\pgfplots@ymax\pgfplots@invalidrange@ymax \pgfplots@limits@are@computedfalse + \edef\pgfplots@loc@TMPa{y}% \fi \ifpgfplots@threedim \ifx\pgfplots@zmin\pgfplots@invalidrange@zmin \pgfplots@limits@are@computedfalse + \edef\pgfplots@loc@TMPa{z}% \fi \ifx\pgfplots@zmax\pgfplots@invalidrange@zmax \pgfplots@limits@are@computedfalse + \edef\pgfplots@loc@TMPa{z}% \fi \fi \ifpgfplots@limits@are@computed @@ -5591,7 +5835,7 @@ \let\pgfplots@min=\pgfmathresult \pgfplotscoordmath{#1}{datascaletrafo inverse to fixed}{\csname pgfplots@#1max\endcsname}% \let\pgfplots@max=\pgfmathresult - \pgfplots@warning{Axis range for axis #1 is approximately empty; enlarging it (it is [\pgfplots@min:\pgfplots@max])}% + \pgfplotswarning{approx empty range enlarged}{#1}{\pgfplots@min}{\pgfplots@max}\pgfeov \endgroup % the case \pgfplots@@min ~= \pgfplots@@max % @@ -5772,7 +6016,12 @@ \anchor{above origin}{% \pgfpointintersectionoflines {\pgfplotspointaxisorigin} - {\pgfpointadd{\pgfplotspointaxisorigin}{\pgfplotspointyaxis}} + {\pgfpointadd + {\pgfplotspointaxisorigin}% + {\pgfplotspointyaxis + \pgfplots@assert@not@zero{\pgf@y}{y axis has eyy=0; cannot compute above origin anchor}% + }% + }% {\pgfplotsqpointdescriptionxy{0}{1}} {\pgfplotsqpointdescriptionxy{1}{1}}% }% @@ -5895,7 +6144,11 @@ \anchor{above origin}{% \pgfpointintersectionoflines {\origin} - {\pgfpointadd{\origin}{\innerdiagonal\global\pgf@x=0sp }} + {\pgfpointadd{\origin}{% + \innerdiagonal\global\pgf@x=0sp + \pgfplots@assert@not@zero{\pgf@y}{y axis has eyy=0; cannot compute above origin anchor}% + }% + }% {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\global\pgf@x=0sp }} {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal}}% }% @@ -6849,66 +7102,72 @@ \def\pgfplots@loc@axischar@for@first{x}% \fi \fi - %\if2\csname pgfplots@#1axislinesnum\endcsname + % + % First, compute stuff as if we had a box. Ignore the "center" + % styles with a single axis line for now. + % + \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 + \else + \if l\csname pgfplots@#1ticklabel@pos\endcsname + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}% + \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 + \else + \if l\csname pgfplots@#1ticklabel@pos\endcsname + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}% + \fi + \fi + }% + % + % Now, adapt result to "center" styles: + \if2\csname pgfplots@#1axislinesnum\endcsname % axis #1 lines=center . - \iffalse - % FIXME : while this here seems reasonable, it is not fully - % implemented. The "outer normal" is missing and one other - % component produces a NYI-warning + % + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec@box\endcsname{\csname pgfplots@#1ticklabelaxisspec\endcsname}% % % well, for 3d, this implies that all others also have % "center". And since "0" == lower, "1" == upper", "2" == % center, we have to use center: \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 22}% - \else - \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 - \else - \if l\csname pgfplots@#1ticklabel@pos\endcsname - \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}% - \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 - \else - \if l\csname pgfplots@#1ticklabel@pos\endcsname - \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}% - \fi - \fi - }% \fi }% \def\pgfplots@init@ticklabelaxisspec@twodim@for#1#2{% + % First, compute stuff as if we had a box. Ignore the "center" + % styles with a single axis line for now. + % \if#1x% \def\pgfplots@loc@to@threedim##1{v##10}% \def\pgfplots@loc@axischar@for@first{y}% @@ -6941,6 +7200,18 @@ \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 1}% \fi \fi + % + % Now, adapt result to "center" styles: + \if2\csname pgfplots@#1axislinesnum\endcsname + % axis #1 lines=center . + % + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec@box\endcsname{\csname pgfplots@#1ticklabelaxisspec\endcsname}% + % + % well, for 3d, this implies that all others also have + % "center". And since "0" == lower, "1" == upper", "2" == + % center, we have to use center: + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 2}% + \fi }% @@ -7425,6 +7696,14 @@ } \def\pgfplotsutil@END@cell@picture#1{% + \xdef\pgfplots@cell@picture@remembered{% + \ifpgfrememberpicturepositiononpage + \noexpand\pgfrememberpicturepositiononpagetrue + \else + \noexpand\pgfrememberpicturepositiononpagefalse + \fi + }% + \xdef\pgfplots@cell@pictureid{\pgfpictureid}% \endtikzpicture% \begingroup \ifdim\pgf@picmaxx=-16000pt\relax% @@ -7541,6 +7820,8 @@ \endgroup \endpgfinterruptboundingbox \endgroup + \global\let\pgfplots@cell@picture@remembered=\relax + \global\let\pgfplots@cell@pictureid=\pgfutil@empty }% \def\pgfplots@BEGIN@init@and@draw@axis{% @@ -7841,6 +8122,9 @@ % \let\pgfplots@clippath@install@pathcmd=\pgfplots@clippath@install \iffalse + % FIXME : this was an idea to optimize the installation of the + % clip path (cache the protocolled version). FIX IT + % \pgf@resetpathsizes% FIXME: this here should not be necessary! \pgfsysprotocol@getcurrentprotocol\pgfplots@loc@TMPa% \begingroup @@ -7864,21 +8148,111 @@ % optimized version (if ##1=\pgfusepath{clip}) \def\pgfplots@clippath@install##1{% \def\pgfplots@loc@TMPa{##1}% - \ifx\pgfplots@loc@TMPa\pgfplots@clippath@install@test + \let\pgfplots@clippath@install@aftergroup=\pgfutil@empty % the 'clip' path has been precomputed because it is often - % used: - \expandafter\pgfsys@invoke\expandafter{\pgfplots@clippath@install@clip@protocolled}% - % as far as I can see, this here is the only command which - % can't be protocolled: - \pgf@relevantforpicturesizefalse - \else - \pgf@resetpathsizes% FIXME: this here should not be necessary! - \pgfplots@clippath@install@pathcmd{##1}% + % used: FIXME: unfinished, see above + %\expandafter\pgfsys@invoke\expandafter{\pgfplots@clippath@install@clip@protocolled}% + \ifx\pgfplots@loc@TMPa\pgfplots@clippath@install@test + \if0\pgfplots@clip@BB@mode + % clip bounding box=default tikz + \else + % clip bounding box=upper bound + % + % do NOT take the clip path into account for the bounding + % box! That is very strange when you hide the axis. + % + % note that we do not need it: the path's BB will be + % extracted anyway by this BB code. + % + % However, we will use the clip path's BB as + % *upper bound* - but only after the paths in the + % current scope have been completed. + % The implementation of this upper bound is hooked + % into '\endscope': + \edef\pgfplots@clippath@install@aftergroup{% + \ifpgf@relevantforpicturesize + \noexpand\pgf@relevantforpicturesizetrue + \else + \noexpand\pgf@relevantforpicturesizefalse + \fi + \noexpand\pgfplots@clippath@install@BB@upper@bound + }% + \pgf@relevantforpicturesizefalse + % + \fi \fi + \pgf@resetpathsizes% FIXME: this here should not be necessary! + \pgfplots@clippath@install@pathcmd{##1}% + \pgfplots@clippath@install@aftergroup }% % }% -\def\pgfplots@clippath@install@test{\pgfusepath{clip}X}% FIXME : deactivated +\def\pgfplots@clippath@install@test{\pgfusepath{clip}}% + +% This is the main part of the implementation for +% 'clip bounding box=upper bound' : it collects the bounding box of everything inside of +% the clipped area. Then in the associated \endscope, it clips that bounding box to the expected +% clip path -- and protocols that size. +\def\pgfplots@clippath@install@BB@upper@bound{% + \tikzset{ + execute at end scope=\pgfplots@clippath@install@BB@update, + % + % no special handling for nested scopes: + % unnecessary; tikz handles that on its own: + %execute at begin scope=\let\pgfplots@clippath@install@BB@update=\relax, + }% + \pgfinterruptboundingbox + % count everything in the current scope into a separate bounding box +}% + +\def\pgfplots@clippath@install@BB@update{% + % we are inside of \endscope. + % + % this here is the BB of the current scope! + % More precisely: in *the* scope in which we started the clip + % path, not in nested scopes. + % + \ifdim\pgf@picminx=16000pt % + \xdef\pgfplots@glob@TMPa{}% + \else + \xdef\pgfplots@glob@TMPa{% + {\the\pgf@picminx}% + {\the\pgf@picminy}% + {\the\pgf@picmaxx}% + {\the\pgf@picmaxy}% + }% + \fi + \endpgfinterruptboundingbox + \ifx\pgfplots@glob@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@clippath@install@BB@update@\pgfplots@glob@TMPa + \fi +}% + +\def\pgfplots@clippath@install@BB@update@#1#2#3#4{% + \pgfqpoint{#1}{#2}% + \pgfplots@clip@to@clippath% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + % + \pgfqpoint{#3}{#4}% + \pgfplots@clip@to@clippath% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% +}% + +\def\pgfplots@clip@to@clippath{% + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \begingroup\pgf@process{\pgfplotspointbblowerleft}\endgroup% + \ifdim\pgf@xa<\pgf@x \pgf@xa=\pgf@x \fi + \ifdim\pgf@ya<\pgf@y \pgf@ya=\pgf@y \fi + % + \begingroup\pgf@process{\pgfplotspointbbupperright}\endgroup + \ifdim\pgf@xa>\pgf@x \pgf@xa=\pgf@x \fi + \ifdim\pgf@ya>\pgf@y \pgf@ya=\pgf@y \fi + % + \pgfqpoint{\pgf@xa}{\pgf@ya}% +}% + \def\pgfplotspointbb@assertvaluesexist{% \ifx\pgfplotspoint@bb@@@\relax @@ -7886,6 +8260,9 @@ % % Determine tight 2D bounding box for the axis as such: \begingroup + % hm. seems as if it is sufficient to set + % \pgf@relevantforpicturesizefalse. but it does not hurt; I + % will see to it eventually. Perhaps. \pgfinterruptboundingbox \pgf@relevantforpicturesizetrue \pgfplots@clippath@install{\pgfusepath{discard}} @@ -8339,12 +8716,20 @@ \ifx\pgfplots@loc@TMPa\pgfutil@empty \else \pgfplotscoordmath{#1}{log}{\pgfplots@loc@TMPa}% + \pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{% + }{% + \pgfplotswarning{illegal user argument in log axis}{#1min}{\csname pgfplots@#1min\endcsname}\pgfeov% + }% \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 \pgfplotscoordmath{#1}{log}{\pgfplots@loc@TMPa}% + \pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{% + }{% + \pgfplotswarning{illegal user argument in log axis}{#1max}{\csname pgfplots@#1max\endcsname}\pgfeov% + }% \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi % @@ -8594,7 +8979,7 @@ \fi % \ifx\pgfplots@colorbar@src@metamax\pgfplots@invalidrange@metamax - \pgfplots@warning{Sorry, the colorbar is uninitialised - your axis has no color data. Consider using 'point meta=f(x)' or something like that. I am using a color range of [0,1] for the colorbar.}% + \pgfplotswarning{colorbar uninitialised}\pgfeov \pgfmathfloatparsenumber{0}% \global\let\pgfplots@colorbar@src@metamin=\pgfmathresult \pgfmathfloatparsenumber{1}% @@ -8675,7 +9060,7 @@ \def\pgfplots@loc@TMPa{cmyk}% \ifx\pgfplots@loc@TMPa\pgfplotsretval \pgfutil@ifundefined{pgfplots@colorbar@CMYK@\pgfplots@loc@TMPb}{% - \pgfplots@warning{colorbar: The colormap '\pgfplots@loc@TMPb' has a CMYK colorspace which is not (yet) supported by PGF. I switched colorbar styles automatically to 'colorbar sampled={surf,shader=interp}' to generate a proper CMYK colorbar. Use \string\pgfplotscolorbarCMYKworkaroundfalse\space to disable this improvement. [This message won't be replicated for '\pgfplots@loc@TMPb']}% + \pgfplotswarning{colorbar CMYK unsupported}{\pgfplots@loc@TMPb}\pgfeov% \expandafter\gdef\csname pgfplots@colorbar@CMYK@\pgfplots@loc@TMPb\endcsname{1}% }{}% \pgfplotsset{colorbar sampled={surf,shader=interp}}% @@ -8966,7 +9351,7 @@ % \pgfqkeysactivatesinglefamilyandfilteroptions{/pgfplots/scale}% {/pgfplots} - {#1}% + {#1,/pgfplots/every axis post}% \let\pgfplots@remaining@input=\pgfplots@rmopts % \pgfplotssetaxistype{\pgfkeysvalueof{/pgfplots/axis type}}% @@ -9358,12 +9743,15 @@ }% \expandafter\pgfplots@assemble@ref@picture\pgfplots@loc@TMPa \toks5=\expandafter{\pgfplotsretval}% + \pgfkeysgetvalue{/pgfplots/every legend image post/.@cmd}\pgfplots@legend@image@post + \toks6=\expandafter{\pgfplots@legend@image@post\pgfeov}% % \edef\pgfplotsretval{% \noexpand\begingroup \noexpand\def\noexpand\pgfplots@draw@image{% \noexpand\def\noexpand\tikz@plot@handler{\the\toks3}% \noexpand\pgfkeysdef{/pgfplots/legend image code}{\the\toks0}% + \noexpand\pgfkeysdef{/pgfplots/every legend image post}{\the\toks6 }% \noexpand\pgfkeyssetvalue{/pgfplots/mark list fill}{\pgfkeysvalueof{/pgfplots/mark list fill}}% \ifx\pgfplots@stylekey\pgfutil@empty \else @@ -10090,6 +10478,9 @@ % once more again - just to be sure that it works with LaTeX which % introduces a further grouping level: \aftergroup\pgf@restore@layerlist@from@global + % + \pgfplots@cell@picture@remembered + \aftergroup\pgfplots@cell@picture@remembered } \def\pgfplots@beforenode{% @@ -10136,6 +10527,7 @@ \global\pgf@x=\pgf@xa \global\pgf@y=\pgf@xb \edef\pgfplots@offset{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \pgfplots@finally@correct@remembered@picture@positions % \pgfutil@for\pgfplots@child@node@name:=\pgfplots@named@child@node@list\do{% \ifx\pgfplots@child@node@name\pgfutil@empty @@ -10155,6 +10547,88 @@ \fi% }% +% The feature 'remember picture' relies on the global position of +% pgfpictures. +% +% If we have 'remember picture=true' and 'cell picture=true', that +% global position has been shifted as well. We have to correct it. +% +% This, in turn, requires to patch the .aux file. +% +% PRECONDITION: takes the offset \pgf@x,\pgf@y. +\def\pgfplots@finally@correct@remembered@picture@positions{% + % Note that the cell picture is already closed - but + % fortunately, we have saved its picture id. + \ifx\pgfplots@cell@pictureid\pgfutil@empty + % ah - no cell picture. OK; nothing to do. + \else + % ah - there WAS a cell picture ... + \pgfplots@cell@picture@remembered + \ifpgfrememberpicturepositiononpage + % ... AND it had its "remember picture" flag activated. + % + % It is task of + % \pgfplots@finally@correct@child@node@positions to + % express ALL node locations in terms of \pgfpictureid. + % + % So, we can simply replace the (already written) pdfmark + % of \pgfplots@cell@pictureid by that of \pgfpictureid + % (which, however, is NOT written because the picture is + % not finished). + % + % It will be written eventually because the outer picture + % will implicitly inherit + % \pgfrememberpicturepositiononpagetrue + % -> see all usages of \pgfplots@cell@picture@remembered + \begingroup + \edef\pgfplots@loc@TMPa{% + \noexpand\noexpand + \noexpand\pgfplotsreplacepdfmark + {\pgfplots@cell@pictureid}{\pgfpictureid}% + }% + \expandafter\write\expandafter\pgfutil@auxout\expandafter{\pgfplots@loc@TMPa}% + \endgroup + \fi + \fi +}% + +% Replaces the pdfmark for #1 by that of #2. +% +% Note that when this macro is executed (it resides in the .aux file), +% the pdfmark for #2 is typically UNDEFINED. +% +% #1: the pgfpictureid to modify +% #2: the pgfpictureid which contains the correct values +\def\pgfplotsreplacepdfmark#1#2{% + \pgfsys@getposition{#1}{\pgfplots@loc@TMPa}% + \ifx\pgfplots@loc@TMPa\relax + % hm. strange. Perhaps the driver does not support it? + \else + % Ok, make a "lazy replace": + \expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgf@sys@pdf@mark@pos@#1\endcsname + \expandafter\global\expandafter\let\csname pgf@sys@pdf@mark@pos@#1@old\endcsname=\pgfplots@loc@TMPa% + % + \expandafter\gdef\csname pgf@sys@pdf@mark@pos@#1\endcsname{% + % this is the lazy replace, assuming knowledge about how + % pgf calls its internal structures :-/ + % + % If pgf changes its name, this macro will never be + % called and we do not hurt someone. + \pgfsys@getposition{#2}{\pgfplots@loc@TMPa}% + \ifx\pgfplots@loc@TMPa\relax + % oh - the picture if for #2 has no remembered name!? + % Perhaps something failed? + % try a fall-back. This will most fail (most + % probably). Issue a warning? + \csname pgf@sys@pdf@mark@pos@#1@old\endcsname + \else + % use #2: + \pgfplots@loc@TMPa + \fi + }% + \fi +}% + \def\pgfplots@environment@axis{% \pgfutil@ifnextchar[{\pgfplots@@environment@axis}{\pgfplots@@environment@axis[]}% } @@ -10191,7 +10665,7 @@ \pgfutil@IfUndefined{tikzaddtikzonlycommandshortcutlet}{% \def\tikzaddtikzonlycommandshortcutlet#1#2{% \expandafter\def\expandafter\tikz@installcommands\expandafter{\tikz@installcommands - \let#1=#2 + \let#1=#2% }% }% }{} diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex index 442887292cb..e7d7f3ec550 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex @@ -5,9 +5,11 @@ \catcode`\:=12 \catcode`\+=12 \catcode`\-=12 -\gdef\pgfplotsrevision{1.7-2-ge24fff4} -\gdef\pgfplotsversion{1.7} -\gdef\pgfplotsversiondatetime{2012-10-26 12:43:51 +0200} +\gdef\pgfplotsrevision{1.8-3-gaf58a29} +\gdef\pgfplotsversion{1.8} +\gdef\pgfplotsversiondatetime{2013-03-17 18:23:16 +0100} +\gdef\pgfplotsrevisiondatetime{2013-03-23 10:05:25 +0100} \gdef\pgfplots@glob@TMPa#1-#2-#3 #4\relax{#1/#2/#3} \xdef\pgfplotsversiondate{\expandafter\pgfplots@glob@TMPa\pgfplotsversiondatetime\relax} +\xdef\pgfplotsrevisiondate{\expandafter\pgfplots@glob@TMPa\pgfplotsrevisiondatetime\relax} \endgroup diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex index 2560d084fef..32c2cdacd0c 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex @@ -1571,7 +1571,7 @@ \def\pgfplots@scale@uniformly@fallback{% \ifpgfplots@scaleuniformly@warning - \pgfplots@warning{Sorry, 'scale uniformly' failed because its actual implementation works only if y_x = 0 and x_y = 0 (for 2d axes) or if z_x = 0 (for 3d axes). The result will not fill the prescribed dimensions. Falling back to 'scale uniformly strategy=units only. (use scale uniformly warning=false to disable this warning)}% + \pgfplotswarning{scale uniformly unsupported}\pgfeov% \fi \pgfplots@scaleuniformly@onlyunits }% @@ -2317,9 +2317,7 @@ } \def\pgfplots@compat@scale@mode@compatible@mode@warning{% - \pgfplots@warning{The content of your 3d axis has CHANGED compared to previous versions of pgfplots. Please review it. ^^J % - [continued] Explanation: you have a 3d axis with 'axis equal' and/or 'unit vector ratio' which has (probably) been optimized for an older version of pgfplots. Any version older than 1.6 produced wrong output.^^J % - [continued] To remove this warning, write \string\pgfplotsset{compat=1.6} (or newer) in your preamble (may change all figures in your document) or by adding that to the affected axis.}% + \pgfplotswarning{axis equal incompatible change}\pgfeov% }% \def\pgfplots@set@default@size@options@threedim{% @@ -2698,7 +2696,7 @@ \else \def\pgfplots@optimum@sofar@axis{z}% \fi - \pgfplots@warning{The algorithm to implement 'unit vector ratio' failed! It could not determine the axis which shall be scaled and decided to use 'unit vector ratio axis=\pgfplots@optimum@sofar@axis'.}% + \pgfplotswarning{unit vector ratio axis undetermined}{\pgfplots@optimum@sofar@axis}\pgfeov% \fi \let\pgfplots@apply@unit@ratio@reference=\pgfplots@optimum@sofar@axis \pgfmath@smuggleone\pgfplots@apply@unit@ratio@reference diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex index a6fa1eae255..81a81d41c66 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex @@ -112,6 +112,9 @@ \tikzdeclarecoordinatesystem{xticklabel}{\pgfplotspointticklabelcs{x}{##1}}% \tikzdeclarecoordinatesystem{yticklabel}{\pgfplotspointticklabelcs{y}{##1}}% \tikzdeclarecoordinatesystem{zticklabel}{\pgfplotspointticklabelcs{z}{##1}}% + \tikzdeclarecoordinatesystem{xticklabel*}{\pgfplotspointticklabelnoshiftcs{x}{##1}}% + \tikzdeclarecoordinatesystem{yticklabel*}{\pgfplotspointticklabelnoshiftcs{y}{##1}}% + \tikzdeclarecoordinatesystem{zticklabel*}{\pgfplotspointticklabelnoshiftcs{z}{##1}}% % % does also declare the 'near xticklabel*' variants. \pgfplotsdeclareborderanchorforticklabelaxis{x}{near xticklabel}% @@ -355,6 +358,23 @@ \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\relax }% +\def\pgfplotspointticklabelnoshiftcs#1#2{% + \pgfutil@in@{,}{#2}% + \ifpgfutil@in@ + \edef\pgfplots@loc@TMPa{#2}% + \else + \edef\pgfplots@loc@TMPa{#2,0}% + \fi + \def\pgfplots@loc@TMPb##1,##2\relax{% + % invoke + % \pgfplotsqpointoutsideofticklabelaxisrel{#2}{##1}{##2}: + \pgfmathparse{##2}% + \def\pgfplots@loc@TMPa{\pgfplotsqpointoutsideofticklabelaxisrel{#1}{##1}}% + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfmathresult}% + }% + \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\relax +}% + % Converts a dimen (with unit!) to a corresponding x, y or z % coordinate. @@ -944,8 +964,9 @@ % relations hold. % Input char oriented surface char % 'v' : is either a or b or v -% '0' : is either 0, a, b, v or 2 (i.e. NOT 1) +% '0' : is either 0, a, b, v or 2 (i.e. NOT 1) FIXME : is the '2' correct here!? % '1' : is either 1, a, b, v or 2 (i.e. NOT 0) +% '2' : is either 2, a, b, v (i.e. NOT 0 or 1) % That's all. % % If the 'oriented surface char' is 'v', then we actually don't have @@ -954,6 +975,9 @@ % designated orientations. % % @POST \pgfplots@loc@TMPa contains the return value macro. +% More precisely, \pgfplots@loc@TMPa will be EMPTY is #1#2#3 is NOT +% on #4#5#6 . It will contain the value on the surface if it IS on +% the surface \def\pgfplotspointonorientedsurfaceabmatchaxisline@#1#2#3:#4#5#6\pgfplots@EOI{% % Search for the 'b' character: \if#4b% @@ -974,6 +998,7 @@ \pgfplotspointonorientedsurfaceabmatchaxisline@single{#1}{#4}% \pgfplotspointonorientedsurfaceabmatchaxisline@single{#2}{#5}% \pgfplotspointonorientedsurfaceabmatchaxisline@single{#3}{#6}% +%\message{\string\pgfplotspointonorientedsurfaceabmatchaxisline@#1#2#3:#4#5#6 = '\pgfplots@loc@TMPa'.^^J}% } \def\pgfplotspointonorientedsurfaceabmatchaxisline@single#1#2{% \if#1v% @@ -998,10 +1023,19 @@ \let\pgfplots@loc@TMPa=\pgfutil@empty \fi \else - % return TRUE. - % I admit I am not sure at all if this works in all - % cases - \pgfplotspointonorientedsurfaceabmatchaxisline@warn{#1}% + \if2#1% + \if0#2% + \let\pgfplots@loc@TMPa=\pgfutil@empty + \fi + \if1#2% + \let\pgfplots@loc@TMPa=\pgfutil@empty + \fi + \else + % return TRUE. + % I admit I am not sure at all if this works in all + % cases + \pgfplotspointonorientedsurfaceabmatchaxisline@warn{#1}% + \fi \fi \fi \fi @@ -1176,8 +1210,6 @@ % Overwrite in subclasses if necessary. \def\pgfplotspointouternormalvectorofaxis@ifdependson@v#1#2#3{#3} -% FIXME : this doesn't work if one of the three characters is '2' (for -% center) \def\pgfplotspointouternormalvectorofaxis@#1#2#3\relax{% \if v#1% \def\pgfplots@loc@point@orthogonal@to@v##1##2{% @@ -1185,6 +1217,7 @@ }% \def\pgfplots@loc@char@for@baxis{#2}% \def\pgfplots@loc@char@for@naxis{#3}% + \def\pgfplots@loc@vaxis{x}% \def\pgfplots@loc@baxis{y}% \def\pgfplots@loc@naxis{z}% \else @@ -1194,6 +1227,7 @@ }% \def\pgfplots@loc@char@for@baxis{#1}% \def\pgfplots@loc@char@for@naxis{#3}% + \def\pgfplots@loc@vaxis{y}% \def\pgfplots@loc@baxis{x}% \def\pgfplots@loc@naxis{z}% \else @@ -1202,52 +1236,26 @@ }% \def\pgfplots@loc@char@for@baxis{#1}% \def\pgfplots@loc@char@for@naxis{#2}% + \def\pgfplots@loc@vaxis{z}% \def\pgfplots@loc@baxis{x}% \def\pgfplots@loc@naxis{y}% \fi \fi - \ifcase\pgfplots@loc@char@for@baxis\relax% - % case 0: - % this means : the '##1' direction of the surface - % orthogonal to the 'v' vector is on the lower axis - % limit. Since I need a vector pointing to the OUTSIDE of - % the axis, I need sign = -1 - \def\pgfplots@loc@baxissign{-}% - \or - % case 1: - % in this case, the OUTSIDE area requires a plus sign - the b - % axis already points to the inside. - \def\pgfplots@loc@baxissign{+}% - \or - % case 2: we have the 'axis lines=centered' case. - % FIXME : - \def\pgfplots@loc@baxissign{+}% - \fi + % + \pgfplotspointouternormalvectorofaxis@get@otheraxis@sign{\pgfplots@loc@vaxis}{\pgfplots@loc@baxis}{\pgfplots@loc@char@for@baxis}% + \let\pgfplots@loc@baxissign=\pgfplotsretval + % + \pgfplotspointouternormalvectorofaxis@get@otheraxis@sign{\pgfplots@loc@vaxis}{\pgfplots@loc@naxis}{\pgfplots@loc@char@for@naxis}% + \let\pgfplots@loc@naxissign=\pgfplotsretval + % + % + % ok, compute vector scales: \pgfplotsmath@ifzero{\csname pgfplots@\pgfplots@loc@baxis @veclength\endcsname}{% \def\pgfplots@loc@baxissign{0}% \def\pgfplots@loc@baxisscale{0}% }{% \edef\pgfplots@loc@baxisscale{\pgfplots@loc@baxissign\csname pgfplots@\pgfplots@loc@baxis @inverseveclength\endcsname}% }% - % - % Now the same game for the other axis: - \ifcase\pgfplots@loc@char@for@naxis\relax - % case 0: - % this means : the '##2' direction of the surface - % orthogonal to the 'v' vector is on the lower axis - % limit. Since I need a vector pointing to the OUTSIDE of - % the axis, I need sign = -1 - \def\pgfplots@loc@naxissign{-}% - \or - % case 1: - % in this case, the OUTSIDE area requires a plus sign - the n - % axis already points to the inside. - \def\pgfplots@loc@naxissign{+}% - \or - % case 2: centered. - % FIXME - \def\pgfplots@loc@naxissign{+}% - \fi \pgfplotsmath@ifzero{\csname pgfplots@\pgfplots@loc@naxis @veclength\endcsname}{% \def\pgfplots@loc@naxissign{0}% \def\pgfplots@loc@naxisscale{0}% @@ -1263,6 +1271,58 @@ \endgroup }% +% #1: the axis for which we want the "outer normal". +% #2: the "other axis" for which we seek the sign. +% #3: the entry in the three-char-identifier which corresponds to +% "other axis". +\def\pgfplotspointouternormalvectorofaxis@get@otheraxis@sign#1#2#3{% + \ifcase#3\relax% + % case 0: + % this means : the '##1' direction of the surface + % orthogonal to the 'v' vector is on the lower axis + % limit. Since I need a vector pointing to the OUTSIDE of + % the axis, I need sign = -1 + \def\pgfplotsretval{-}% + \or + % case 1: + % in this case, the OUTSIDE area requires a plus sign - the b + % axis already points to the inside. + \def\pgfplotsretval{+}% + \or + % case 2: we have the 'axis lines=centered' case. + % + % This case is complicated. The problem is that we do not know + % if we are at the top or bottom limit. + % + % BUT: we know what we would have done if this would be a + % normal boxed axis! + % + % The idea is to return the same normal vector as if this would be a boxed axis. + % To this end, we have to access the "ticklabel axis spec" + % which would have been used in this case. + % + % We computed it at startup. Might be a hack ... :-( + \edef\pgfplots@loc@TMPb{\csname pgfplots@#1ticklabelaxisspec@box\endcsname}% + % + % decode it: we have to replace '#3' by the value that it has + % in that boxed ticklabel axis spec! + \def\pgfplots@loc@TMPa##1##2##3{% + % search for the correct entry. + \if x#2\def\pgfplotsretval{##1}\fi + \if y#2\def\pgfplotsretval{##2}\fi + \if z#2\def\pgfplotsretval{##3}\fi + }% + \expandafter\pgfplots@loc@TMPa\pgfplots@loc@TMPb + % + \if 2\pgfplotsretval + \pgfplots@error{internal assertion failed.}% + \fi + % + % invoke it again! + \pgfplotspointouternormalvectorofaxis@get@otheraxis@sign{#1}{#2}{\pgfplotsretval}% + \fi +} + % very-low-level internal routine. Never invoke it directly. % @PRECONDITION: % an \begingroup has been opened. @@ -1498,7 +1558,8 @@ \def\pgfplotsdeclareborderanchorforaxis#1#2#3{% % % - \pgfdeclaregenericanchor{#3}{\pgfplots@borderanchor@for@axis{#1}{#2}{##1}} + \pgfdeclaregenericanchor{#3}{\pgfplots@borderanchor@for@axis{#1}{#2}{##1}}% + \pgfdeclaregenericanchor{#3 opposite}{\pgfplots@borderanchor@for@axis@{#1}{#2}{##1}{+1}}% % % This variant will ALWAYS be placed on the boundary of the node. % It is deprecated, I am keeping it for some time.... @@ -1548,6 +1609,14 @@ % #3: the shape, provided as argument by the pgf routine invoking the % anchor. \def\pgfplots@borderanchor@for@axis#1#2#3{% + \pgfplots@borderanchor@for@axis@{#1}{#2}{#3}{-1}% +} +% same as \pgfplots@borderanchor@for@axis{#1}{#2}{3} except that #4 is +% the SIGN for the outer normal. +% +% #4: the sign for the outer normal. #4=-1 means "use inner normal" +% and +1 means "use outer normal" +\def\pgfplots@borderanchor@for@axis@#1#2#3#4{% \begingroup \pgfutil@ifundefined{pgfreferencednodename}{% % use given transformation matrix. @@ -1561,8 +1630,8 @@ }% % I only need to apply the trafo matrix to direction vectors. Eliminate % shifts. - \pgf@pt@x=0pt - \pgf@pt@y=0pt + \pgf@pt@x=0pt % + \pgf@pt@y=0pt % % % I'll apply the inverse transformation matrix to direction % vectors. To ensure the relative position of these vectors @@ -1571,68 +1640,20 @@ % % % This here is the normal direction (points to the axis) - \pgfqpointscale{-1}{\pgfplotspointouternormalvectorofaxis{#2}}% + \pgfqpointscale{#4}{\pgfplotspointouternormalvectorofaxis{#2}}% % % we apply the inverse CM onto it here: \pgf@pos@transform\pgf@x\pgf@y \edef\pgfplots@tmp@normaldir{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% % - % Now: - % auto-determine the canonical (north, north east etc) anchor - % at which the node touches the axis (remember: the axis is to - % be found in direction of the normal vector). If we choose - % this anchor, we *won't* penetrate the axis! - % - % This is a heuristicial procedure. - % - \def\pgfplots@thresh{0.17pt }% 80 degrees - %\def\pgfplots@thresh{0.3pt }% - %\def\pgfplots@thresh{0.707pt }% 45 degrees - \ifdim\pgf@y>0pt - \ifdim\pgf@y>\pgfplots@thresh - % only north anchor - \def\pgfplots@ycomp{north}% - \else - \def\pgfplots@ycomp{}% - \fi - \else - \ifdim\pgf@y<-\pgfplots@thresh - \def\pgfplots@ycomp{south}% - % south anchor - \else - \def\pgfplots@ycomp{}% - \fi - \fi - \ifdim\pgf@x>0pt - \ifdim\pgf@x>\pgfplots@thresh - \def\pgfplots@xcomp{east}% - \else - \def\pgfplots@xcomp{}% - \fi - \else - \ifdim\pgf@x<-\pgfplots@thresh - \def\pgfplots@xcomp{west}% - \else - \def\pgfplots@xcomp{}% - \fi - \fi - \edef\pgfplots@anchor{% - \pgfplots@ycomp - \ifx\pgfplots@ycomp\pgfutil@empty - \else - \ifx\pgfplots@xcomp\pgfutil@empty - \else - \space - \fi - \fi - \pgfplots@xcomp}% - % + \pgfplots@borderanchor@snap@to@nearest@anchor{}% takes \pgf@x and \pgf@y + \let\pgfplots@anchor=\pgfplotsretval % % Now, I'd like the 'center' of the node on one line with the % 'at={}' coordinate at which it shall be placed! % This can be done as follows: % - % Now, compute two lines: + % Compute two lines: % 1. a line parallel to the #1 axis which goes % through our recently identified anchor, % { x = x_a + r_1 * (#1 axis direction) @@ -1642,21 +1663,60 @@ % Calculate the intersection point and return it! This % involves a lot of arithmetics :-( % + % UPDATE: I realized that using the 'center' anchor might be too + % restrictive. See the 'near ticklabel align' key. + % + % Note that this is actually too much work for the 2d case - I + % guess it would be more efficient without it. But for 3d, it + % really rocks. + % % compute (unit#1 - normal): \pgfplots@tmp@normaldir \pgf@xb=\pgf@x \pgf@yb=\pgf@y % % and the axis direction (in fact, I use -axis dir. But that - % doesn't matter). + % doesn't matter for the intersection of two lines). % Scale unit vector to length 1 to improve conditioning: \pgfqpointscale {\csname pgfplotsunit#1invlength\endcsname} {\csname pgfplotspointunit#1\endcsname}% - \pgf@xa=\pgf@x + % FIXME : shouldn't the values be copied AFTER the CM!? + \pgf@xa=\pgf@x \pgf@ya=\pgf@y \pgf@pos@transform\pgf@xa\pgf@ya % + \ifcase\pgfplots@borderanchor@align\relax + % near ticklabel align=inside: + % make sure that we are close to the beginning of the axis + % direction vector. + \pgfplots@borderanchor@snap@to@nearest@anchor{% + \if\pgfkeysvalueof{/pgfplots/#1 dir/value}n% + % simply take \pgf@x and \pgf@y as-is. + \else + \global\pgf@x=-\pgf@x + \global\pgf@y=-\pgf@y + \fi + }% + \or + % near ticklabel align=center: + \def\pgfplotsretval{center}% Ah. simple. + \or + % near ticklabel align=outside: + % make sure that we are far away from the beginning of the + % axis direction vector. + \pgfplots@borderanchor@snap@to@nearest@anchor{% + \if\pgfkeysvalueof{/pgfplots/#1 dir/value}n% + \global\pgf@x=-\pgf@x + \global\pgf@y=-\pgf@y + \else + % simply take \pgf@x and \pgf@y as-is. + \fi + }% + \fi + \let\pgfplots@anchor@inner=\pgfplotsretval + % + % % verify that |n^T d | \pgf@xc=\pgf@sys@tonumber\pgf@xa\pgf@xb \advance\pgf@xc by\pgf@sys@tonumber\pgf@ya\pgf@yb @@ -1672,7 +1732,9 @@ {\pgf@sys@tonumber\pgf@yb}{\pgf@sys@tonumber\pgf@ya}% }% % - \pgf@sh@reanchor{#3}{center}% + % This here controls the anchor! Changing it might be more + % useful than I thought in the first place... + \pgf@sh@reanchor{#3}{\pgfplots@anchor@inner}% \edef\pgfplots@loc@center{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% % % apply inverse matrix to right-hand-side (and compute RHS): @@ -1693,7 +1755,7 @@ {\pgfplots@loc@center}% {\pgfqpointscale{\pgfplots@r}{\pgfplots@tmp@normaldir}}% \else - \message{^^JPGFPlots warning: The ticklabel anchor cannot be determined, the normal vector -(\the\pgf@xb,\the\pgf@yb) and the unit #1 vector (\the\pgf@xa,\the\pgf@ya) are almost parallel (abs(cos(angle)) = \the\pgf@xc)!^^J}% + \pgfplotswarning{ticklabel anchor undetermined}{#1}{\the\pgf@xb,\the\pgf@yb}{\the\pgf@xa,\the\pgf@ya}{\the\pgf@xc}\pgfeov % Something went awry: normal and unit#1 are almost parallel!? % just use the determined anchor. \def\pgfplots@r{0}% @@ -1704,6 +1766,72 @@ \endgroup }% +% #1: a direction vector. +% +% assigns the resulting anchor to \pgfplotsretval +\def\pgfplots@borderanchor@snap@to@nearest@anchor#1{% + \begingroup + #1% + % Now: + % auto-determine the canonical (north, north east etc) anchor + % at which the node touches the axis (remember: the axis is to + % be found in direction of the normal vector). + % + % This is kind of a snap-to-nearest-existing-anchor feature. But + % it tends to move the node too far away. It is used as starting + % point; we will refine it in the next step. + % + % This is a heuristicial procedure. + % + % Note that it does not hurt if there are "multiple best matches" + % (for example because they lie on the same line). + % The code below will move the final anchor point. + % + \def\pgfplots@thresh{0.17pt }% 80 degrees + %\def\pgfplots@thresh{0.3pt }% + %\def\pgfplots@thresh{0.707pt }% 45 degrees + \ifdim\pgf@y>0pt + \ifdim\pgf@y>\pgfplots@thresh + % only north anchor + \def\pgfplots@ycomp{north}% + \else + \def\pgfplots@ycomp{}% + \fi + \else + \ifdim\pgf@y<-\pgfplots@thresh + \def\pgfplots@ycomp{south}% + % south anchor + \else + \def\pgfplots@ycomp{}% + \fi + \fi + \ifdim\pgf@x>0pt + \ifdim\pgf@x>\pgfplots@thresh + \def\pgfplots@xcomp{east}% + \else + \def\pgfplots@xcomp{}% + \fi + \else + \ifdim\pgf@x<-\pgfplots@thresh + \def\pgfplots@xcomp{west}% + \else + \def\pgfplots@xcomp{}% + \fi + \fi + \edef\pgfplotsretval{% + \pgfplots@ycomp + \ifx\pgfplots@ycomp\pgfutil@empty + \else + \ifx\pgfplots@xcomp\pgfutil@empty + \else + \space + \fi + \fi + \pgfplots@xcomp + }% + \pgfmath@smuggleone\pgfplotsretval + \endgroup +} \def\pgfplotspointviewdir{% %\pgfplotsmathvectordatascaletrafoinverse{\pgfplots@view@dir@threedim}{default}% @@ -1773,6 +1901,7 @@ parsenumber=\pgfmathfloatparsenumber{##1}\pgfmathfloattofixed{##1},% zero= \pgfplotscoordmath{\pgfplotscoordmathid}{parsenumber}{0}, one= \pgfplotscoordmath{\pgfplotscoordmathid}{parsenumber}{1}, + -one= \pgfplotscoordmath{\pgfplotscoordmathid}{parsenumber}{-1}, log e= \pgfmathlog@{##1},% log to display log=\pgfmath@basic@multiply@{##1}{2.3025851},% * log(10) log from display log=\pgfmath@basic@multiply@{##1}{0.434294},% / log(10) @@ -1822,7 +1951,7 @@ if is bounded=\edef\pgfplotsretval{##1}\ifx\pgfplotsretval\pgfutil@empty ##3\else ##2\fi, suffix= #1,% datascaletrafo set params=, - datascaletrafo get params= \def\pgfmathresult{{0}{0}}, + datascaletrafo get params= \def\pgfmathresult{{0}{0}}\def\pgfplotsretval{0}\def\pgfplotsretvalb{0}, datascaletrafo= \edef\pgfmathresult{##1}, datascaletrafo inverse= \edef\pgfmathresult{##1}, datascaletrafo noshift inverse= \edef\pgfmathresult{##1}, @@ -1885,6 +2014,8 @@ {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ zero\endcsname{#1}},% one/.code= {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ one\endcsname{#1}},% + -one/.code= + {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ -one\endcsname{#1}},% % % Calls pgfmathparse. Note that this might need to switch to the % required math library (which is not necessarily cheap) @@ -1993,8 +2124,10 @@ % {#1}{#2} required for 'datascaletrafo set params': % #1: the EXPONENT (as integer) % #2: the SHIFT (as fixed point number) - datascaletrafo get params/.code= - {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo get params\endcsname{#1}},% + % AND \pgfplotsretval as the EXPONENT and \pgfplotsretvalb as the SHIFT + datascaletrafo get params/.code={% + \expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo get params\endcsname{#1}% + },% datascaletrafo/.code= {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo\endcsname##1{#1}},% datascaletrafo inverse/.code= @@ -2185,6 +2318,7 @@ suffix=@basic@, zero=\def\pgfmathresult{0}, one=\def\pgfmathresult{1}, + -one=\def\pgfmathresult{-1}, } \pgfplotsdeclarecoordmath{float}{% initialise= @@ -2196,6 +2330,7 @@ parse=\begingroup \pgfkeys{/pgf/fpu}\pgfmathparse{#1}\pgfmath@smuggleone\pgfmathresult\endgroup, zero=\pgfmathfloatcreate{0}{0.0}{0},% one=\pgfmathfloatcreate{1}{1.0}{0},% + -one=\pgfmathfloatcreate{2}{1.0}{0},% tofixed=\pgfmathfloattofixed{#1}, tostring=\pgfmathfloattosci{#1}, max=\pgfplotsmathfloatmax{#1}{#2},% @@ -2218,9 +2353,11 @@ \expandafter\edef\csname pgfplots@data@scale@trafo@SHIFT@\pgfplotscoordmathid\endcsname{#1}% },% datascaletrafo get params={% + \edef\pgfplotsretval{\csname pgfplots@data@scale@trafo@EXPONENT@\pgfplotscoordmathid\endcsname}% + \edef\pgfplotsretvalb{\csname pgfplots@data@scale@trafo@SHIFT@\pgfplotscoordmathid\endcsname}% \edef\pgfmathresult{% - {\csname pgfplots@data@scale@trafo@EXPONENT@\pgfplotscoordmathid\endcsname}% - {\csname pgfplots@data@scale@trafo@SHIFT@\pgfplotscoordmathid\endcsname}% + {\pgfplotsretval}% + {\pgfplotsretvalb}% }% },% datascaletrafo={% @@ -2975,7 +3112,7 @@ % % Prepare \pgfplots@current@point@meta (see the preparation % routine above): - \E\pgfplots@set@perpointmeta + \E\pgfplotsaxissurveysetpointmeta % \ifpgfplots@errorbars@enabled % This thing gets the 'current@point@...' context, @@ -3035,6 +3172,7 @@ \E\else it is unbounded (in \E\pgfplots@unbounded@dir). \E\fi + (see also unbounded coords=jump). }% \fi \else @@ -3062,7 +3200,11 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \endgroup % - \def\pgfplotsaxissurveysetpointmeta{\pgfplots@set@perpointmeta}% + \def\pgfplotsaxissurveysetpointmeta{% + \pgfplotsplothandlersurveybeforesetpointmeta + \pgfplots@set@perpointmeta + \pgfplotsplothandlersurveyaftersetpointmeta + }% % %\message{Prepared macro \string\pgfplots@update@limits@for@one@point: {\meaning\pgfplotsaxisupdatelimitsforcoordinate}}% %\message{Prepared macro \string\pgfplots@process@one@point: {\meaning\pgfplots@process@one@point}}% @@ -3087,6 +3229,7 @@ % optimized 'applistXX' structure: \pgfplotsapplistXXnewempty % + \edef\plotnumofactualtype{\numplotsofactualtype}% \csname pgfpmeta@\pgfplotspointmetainputhandler @activate\endcsname \pgfplotsplothandlersurveystart \pgfplotscoordstream@firstlast@init @@ -3249,7 +3392,7 @@ \pgfplots@stacked@endplot \fi \ifx\pgfplots@currentplot@firstcoord@x\pgfutil@empty - \pgfplots@warning{the current plot has no coordinates (or all have been filtered away)}% + \pgfplotswarning{plot without coordinates}\pgfeov% \else % Idea: use % \scope[plot specification] @@ -3294,7 +3437,7 @@ \noexpand\def\noexpand\plotnum{\the\pgfplots@numplots}% % % store \plotnumofactualtype - \noexpand\def\noexpand\plotnumofactualtype{\numplotsofactualtype}% + \noexpand\def\noexpand\plotnumofactualtype{\plotnumofactualtype}% % ... and make sure that it % remains the same type even if some plot handler uses % other plot handlers internally: @@ -3912,7 +4055,7 @@ {\pgfplots@error@coord}% }% \let\pgfplots@error@coord=\pgfmathresult - \pgfplotscoordmath{#1}{multiply}{% + \pgfplotscoordmath{#1}{op}{multiply}{% {\csname pgfplots@current@point@#1\endcsname} {\pgfplots@error@coord}% }% @@ -4129,7 +4272,7 @@ \ifx\pgfplots@perpointmeta@unboundedwarning@stop\relax \begingroup \pgfplotscoordmath{meta}{tostring}{##1}% - \pgfplots@warning{The per point meta data `\pgfmathresult' (##1) (and probably others as well) is unbounded - using the minimum value instead.}% + \pgfplotswarning{point meta unbounded}{\pgfmathresult}{##1}\pgfeov \endgroup \gdef\pgfplots@perpointmeta@unboundedwarning@stop{1}% \fi @@ -4263,17 +4406,19 @@ % % @see also \pgfplotsaxisifhaspointmeta \def\pgfplotsaxisvisphasetransformpointmeta{% - \ifx\pgfplots@current@point@meta\pgfutil@empty% - \pgfplots@error{could not access the 'point meta' (used for example by scatter plots and color maps). Maybe you need to add '\string\addplot[point meta=y]' or something like that?}% - \pgfplotscoordmath{meta}{one}% - \let\pgfplotspointmeta=\pgfmathresult - \def\pgfplotspointmetatransformed{1.0}% + \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname + % symbolic point meta may be empty. + \let\pgfplotspointmeta=\pgfplots@current@point@meta + \let\pgfplotspointmetatransformed=\pgfplotspointmeta \else - % prepare arguments: - \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname - \let\pgfplotspointmeta=\pgfplots@current@point@meta - \let\pgfplotspointmetatransformed=\pgfplotspointmeta + % numeric point meta may NOT be empty. + \ifx\pgfplots@current@point@meta\pgfutil@empty% + \pgfplots@error{could not access the 'point meta' (used for example by scatter plots and color maps). Maybe you need to add '\string\addplot[point meta=y]' or something like that?}% + \pgfplotscoordmath{meta}{one}% + \let\pgfplotspointmeta=\pgfmathresult + \def\pgfplotspointmetatransformed{1.0}% \else + % prepare arguments: \let\pgfplotspointmeta=\pgfplots@current@point@meta \pgfplots@perpointmeta@trafo{\pgfplotspointmeta}% \let\pgfplotspointmetatransformed=\pgfmathresult @@ -4629,14 +4774,20 @@ \pgfplots@validate@plot@domain@arguments } -\long\def\pgfplotsplothandlersurveyaddoptions#1{% - \pgfplotsset{/pgfplots/execute at end survey/.add={}{% +\long\def\pgfplotssurveyphaseaddoptionsbeforesurveybegins#1{% + \pgfplotsset{% + /pgfplots/execute at end survey/.add={}{% \t@pgfplots@tokc=\expandafter{\pgfplots@addplot@survey@@optionlist,#1}% this allows '#' inside of '#1' \edef\pgfplots@addplot@survey@@optionlist{\the\t@pgfplots@tokc}% },% #1% }% }% +\long\def\pgfplotsplothandlersurveyaddoptions#1{% + \t@pgfplots@tokc=\expandafter{\pgfplots@addplot@survey@@optionlist,#1}% this allows '#' inside of '#1' + \edef\pgfplots@addplot@survey@@optionlist{\the\t@pgfplots@tokc}% + \pgfplotsset{#1}% +}% % The main interface to draw a plot into an axis. @@ -5171,7 +5322,7 @@ % This prepares the implementation for 'patch type sampling': \def\pgfplots@plot@expression@prepare@patch@type@sampling{% - \pgfplotsplothandlersurveyaddoptions{ + \pgfplotssurveyphaseaddoptionsbeforesurveybegins{ mesh input=patches,% }% % @@ -5404,7 +5555,7 @@ \immediate\write18{gnuplot -V >\pgfplots@plot@filename.vrs}% \openin\r@pgfplots@reada=\pgfplots@plot@filename.vrs\relax \ifeof\r@pgfplots@reada - \pgfplots@warning{Sorry, I could not determine 'gnuplot -V' to check whether gnuplot and logscale writes results in log() or not. Please set `/pgfplots/gnuplot writes logscale=true|false' manually.}% + \pgfplotswarning{gnuplot -V impossible}\pgfeov \gdef\pgfplots@gnuplot@logscale@writes@log{1}% something doesn't work. set it somehow. \else \read\r@pgfplots@reada to\pgfplots@loc@TMPa @@ -5423,7 +5574,7 @@ }% \long\def\pgfplots@identify@gnuplot@logbehavior@checkversion@{% \pgfutil@ifnextchar\par{% - \pgfplots@warning{Sorry, I can't reliably check which version of gnuplot is available. I guess it is gnuplot < 4.4. Please set `/pgfplots/gnuplot writes logscale=true|false' manually if anything fails.}% + \pgfplotswarning{gnuplot -V format unknown}\pgfeov% \gdef\pgfplots@gnuplot@logscale@writes@log{1}% \pgfplots@identify@gnuplot@logbehavior@checkversion@@@ }{% @@ -7882,8 +8033,7 @@ % % \if1\b@pgfplots@compat@plot@graphics@threedim - \pgfplots@warning{plot3 graphics is running in backwards compatibility mode. % - Use \string\pgfplotsset{compat=1.6} or higher to benefit from upgraded scaling capabilites.}% + \pgfplotswarning{plot3 graphics compatibility mode}\pgfeov% \else \fi % @@ -8089,7 +8239,7 @@ % \ifx\pgfplots@plot@handler@graphics@pointmap@C@canvas\pgfutil@empty \ifpgfplots@threedim - \pgfplots@warning{plot graphics in 3D axis has just two inner anchors (those with '(x,y,z)=>(imgx,imgy)'). You should provide a third one such that I can check for correct scaling.}% + \pgfplotswarning{plot3 graphics too few inner anchors}\pgfeov% \fi \else \pgfplots@plot@handler@graphics@pointmap@sanitize@scaling{C}% @@ -8722,7 +8872,7 @@ % 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).}% + \pgfplotswarning{scatter classes no such class}\pgfplotspointmeta\pgfeov% \expandafter\gdef\csname pgfp@scatter@WARNING@\pgfplotspointmeta\endcsname{ALREADY CHECKED}% }{}% \def\pgfplots@loc@TMPa{}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex index 5cd2d0b50be..8f41c25cd31 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex @@ -26,15 +26,6 @@ \def\pgfplotsset#{\pgfqkeys{/pgfplots}} - -\def\pgfplots@log#1#2{\immediate\write-1{Package pgfplots info: #2}}% -\def\pgfplots@error#1{\PackageError{pgfplots}{#1}{}}% -\def\pgfplotstable@error@pkg#1{\PackageError{pgfplotstable}{#1}{}}% -\def\pgfplots@warning#1{\pgfplots@message{! Package pgfplots Warning: #1}}% -\def\pgfplots@message#1{% - \immediate\write16{#1}% -}% - % This is *identical* to \pgfutil@IfUndefined . I copied it here % because pgf up to and including version 2.10 does not contain it. \def\pgfplotsutil@IfUndefined#1{% @@ -47,6 +38,22 @@ } \pgfplotsutil@IfUndefined{pgfutil@IfUndefined}{\let\pgfutil@IfUndefined=\pgfplotsutil@IfUndefined}{} + +\def\pgfplots@log#1#2{\immediate\write-1{Package pgfplots info: #2}}% +\def\pgfplots@error#1{\PackageError{pgfplots}{#1}{}}% +\def\pgfplotstable@error@pkg#1{\PackageError{pgfplotstable}{#1}{}}% +% DO NOT USE THIS METHOD DIRECTLY: use \pgfplotswarning{<warning name>}<args>\pgfeov +\pgfplotsutil@IfUndefined{PackageWarning}{% + \def\pgfplots@warning#1{\pgfplots@message{! Package pgfplots Warning: +#1}}% +}{% + \def\pgfplots@warning#1{\PackageWarning{pgfplots}{#1}{}}% +}% + +\def\pgfplots@message#1{% + \immediate\write16{#1}% +}% + \pgfutil@IfUndefined{pgfkeys}{% \pgfplots@error{It seems your version of PGF/Tikz is older than 2.00. Unfortunately, pgfplots requires at least version 2.00 ... you may need to update your TeX-Distribution or install PGF manually, sorry}% }{\relax} @@ -62,10 +69,30 @@ % exchange the error message text: define \pgfplotsexceptionmsg % set a replacement. \def\pgfplotsthrow#1#2\pgfeov{% + \def\pgfkeyscurrentkey{/pgfplots/exception/#1}% \pgfkeysvalueof{/pgfplots/exception/#1/.@cmd}#2\pgfeov }% \let\pgfplotsthrow@orig=\pgfplotsthrow +% Generates warning `#1' with argument(s) `#2'. +% +% It works in exactly the same way as \pgfplotsthrow. +\def\pgfplotswarning#1#2\pgfeov{% + \def\pgfkeyscurrentkey{/pgfplots/warning/#1}% + \pgfkeysvalueof{/pgfplots/warning/#1/.@cmd}#2\pgfeov +}% + +\def\pgfplotsthrow@warning#1{% + \pgfplots@warning{#1}% + \immediate\write-1{ [warning \pgfkeyscurrentkey]}% +}% + +\def\pgfplots@assert@not@zero#1#2{% + \ifdim#1=0sp % + \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{#2}\pgfeov + \fi +}% + % A primitive try #1 catch #2 end block. % % It tries code #1. If any exception occurs within, it suppresses the @@ -121,6 +148,14 @@ \fi \let#1=\pgfutil@empty },% + /pgfplots/exception/invalid color component/.code 2 args={% + \ifx\pgfplotsexceptionmsg\relax + \pgfplots@error{#2}% + \else + \pgfplots@error{\pgfplotsexceptionmsg}% + \fi + \let#1=\pgfutil@empty + },% % #1: an error message /pgfplots/exception/unsupported operation/.code={% \ifx\pgfplotsexceptionmsg\relax @@ -140,6 +175,104 @@ \fi \let#1=\relax }, + % + % + % + % + % Generated if you say 'ymin=0' in a log axis. + % #1: the user argument ('ymin') + % #2: the offending value. + /pgfplots/warning/illegal user argument in log axis/.code args={#1#2}{% + \pgfplotsthrow@warning{Ignoring illegal input argument #1=#2: cannot apply log.}% + }, + /pgfplots/warning/plot without coordinates/.code={% + \pgfplotsthrow@warning{the current plot has no coordinates (or all have been filtered away)}% + }, + /pgfplots/warning/log basis required/.code 2 args={% + \pgfplotsthrow@warning{Some input argument (#2) explicitly relies on the log basis of #1 (which is e). Please verify that this is intended and set 'log basis #1=10' otherwise. This warning will be shown only once per document.}% + }, + /pgfplots/warning/no such legend to name/.code={% + \pgfplotsthrow@warning{There is no `legend to name=#1', sorry. I am skipping it}% + }, + /pgfplots/warning/no such colorbar to name/.code={% + \pgfplotsthrow@warning{There is no `colorbar to name=#1', sorry. I am skipping it}% + }, + /pgfplots/warning/no such addplot label/.code={% + \pgfplotsthrow@warning{There is no \string\addplot\space label `#1', sorry. I am skipping it}% + }, + /pgfplots/warning/enlargelimits respects figure size failed/.code={% + \pgfplotsthrow@warning{enlargelimits respects figure size=true: could not respect the prescribed width/height (\pgfplotsretval). The size and/or aspect ratio of your image will be different than expected. You can try to modify BOTH width and height.}% + }, + % #1: the axis + /pgfplots/warning/empty range cleared axis/.code={% + \pgfplotsthrow@warning{You have an axis with empty range (in direction #1). Replacing it with a default range and clearing all plots.}% + }, + /pgfplots/warning/approx empty range enlarged/.code args={#1#2#3}{% + \pgfplotsthrow@warning{Axis range for axis #1 is approximately empty; enlarging it (it is [#2:#3])}% + }, + /pgfplots/warning/lossy colormap rgb conversion/.code 2 args={% + \pgfplotsthrow@warning{I am about to convert colormap '#1' from #2\space to rgb (which might be lossy). Perhaps the choice 'colorbar sampled={surf,shader=interp}' yields better results since it supports #2.}% + }, + /pgfplots/warning/colorbar uninitialised/.code={% + \pgfplotsthrow@warning{Sorry, the colorbar is uninitialised - your axis has no color data. Consider using 'point meta=f(x)' or something like that. I am using a color range of [0,1] for the colorbar.}% + }, + /pgfplots/warning/colorbar CMYK unsupported/.code={% + \pgfplotsthrow@warning{colorbar: The colormap '#1' has a CMYK colorspace which is not (yet) supported by PGF. I switched colorbar styles automatically to 'colorbar sampled={surf,shader=interp}' to generate a proper CMYK colorbar. Use \string\pgfplotscolorbarCMYKworkaroundfalse\space to disable this improvement. [This message won't be replicated for '#1']}% + }, + /pgfplots/warning/ticklabel anchor undetermined/.code args={#1#2#3#4}{% + \pgfplotsthrow@warning{the ticklabel anchor cannot be determined, the normal vector -(#2) and the unit #1 vector (#3) are almost parallel (abs(cos(angle)) = #4)!}% + }, + /pgfplots/warning/point meta unbounded/.code 2 args={% + \pgfplotsthrow@warning{The per point meta data `#1' (#2) (and probably others as well) is unbounded - using the minimum value instead.}% + }, + /pgfplots/warning/gnuplot -V impossible/.code={% + \pgfplotsthrow@warning{Sorry, I could not determine 'gnuplot -V' to check whether gnuplot and logscale writes results in log() or not. Please set `/pgfplots/gnuplot writes logscale=true|false' manually.}% + }, + /pgfplots/warning/gnuplot -V format unknown/.code={% + \pgfplotsthrow@warning{Sorry, I can't reliably check which version of gnuplot is available. I guess it is gnuplot < 4.4. Please set `/pgfplots/gnuplot writes logscale=true|false' manually if anything fails.}% + }, + /pgfplots/warning/plot3 graphics compatibility mode/.code={% + \pgfplotsthrow@warning{plot3 graphics is running in backwards compatibility mode. % + Use \string\pgfplotsset{compat=1.6} or higher to benefit from upgraded scaling capabilites.}% + }, + /pgfplots/warning/plot3 graphics too few inner anchors/.code={% + \pgfplotsthrow@warning{plot graphics in 3D axis has just two inner anchors (those with '(x,y,z)=>(imgx,imgy)'). You should provide a third one such that I can check for correct scaling.}% + }, + /pgfplots/warning/scatter classes no such class/.code={% + \pgfplotsthrow@warning{scatter/classes: can't find class for '#1'!? Please make sure you have specified 'scatter src=explicit symbolic'. Ignoring class '#1' (this message will not come again).}% + }, + /pgfplots/warning/interior colormap inefficient/.code={% + \pgfplotsthrow@warning{the combination 'shader=interp,interior colormap name' is inefficient (it uses 'shader=faceted interp,faceted color=none') and may slow down the *display* of your document}% + }, + /pgfplots/warning/matrix delinearize uses sqrt/.code args={#1#2#3#4}{% + \pgfplotsthrow@warning{% + mesh processing did not find '[mesh/rows=<N>]' or '[mesh/cols=<N>]'. + Assuming [mesh/rows=#1,mesh/cols=#2] + as sqrt(num points) = sqrt(#3) [ = #4].}% + }, + /pgfplots/warning/matrix check/.code args={#1#2#3#4#5}{% + #1{the arguments of [mesh/rows=#2,mesh/cols=#3] assume #5\space points, but I got actually N = #4\space points! The data matrix appears to be incomplete or overcomplete!? [Use mesh/check=false to disable this message]}% + }, + /pgfplots/warning/tick computation failed/.code 2 args={% + \pgfplotsthrow@warning{Tick computation for direction #1 failed; there are always too few tick labels (try min ticks has already been advanced to #2)}% + }, + /pgfplots/warning/scale uniformly unsupported/.code={% + \pgfplotsthrow@warning{Sorry, 'scale uniformly' failed because its actual implementation works only if y_x = 0 and x_y = 0 (for 2d axes) or if z_x = 0 (for 3d axes). The result will not fill the prescribed dimensions. Falling back to 'scale uniformly strategy=units only. (use scale uniformly warning=false to disable this warning)}% + }, + /pgfplots/warning/axis equal incompatible change/.code={% + \pgfplotsthrow@warning{the content of your 3d axis has changed compared to previous versions of pgfplots. please review it. ^^J % + [continued] explanation: you have a 3d axis with 'axis equal' and/or 'unit vector ratio' which has (probably) been optimized for an older version of pgfplots. any version older than 1.6 produced wrong output.^^J % + [continued] to remove this warning, write \string\pgfplotsset{compat=1.6} (or newer) in your preamble (may change all figures in your document) or by adding that to the affected axis.}% + }, + /pgfplots/warning/unit vector ratio axis undetermined/.code={% + \pgfplotsthrow@warning{The algorithm to implement 'unit vector ratio' failed! It could not determine the axis which shall be scaled and decided to use 'unit vector ratio axis=#1'.}% + }, + /pgfplots/warning/linear system singular/.code={% + \pgfplotsthrow@warning{Linear system is singular up to machine precision! Continuing with small threshold.}% + }, + /pgfplots/warning/center lines upgrade required/.code={% + \pgfplotsthrow@warning{Please use '\string\pgfplotsset{compat=1.8}' to enable correct label placement for 3d axes (at least compat/labels=1.8).}% + }, } \let\pgfplotsexceptionmsg=\relax diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex index 9bef1959fba..e06f73da6cc 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex @@ -154,6 +154,10 @@ \pgfkeyssetvalue{/pgfplots/empty line}{none}% \fi % + \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@mesh + \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@mesh + \let\pgfplotsplothandlersurveyaftersetpointmeta=\pgfplotsplothandlersurveyaftersetpointmeta@mesh@cdatanormalize + % \pgfkeysgetvalue{/pgfplots/patch table/value}\pgfplotsplothandlermesh@patchtable \ifx\pgfplotsplothandlermesh@patchtable\pgfutil@empty \else @@ -162,6 +166,15 @@ \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@mesh@patchtable \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@mesh@patchtable \fi + \if0\pgfplotsplothandlermesh@colorinput + % mesh/color input=colormap + \else + % mesh/color input=explicit + \if0\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname + \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Sorry, color input!=colormap requires 'point meta=symbolic' or 'explicit symbolic'. Please adjust the format of your input point meta data}\pgfeov% + \fi + \fi + % \def\pgf@plotstreamstart{% % \scope % @@ -208,22 +221,26 @@ \pgfkeysgetvalue{/pgfplots/mesh/interior colormap name}\pgfplots@loc@TMPc \ifx\pgfplots@loc@TMPc\pgfutil@empty \else - \pgfplots@warning{the combination 'shader=interp,interior colormap name' is inefficient (it uses 'shader=faceted interp,faceted color=none') and may slow down the *display* of your document}% + \pgfplotswarning{interior colormap inefficient}\pgfeov% \pgfplotsset{shader=faceted interp,faceted color=none}% \fi \fi \if2\pgfplotsplothandlermesh@shader + % shader=interp + \if0\pgfplotsplothandlermesh@triangulate + % patch to triangles=false + \else + % no matrix output possible: + \def\b@pgfplotsplothandlermesh@matrixoutput{0}% + \fi \else % 'shader!=interp' \def\b@pgfplotsplothandlermesh@matrixoutput{0}% \fi \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{get pdf shading type}% - \if4\pgfplotsretval + \if5\pgfplotsretval \else - \if5\pgfplotsretval - \else - \def\b@pgfplotsplothandlermesh@matrixoutput{0}% - \fi + \def\b@pgfplotsplothandlermesh@matrixoutput{0}% \fi % % special handling: check if Type=5 shadings need to be @@ -235,6 +252,10 @@ \if2\pgfplotsplothandlermesh@shader % shader=interp % + % FIXME : I am unsure if this here is still + % necessary as of 3fc734d7ac3020600c06258b1bc80b22da53edf3 + % -> perhaps the check can be skipped entirely. + % % oh. shading type=5 is *essentially* the same as % matrix output, but matrix output is forbidden. % In that case, triangulate the matrix and shade the @@ -426,10 +447,7 @@ \fi \fi \if\pgfplotsretval1 - \pgfplots@warning{% - mesh processing did not find '[mesh/rows=<N>]' or '[mesh/cols=<N>]'. - Assuming [mesh/rows=\pgfplotsplothandlermesh@rows,mesh/cols=\pgfplotsplothandlermesh@rows] - as sqrt(num points) = sqrt(\pgfplotsplothandlermesh@numpoints) [ = \pgfmathresult].}% + \pgfplotswarning{matrix delinearize uses sqrt}{\pgfplotsplothandlermesh@rows}{\pgfplotsplothandlermesh@cols}{\pgfplotsplothandlermesh@numpoints}{\pgfmathresult}\pgfeov% \else \pgfplots@error{Sorry, 'plot mesh' needs either '[mesh/rows=<N>]' or '[mesh/cols=<N>]' set, but it did not find any of them. @@ -491,12 +509,12 @@ \def\pgfplots@loc@TMPa##1{}% \or % mesh/check=warning - \def\pgfplots@loc@TMPa##1{\pgfplots@warning{##1}}% + \def\pgfplots@loc@TMPa##1{\pgfplotsthrow@warning{##1}}% \or % mesh/check=error \def\pgfplots@loc@TMPa##1{\pgfplots@error{##1}}% \fi - \pgfplots@loc@TMPa{the arguments of [mesh/rows=\pgfplotsplothandlermesh@rows,mesh/cols=\pgfplotsplothandlermesh@cols] assume \the\c@pgfplots@scanlineindex\space points, but I got actually N = \pgfplotsplothandlermesh@numpoints\space points! The data matrix appears to be incomplete or overcomplete!? [Use mesh/check=false to disable this message]}% + \pgfplotswarning{matrix check}{\pgfplots@loc@TMPa}{\pgfplotsplothandlermesh@rows}{\pgfplotsplothandlermesh@cols}{\pgfplotsplothandlermesh@numpoints}{\the\c@pgfplots@scanlineindex}\pgfeov% \fi \fi \else @@ -547,26 +565,59 @@ \pgf@xa=0pt \pgf@ya=0pt \pgf@yb=0pt - \pgfplotscoordmath{meta}{zero}% + \if0\pgfplotsplothandlermesh@colorinput + % mesh/color input=colormap + \pgfplotscoordmath{meta}{zero}% + \else + % mesh/color input=explicit + \begingroup + \pgfplotscolorzero{\pgfplotsplothandlermesh@explicit@color@num@comps}% + \let\pgfmathresult=\pgfplotsretval + \pgfmath@smuggleone\pgfmathresult + \endgroup + \fi }% + +% #1: the patch's x coordinate +% #2: the patch's y coordinate +% #3: the patch's point meta value +% #4: depth (if required) +% #5: 3d coordinate of the vertex \def\pgfplotspatchvertexadd#1#2#3#4:#5\times#6{% - \global\pgf@x=#1 - \global\pgf@y=#2 + \global\pgf@x=#1 % + \global\pgf@y=#2 % \advance\pgf@xa by#6\pgf@x \advance\pgf@ya by#6\pgf@y \let\pgfmathresult@=\pgfmathresult - \pgfplotscoordmath{meta}{parsenumber}{#6}% - \pgfplotscoordmath{meta}{op}{multiply}{{#3}{\pgfmathresult}}% - \pgfplotscoordmath{meta}{op}{add}{{\pgfmathresult@}{\pgfmathresult}}% + \if0\pgfplotsplothandlermesh@colorinput + % mesh/color input=colormap + \pgfplotscoordmath{meta}{parsenumber}{#6}% + \pgfplotscoordmath{meta}{op}{multiply}{{#3}{\pgfmathresult}}% + \pgfplotscoordmath{meta}{op}{add}{{\pgfmathresult@}{\pgfmathresult}}% + \else + % mesh/color input=explicit + \begingroup + \pgfplotscoloraddweighted{\pgfplotsplothandlermesh@explicit@color@num@comps} + {\pgfmathresult@}{#6}{#3}% + \let\pgfmathresult=\pgfplotsretval + \pgfmath@smuggleone\pgfmathresult + \endgroup + \fi \def\pgfplotspatchvertexdepth{#4}% \ifx\pgfplotspatchvertexdepth\pgfutil@empty \else - \global\pgf@y=#4pt + \global\pgf@y=#4pt % \advance\pgf@yb by#6\pgf@y \fi }% \def\pgfplotspatchvertexfinish#1{% - \edef#1{{\the\pgf@xa}{\the\pgf@ya}{\pgfmathresult}\ifx\pgfplotspatchvertexdepth\pgfutil@empty\else\pgf@sys@tonumber\pgf@yb\fi:}% + \edef#1{% + {\the\pgf@xa}% + {\the\pgf@ya}% + {\pgfmathresult}% + \ifx\pgfplotspatchvertexdepth\pgfutil@empty\else\pgf@sys@tonumber\pgf@yb\fi% + :% + }% } % Same as \pgfplotspatchvertexadd, but it only adds the X and Y % coordinates (ignoring the rest). @@ -623,7 +674,7 @@ \expandafter\def\csname pgfpptch@#1@\endcsname{#1}% \pgfqkeys{/pgfplots/@declare patch}{% init=, - allow matrix=0, + allow matrix=\def\pgfplotsretval{0}, init pdf shading=, stream to shader={% %\message{\pgfplotspatchclassname: stream to shader: Starting ^^J}% @@ -651,11 +702,11 @@ }% \pgfpathclose }, - get num cdata vertices=\pgfplotspatchclass{\pgfplotspatchclassname}{get vertices}, - get dimension=2, - supports global path=0, + get num cdata vertices=\pgfplotspatchclass{\pgfplotspatchclassname}{get num vertices}, + get dimension=\def\pgfplotsretval{2}, + supports global path=\def\pgfplotsretval{0}, set edge visible=\expandafter\edef\csname pgfppatchedge@##1\endcsname{##2}, - uses view depth=0, + uses view depth=\def\pgfplotsretval{0}, if current point can be first last=##1, serialize except vertices=\let\pgfplotsretval\pgfutil@empty, deserialize except vertices=##1, @@ -682,7 +733,7 @@ }% }, deserialize=##1, - triangulate class=triangle, + triangulate class=\def\pgfplotsretval{triangle}, triangulate={% \pgfplots@error{triangulate: not yet implemented for \pgfplotspatchclassname}% },% @@ -725,9 +776,15 @@ init/.code= {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ init\endcsname{#1}},% allow matrix/.code= - {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ allow matrix\endcsname{\def\pgfplotsretval{#1}}},% + {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ allow matrix\endcsname{#1}},% + % + % FIXME : this is NOT properly used in higher order patches!? + % Uses view depth defines \pgfplotsretval to '1' if and only if it + % does ALWAYS needs the view depth. Note that 'z buffer=sort' will + % automatically provide the view depth. Use this key if view depth + % is necessary even for 'z buffer!=sort'. uses view depth/.code= - {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ uses view depth\endcsname{\def\pgfplotsretval{#1}}},% + {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ uses view depth\endcsname{#1}},% % % creates a new patch. The vertices need to be added by 'set next % vertex' @@ -824,7 +881,7 @@ % invokes % \pgfplotspatchvertex...\endvertex % #1 - % for the every colored vertex. + % for every colored vertex. % See 'get num cdata vertices' foreach cdata vertex/.code= {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ foreach cdata vertex\endcsname##1{#1}},% @@ -848,18 +905,18 @@ % % defines \pgfplotsretval to contain the number of vertices. get num vertices/.code= - {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ get num vertices\endcsname{\def\pgfplotsretval{#1}}},% + {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ get num vertices\endcsname{#1}},% % % defines \pgfplotsretval to contain the number of vertices which have color data % attached. This is usually the same as 'get num vertices' (but % see coons patches). get num cdata vertices/.code= - {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ get num cdata vertices\endcsname{\def\pgfplotsretval{#1}}},% + {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ get num cdata vertices\endcsname{#1}},% % % defines \pgfplotsretval to contain the dimension of this patch % (either 1 for lines or 2 for patches). get dimension/.code= - {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ get dimension\endcsname{\def\pgfplotsretval{#1}}},% + {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ get dimension\endcsname{#1}},% % % defines \pgfplotsretval to be 1 if and only if the patch class % supports global paths. @@ -870,7 +927,7 @@ % data, we always want individual path segments and \pgfusepath % them after each segment). supports global path/.code= - {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ supports global path\endcsname{\def\pgfplotsretval{#1}}},% + {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ supports global path\endcsname{#1}},% % % Approximates the given patch by at least one triangle. % For every finished triangle, \pgfplotspatchready will be invoked @@ -882,7 +939,7 @@ % Defines \pgfplotsretval to be the classname returned by % 'triangulate'. This is usually 'triangle' triangulate class/.code= - {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ triangulate class\endcsname{\def\pgfplotsretval{#1}}},% + {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ triangulate class\endcsname{#1}},% % % Refines the given patch #1 times. % For every finished patch, \pgfplotspatchready will be invoked. @@ -1039,7 +1096,7 @@ \def\pgfpptchindexnext@Q{R}% 16->17 \pgfplotsdeclarepatchclass{line}{% - allow matrix=0, + allow matrix=\def\pgfplotsretval{0}, new=\def\pgfplotspatchclass@line@no{0}, set next vertex={% \if0\pgfplotspatchclass@line@no\relax @@ -1060,8 +1117,8 @@ #1% \pgfplotspatchready },% - get dimension=1, - supports global path=1, + get dimension=\def\pgfplotsretval{1}, + supports global path=\def\pgfplotsretval{1}, first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@line@A\endvertex, foreach vertex={% \expandafter\pgfplotspatchvertex\pgfplotspatchclass@line@A\endvertex #1% @@ -1074,7 +1131,7 @@ }, serialize except vertices=\let\pgfplotsretval\pgfutil@empty,% deserialize except vertices=, - get num vertices=2, + get num vertices=\def\pgfplotsretval{2}, get pdf shading type=0, }% @@ -1110,7 +1167,7 @@ }% \pgfplotsdeclarepatchclass{triangle}{% - allow matrix=0, + allow matrix=\def\pgfplotsretval{0}, new=\def\pgfplotspatchclass@tri@no{0}\let\pgfplotspatchclass@trie@AB\relax, set next vertex={% \ifcase\pgfplotspatchclass@tri@no\relax @@ -1270,7 +1327,7 @@ \let\pgfplotspatchclass@trie@AB\relax #1, get pdf shading type=4, - get num vertices=3, + get num vertices=\def\pgfplotsretval{3}, }% \def\pgfplotspatchclass@tri@recursiverefine@@#1#2M,#3#4M;#5\relax#6{% \expandafter\let\expandafter\pgfplotspatchclass@tri@A@\csname pgfplotspatchclass@tri@#1\endcsname @@ -1296,7 +1353,7 @@ % A --> B % \pgfplotsdeclarepatchclass{rectangle}{% - allow matrix=1, + allow matrix=\def\pgfplotsretval{1}, new=\def\pgfplotspatchclass@rect@no{0}, set next vertex={% \ifcase\pgfplotspatchclass@rect@no\relax @@ -1346,10 +1403,19 @@ \global\pgf@y=\pgfplotspatchvertexy\space }{\pgfplotspointmetatransformed}% }% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex\pgfplots@foreachvertex@@% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@B\endvertex\pgfplots@foreachvertex@@% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@D\endvertex\pgfplots@foreachvertex@@% EXCHANGED SEQUENCE - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@C\endvertex\pgfplots@foreachvertex@@% + \if1\b@pgfplotsplothandlermesh@matrixoutput + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex\pgfplots@foreachvertex@@% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@B\endvertex\pgfplots@foreachvertex@@% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@D\endvertex\pgfplots@foreachvertex@@% EXCHANGED SEQUENCE + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@C\endvertex\pgfplots@foreachvertex@@% + \else + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex\pgfplots@foreachvertex@@% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@B\endvertex\pgfplots@foreachvertex@@% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@D\endvertex\pgfplots@foreachvertex@@% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@B\endvertex\pgfplots@foreachvertex@@% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@C\endvertex\pgfplots@foreachvertex@@% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@D\endvertex\pgfplots@foreachvertex@@% + \fi },% fill path={% \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@rect@A\endvertex}% @@ -1392,7 +1458,7 @@ serialize except vertices=\let\pgfplotsretval\pgfutil@empty,% deserialize except vertices=, get pdf shading type=5, - get num vertices=4, + get num vertices=\def\pgfplotsretval{4}, }% \def\pgfplots@rect@next@A{B} @@ -1577,10 +1643,14 @@ % contain the view depth. % \def\pgfplotsplothandlermesh@compute@vertex@depth@doit{% - \pgfplotsmathvectorfromstring{\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z}{default}% - \pgfplotsmathvectorviewdepth{\pgfplotsretval}% - \pgfplotscoordmath{default}{tofixed}{\pgfplotsretval}% - \edef\pgfplotsretval{\pgfmathresult}% + \ifx\pgfplots@current@point@x\pgfutil@empty + \let\pgfplotsretval\pgfutil@empty + \else + \pgfplotsmathvectorfromstring{\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z}{default}% + \pgfplotsmathvectorviewdepth{\pgfplotsretval}% + \pgfplotscoordmath{default}{tofixed}{\pgfplotsretval}% + \edef\pgfplotsretval{\pgfmathresult}% + \fi }% % A command which defines \pgfplotsretval to be either empty or to @@ -1780,9 +1850,54 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % MESH SURVEY +\def\pgfplotsplothandlersurveystart@mesh{% + \pgfplotsplothandlersurveystart@default + \if0\pgfplotsplothandlermesh@colorinput + % mesh/color input=colormap + \else + % mesh/color input=explicit + \if1\pgfplotsplothandlermesh@colorinput@mathparse + \pgfkeysdef{/pgfplots/color sequence/every input component}{% + \expandafter\pgfmathparse\expandafter{\pgfmathresult}% + \ifpgfplots@usefpu + \pgfmathfloattofixed\pgfmathresult + \fi + }% + \else + \pgfkeysdef{/pgfplots/color sequence/every input component}{}% + \fi + \pgfplotscolornormalizesequence[ + colorspace=\pgfkeysvalueof{/pgfplots/mesh/colorspace explicit color output}, + default input colorspace=\pgfkeysvalueof{/pgfplots/mesh/colorspace explicit color input}, + context message={point meta '\pgfplots@current@point@meta' of coord no \the\c@pgfplots@coordindex\space (\pgfplots@current@point@x,\pgfplots@current@point@y\ifpgfplots@curplot@threedim,\pgfplots@current@point@z\fi)}, + ]% + \fi +}% +\def\pgfplotsplothandlersurveyend@mesh{% + \pgfplotsplothandlersurveyend@default + \if0\pgfplotsplothandlermesh@colorinput + % mesh/color input=colormap + \else + % mesh/color input=explicit + \endpgfplotscolornormalizesequence + \fi +} + +\def\pgfplotsplothandlersurveyaftersetpointmeta@mesh@cdatanormalize{% + \pgfplotsplothandlersurveyaftersetpointmeta@default + \if0\pgfplotsplothandlermesh@colorinput + % mesh/color input=colormap + \else + % mesh/color input=explicit + \pgfplotscolornormalizesequencenext{\pgfplots@current@point@meta}% + \let\pgfplots@current@point@meta=\pgfplotsretval + \fi +}% + \newif\ifpgfplotsplothandlermesh@patchtable@hascdata \newif\ifpgfplotsplothandlermesh@patchtable@cdata@individual \def\pgfplotsplothandlersurveystart@mesh@patchtable{% + \pgfplotsplothandlersurveystart@mesh \pgfplotsarraynewempty\pgfplots@verts }% \def\pgfplotsplothandlersurveypoint@mesh@patchtable{% @@ -1824,6 +1939,7 @@ \fi }% \def\pgfplotsplothandlersurveyend@mesh@patchtable{% + \pgfplotsplothandlersurveyend@mesh \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@default \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@default \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@default @@ -2024,6 +2140,10 @@ \def\pgfplotsplothandlermesh@init@cdata{% % Ok, we have color data. % + \pgfkeysgetvalue{/pgfplots/mesh/colorspace explicit color output}\pgfplots@loc@TMPa + \pgfplotscolorspacegetcomponents{\pgfplots@loc@TMPa}% + \let\pgfplotsplothandlermesh@explicit@color@num@comps=\pgfplotsretval + % \pgfkeysgetvalue{/pgfplots/colormap name}\pgfplotsplothandlermesh@colormapname % \pgfkeysgetvalue{/pgfplots/mesh/interior colormap name}\pgfplotsplothandlermesh@colormapname@interior @@ -2046,7 +2166,7 @@ % Prepare: \def\pgfplotsplothandlermesh@definecolor{% \pgfplotsplothandlermesh@get@flat@color - \pgfplotscolormapdefinemappedcolor{\pgfplotsretval}% + \pgfplotsplothandlermesh@definemappedcolor{\pgfplotsretval}% \pgfplots@drawoptions }% % @@ -2054,6 +2174,24 @@ \pgfplots@drawmodes } +\def\pgfplotsplothandlermesh@definemappedcolor#1{% + \if0\pgfplotsplothandlermesh@colorinput + % mesh/color input=colormap + \pgfplotscolormapdefinemappedcolor{#1}% + \else + % mesh/color input=explicit + % + % we assume that the color *is* already normalized, + % i.e. it is {<comma-separate-components>} and to be + % interpreted in the correct color space. + \edef\pgfplots@loc@TMPb{% + \noexpand\pgfutil@definecolor{mapped color} + {\pgfkeysvalueof{/pgfplots/mesh/colorspace explicit color output}} + {#1}% + }% + \pgfplots@loc@TMPb + \fi +}% \let\pgfsetstrokecolor@orig=\pgfsetstrokecolor \def\pgfplotsplothandlermesh@VISUALIZE@std@separate@fillstroke@setstrokecolor#1{% @@ -2061,7 +2199,7 @@ }% \def\pgfplotsplothandlermesh@VISUALIZE@std@separate@fillstroke{% \pgfplotsplothandlermesh@get@flat@color - \pgfplotscolormapdefinemappedcolor{\pgfplotsretval}% + \pgfplotsplothandlermesh@definemappedcolor{\pgfplotsretval}% % \ifx\pgfplotsplothandlermesh@usepathfill\relax \else @@ -2079,8 +2217,19 @@ \fi }% +% This is one of two places where shadings are served with +% coordinates; the other one uses matrix output (which does not work +% with 'stream to shader') \def\pgfplotsplothandlermesh@VISUALIZE@interp{% \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{stream to shader}% + \ifpgf@relevantforpicturesize + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{foreach vertex}{% + \global\pgf@x=\pgfplotspatchvertexx\space + \global\pgf@y=\pgfplotspatchvertexy\space + % compute the bounding box using the vertices: + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + }% + \fi }% \def\pgfplotsplothandlermesh@VISUALIZE@faceted@interp{% @@ -2127,15 +2276,24 @@ % % This won't be used for mesh plots, neither in one % nor in two dimensions. - \pgfkeyssetvalue{/pgfplots/surf shading/north east corner}{\pgfplotspointbbupperright}% - \pgfkeyssetvalue{/pgfplots/surf shading/south west corner}{\pgfplotspointbblowerleft}% \pgfkeyssetvalue{/pgfplots/surf shading/anchor}{\pgfpointorigin}% + % + % do NOT update the picture's BB using the streamed low-level coordinates + % (which are bezier control points in most cases). + % We do that on our own using the input vertices. + \pgfkeys{/pgfplots/surf shading/update BB=false}% \if1\b@pgfplotsplothandlermesh@matrixoutput % this *implies* a compatible patch class, see the % definition of \b@pgfplotsplothandlermesh@matrixoutput \def\pgfplotsretval{5}% \else \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{get pdf shading type}% + \if5\pgfplotsretval + % we have no matrix output-> + % downgrade lattice triangular grid to individual + % triangles: + \def\pgfplotsretval{4}% + \fi \fi \pgfkeyslet{/pgfplots/surf shading/shading type}\pgfplotsretval% % @@ -2152,9 +2310,17 @@ \let\pgfplotsplothandlermesh@shader@colormap@interior=\pgfplotsretval \fi % - \pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@loc@TMPa - \pgfplotscolormapgetcolorspace\pgfplots@loc@TMPa - \pgfkeyslet{/pgfplots/surf shading/colorspace}\pgfplotsretval + \if0\pgfplotsplothandlermesh@colorinput + % mesh/color input=colormap + \pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@loc@TMPa + \pgfplotscolormapgetcolorspace\pgfplots@loc@TMPa + \pgfkeyslet{/pgfplots/surf shading/colorspace}\pgfplotsretval + \else + % mesh/color input=explicit + \pgfkeysgetvalue{/pgfplots/mesh/colorspace explicit color output}\pgfplots@loc@TMPa + \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}% + \pgfkeyslet{/pgfplots/surf shading/colorspace}\pgfplots@loc@TMPa + \fi \if2\pgfplotsplothandlermesh@shader % shader=interp \let\pgfplotsplothandlermesh@definecolor=\relax @@ -2193,7 +2359,7 @@ \pgfplotslibrarysurfstreamstart \else % shader='faceted interp' - \let\pgfplotsplothandlermesh@VISUALIZE=\pgfplotsplothandlermesh@VISUALIZE@faceted@interp% + \def\pgfplotsplothandlermesh@VISUALIZE{\pgfplotsplothandlermesh@VISUALIZE@faceted@interp}% \pgfkeyssetvalue{/pgfplots/surf shading/cols}{2}% \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{init pdf shading}% \fi @@ -2225,20 +2391,124 @@ \def\pgfplotsplothandlermesh@needs@flat@color{1}% \fi \if1\pgfplotsplothandlermesh@needs@flat@color - \if\pgfplotsplothandlermesh@flatmode c% 'flat corner': - % - % use colordata of ONE corner point. That's easy, not - % much to do. - \def\pgfplotsplothandlermesh@get@flat@color{% - \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{first vertex}% - \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta - \pgfplotsaxisvisphasetransformpointmeta - \let\pgfplotsretval=\pgfplotspointmetatransformed% - }% + \pgfplotsplothandlermesh@init@flat@color@getter + % + \pgfplotsplothandlermesh@init@flat@color@usepath + % + % + \pgfplotsplothandlermesh@init@flat@color@visualize@pipe@step + \fi +}% + +\def\pgfplotsplothandlermesh@init@flat@color@visualize@pipe@step{% + \ifx\pgfplotsplothandlermesh@PIPE@REFINE\pgfplotsplothandlermesh@PIPE@REFINE@no@op + \let\pgfplotsplothandlermesh@VISUALIZE@std=\pgfplotsplothandlermesh@VISUALIZE@std@fill@andor@stroke + \else + \ifpgfplotsplothandlermesh@hide@refined@edges + % this is (at most) partially implemented. + \let\pgfplotsplothandlermesh@VISUALIZE@std=\pgfplotsplothandlermesh@VISUALIZE@std@separate@fillstroke \else - % 'flat mean': - % - % use colordata as mean of all corners for shading. + \let\pgfplotsplothandlermesh@VISUALIZE@std=\pgfplotsplothandlermesh@VISUALIZE@std@fill@andor@stroke + \fi + % + % FIXME : that doesn't work. + % filling *always* seems to need a stroke operation, + % otherwise there will be translucent edges. + % I need to adjust the stroke color :-( + % + % FIXME : even that doesn't work correctly. The problem + % is: drawing adjacent patches on top of each other + % OVERDRAWS edges: once with the correct stroke color; + % once with the fill color. + % + \ifx\pgfplotsplothandlermesh@usepath\pgfusepathqstroke + \let\pgfplotsplothandlermesh@usepathfill=\relax + \let\pgfplotsplothandlermesh@usepathstroke=\pgfusepathqstroke + \else + \ifx\pgfplotsplothandlermesh@usepath\pgfusepathqfillstroke + \let\pgfplotsplothandlermesh@usepathfill=\pgfusepathqfillstroke + \let\pgfplotsplothandlermesh@usepathstroke=\pgfusepathqstroke + \else + \let\pgfplotsplothandlermesh@usepathfill=\relax + \let\pgfplotsplothandlermesh@usepathstroke=\relax + \fi + \fi + \fi +}% + +\def\pgfplotsplothandlermesh@init@flat@color@usepath{% + \if\pgfplots@meshmode m% + % 'mesh' plot: stroke only and use the 'flat' code + % here just to define the color for each mesh + % segment. + \let\pgfplotsplothandlermesh@usepath=\pgfusepathqstroke + \else + % 'surf' plot: + \let\pgfplotsplothandlermesh@usepath=\pgfusepathqfillstroke + \if\pgfplotsplothandlermesh@shader3% faceted interp + % it has an extra fill command (shading) + \let\pgfplotsplothandlermesh@usepath=\pgfusepathqstroke + \fi + % + % the distinction between 'faceted' and 'flat' is + % technical: it is just the default draw color. + % + % 'flat,draw=black' is the same as 'faceted'. + \pgfkeysgetvalue{/pgfplots/faceted color}\pgfplots@loc@TMPb + \def\pgfplots@loc@TMPc{none}% + \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPc + \pgfkeyslet{/pgfplots/faceted color}\pgfutil@empty + \def\pgfplots@loc@TMPb{}% + \fi + % + \def\pgfplots@loc@TMPa{0}% + \if\pgfplotsplothandlermesh@shader1% faceted + \def\pgfplots@loc@TMPa{1}% + \ifx\pgfplots@loc@TMPb\pgfutil@empty + % oh. no faceted color. Then: fill only, use + % whatever color is available. + \def\pgfplots@loc@TMPa{0}% + %\let\pgfplotsplothandlermesh@usepath=\pgfusepathqfill + \fi + \fi + \if\pgfplotsplothandlermesh@shader3% faceted interp + \def\pgfplots@loc@TMPa{1}% + \ifx\pgfplots@loc@TMPb\pgfutil@empty + % oh. no faceted color. Then: no-op! + % This is the same as interp with more overhead + % (but allows z buffering). + \def\pgfplots@loc@TMPa{0}% + \def\pgfplotsplothandlermesh@usepath{\pgfusepath{discard}}% + \fi + \fi + \if1\pgfplots@loc@TMPa + % make sure there is a the correct color. + \expandafter\def\expandafter\pgfplots@drawoptions\expandafter{% + \pgfplots@drawoptions + \pgfsetstrokecolor{\pgfkeysvalueof{/pgfplots/faceted color}}% + }% + \fi + % + \fi +} + +\def\pgfplotsplothandlermesh@init@flat@color@getter{% + \if\pgfplotsplothandlermesh@flatmode c% 'flat corner': + % + % use colordata of ONE corner point. That's easy, not + % much to do. + \def\pgfplotsplothandlermesh@get@flat@color{% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{first vertex}% + \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta + \pgfplotsaxisvisphasetransformpointmeta + \let\pgfplotsretval=\pgfplotspointmetatransformed% + }% + \else + % 'flat mean': + % + % use colordata as mean of all corners for shading. + \if0\pgfplotsplothandlermesh@colorinput + % mesh/color input=colormap \global\pgfplots@tmpa=0pt \def\pgfplotsplothandlermesh@get@flat@color{% \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{foreach cdata vertex}{% @@ -2246,105 +2516,33 @@ \pgfplotsaxisvisphasetransformpointmeta \global\advance\pgfplots@tmpa by\pgfplotspointmetatransformed pt }% - \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{get num vertices}% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{get num cdata vertices}% \global\divide\pgfplots@tmpa by\pgfplotsretval\relax \edef\pgfplotsretval{\pgf@sys@tonumber\pgfplots@tmpa}% \global\pgfplots@tmpa=0pt }% - \fi - % - % - \if\pgfplots@meshmode m% - % 'mesh' plot: stroke only and use the 'flat' code - % here just to define the color for each mesh - % segment. - \let\pgfplotsplothandlermesh@usepath=\pgfusepathqstroke \else - % 'surf' plot: - \let\pgfplotsplothandlermesh@usepath=\pgfusepathqfillstroke - \if\pgfplotsplothandlermesh@shader3% faceted interp - % it has an extra fill command (shading) - \let\pgfplotsplothandlermesh@usepath=\pgfusepathqstroke - \fi - % - % the distinction between 'faceted' and 'flat' is - % technical: it is just the default draw color. - % - % 'flat,draw=black' is the same as 'faceted'. - \pgfkeysgetvalue{/pgfplots/faceted color}\pgfplots@loc@TMPb - \def\pgfplots@loc@TMPc{none}% - \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPc - \pgfkeyslet{/pgfplots/faceted color}\pgfutil@empty - \def\pgfplots@loc@TMPb{}% - \fi + % mesh/color input=explicit + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{get num cdata vertices}% + \pgf@xa=1pt % + \divide\pgf@xa by\pgfplotsretval\relax + \edef\pgfplotsplothandlermesh@get@flat@color@@{\pgf@sys@tonumber\pgf@xa}% % - \def\pgfplots@loc@TMPa{0}% - \if\pgfplotsplothandlermesh@shader1% faceted - \def\pgfplots@loc@TMPa{1}% - \ifx\pgfplots@loc@TMPb\pgfutil@empty - % oh. no faceted color. Then: fill only, use - % whatever color is available. - \def\pgfplots@loc@TMPa{0}% - %\let\pgfplotsplothandlermesh@usepath=\pgfusepathqfill - \fi - \fi - \if\pgfplotsplothandlermesh@shader3% faceted interp - \def\pgfplots@loc@TMPa{1}% - \ifx\pgfplots@loc@TMPb\pgfutil@empty - % oh. no faceted color. Then: no-op! - % This is the same as interp with more overhead - % (but allows z buffering). - \def\pgfplots@loc@TMPa{0}% - \def\pgfplotsplothandlermesh@usepath{\pgfusepath{discard}}% - \fi - \fi - \if1\pgfplots@loc@TMPa - % make sure there is a the correct color. - \expandafter\def\expandafter\pgfplots@drawoptions\expandafter{% - \pgfplots@drawoptions - \pgfsetstrokecolor{\pgfkeysvalueof{/pgfplots/faceted color}}% + \def\pgfplotsplothandlermesh@get@flat@color{% + \pgfplotscolorzero{\pgfplotsplothandlermesh@explicit@color@num@comps}% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{foreach cdata vertex}{% + % no-op here: \pgfplotsaxisvisphasetransformpointmeta + \pgfplotscoloraddweighted + {\pgfplotsplothandlermesh@explicit@color@num@comps}% + {\pgfplotsretval} + {\pgfplotsplothandlermesh@get@flat@color@@}% + {\pgfplotspatchvertexmeta}% }% - \fi - % - \fi - % - \ifx\pgfplotsplothandlermesh@PIPE@REFINE\pgfplotsplothandlermesh@PIPE@REFINE@no@op - \let\pgfplotsplothandlermesh@VISUALIZE@std=\pgfplotsplothandlermesh@VISUALIZE@std@fill@andor@stroke - \else - \ifpgfplotsplothandlermesh@hide@refined@edges - % this is (at most) partially implemented. - \let\pgfplotsplothandlermesh@VISUALIZE@std=\pgfplotsplothandlermesh@VISUALIZE@std@separate@fillstroke - \else - \let\pgfplotsplothandlermesh@VISUALIZE@std=\pgfplotsplothandlermesh@VISUALIZE@std@fill@andor@stroke - \fi - % - % FIXME : that doesn't work. - % filling *always* seems to need a stroke operation, - % otherwise there will be translucent edges. - % I need to adjust the stroke color :-( - % - % FIXME : even that doesn't work correctly. The problem - % is: drawing adjacent patches on top of each other - % OVERDRAWS edges: once with the correct stroke color; - % once with the fill color. - % - \ifx\pgfplotsplothandlermesh@usepath\pgfusepathqstroke - \let\pgfplotsplothandlermesh@usepathfill=\relax - \let\pgfplotsplothandlermesh@usepathstroke=\pgfusepathqstroke - \else - \ifx\pgfplotsplothandlermesh@usepath\pgfusepathqfillstroke - \let\pgfplotsplothandlermesh@usepathfill=\pgfusepathqfillstroke - \let\pgfplotsplothandlermesh@usepathstroke=\pgfusepathqstroke - \else - \let\pgfplotsplothandlermesh@usepathfill=\relax - \let\pgfplotsplothandlermesh@usepathstroke=\relax - \fi - \fi + }% \fi \fi }% - \def\pgfplotsplothandlermesh@init@jumphandling{% % For matrix input, a "jump" should result in something % visible although it must not destroy the matrix structure. @@ -2428,9 +2626,17 @@ } \def\pgfplotsplothandlermesh@set@shader@colormap{% - \pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@loc@TMPa - \expandafter\pgfplotscolormaptopdffunction\expandafter{\pgfplots@loc@TMPa}% - \pgfkeyslet{/pgfplots/surf shading/colormap}\pgfplotsretval + \if0\pgfplotsplothandlermesh@colorinput + % mesh/color input=colormap + \pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@loc@TMPa + \expandafter\pgfplotscolormaptopdffunction\expandafter{\pgfplots@loc@TMPa}% + \pgfkeyslet{/pgfplots/surf shading/colormap}\pgfplotsretval + \else + % mesh/color input=explicit + % + % tell it to expect explicit colors: + \pgfkeyslet{/pgfplots/surf shading/colormap}\pgfutil@empty + \fi }% { @@ -2531,8 +2737,15 @@ }% +% This is one of two places where the shader is served with +% coordinates: it handles the special matrix-form shading which is +% incompatible with the patch-wise sequence of coordinates \def\pgfplotsplothandlermesh@PIPE@DECODE@to@shader#1{% \pgfplotsaxisvisphasetransformpointmeta + \ifpgf@relevantforpicturesize + \pgf@process{#1}% + \pgf@protocolsizes{\pgf@x}{\pgf@y}% + \fi \pgfplotslibrarysurfstreamcoord {#1}% {\pgfplotspointmetatransformed}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex index 9d17a2e157d..d7352cc0970 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex @@ -429,24 +429,39 @@ \def\pgfplots@bar@width@not@in@context{pgfplotsbarwidthgeneric} \def\pgfplots@bar@shift@not@in@context{pgfplotsbarshiftgeneric} -\pgfmathdeclarefunction{pgfplotsxbarwidth}{0}{\pgfplots@bar@mathparse@{y}{bar width}}% -\pgfmathdeclarefunction{pgfplotsybarwidth}{0}{\pgfplots@bar@mathparse@{x}{bar width}}% -\pgfmathdeclarefunction{pgfplotsxbarshift}{0}{\pgfplots@bar@mathparse@{y}{bar shift}}% -\pgfmathdeclarefunction{pgfplotsybarshift}{0}{\pgfplots@bar@mathparse@{x}{bar shift}}% -\pgfmathdeclarefunction{pgfplotsbarwidthgeneric}{0}{\pgfplots@bar@mathparse@{N}{bar width}}% -\pgfmathdeclarefunction{pgfplotsbarshiftgeneric}{0}{\pgfplots@bar@mathparse@{N}{bar shift}}% +\pgfplotsmathdeclarepseudoconstant{pgfplotsxbarwidth}{\pgfplots@bar@mathparse@{y}{bar width}}% +\pgfplotsmathdeclarepseudoconstant{pgfplotsybarwidth}{\pgfplots@bar@mathparse@{x}{bar width}}% +\pgfplotsmathdeclarepseudoconstant{pgfplotsxbarshift}{\pgfplots@bar@mathparse@{y}{bar shift}}% +\pgfplotsmathdeclarepseudoconstant{pgfplotsybarshift}{\pgfplots@bar@mathparse@{x}{bar shift}}% +\pgfplotsmathdeclarepseudoconstant{pgfplotsbarwidthgeneric}{\pgfplots@bar@mathparse@{N}{bar width}}% +\pgfplotsmathdeclarepseudoconstant{pgfplotsbarshiftgeneric}{\pgfplots@bar@mathparse@{N}{bar shift}}% \def\pgfplots@bar@mathparse@#1#2{% \pgfmathparse{\pgfkeysvalueof{/pgf/#2}}% \ifpgfmathunitsdeclared \else - \if N#1% + \edef\pgfplots@bar@direction@choice@{#1}% + \if N\pgfplots@bar@direction@choice@% + \if a\pgfplots@bar@direction@choice + \else + \if x\pgfplots@bar@direction@choice + \def\pgfplots@bar@direction@choice@{y}% + \else + \if y\pgfplots@bar@direction@choice + \def\pgfplots@bar@direction@choice@{x}% + \else + \pgfplotsthrow{invalid argument}{\pgfplots@bar@direction@choice@}{Sorry, the value of 'bar direction' is invalid}\pgfeov% + \fi + \fi + \fi + \fi + \if N\pgfplots@bar@direction@choice@% \pgfplots@bar@mathparse@error{#1}{#2}% \else \let\pgfplots@loc@TMPa=\pgfmathresult - \csname pgfplotstransformdirection#1\endcsname{\pgfplots@loc@TMPa}% + \csname pgfplotstransformdirection\pgfplots@bar@direction@choice@\endcsname{\pgfplots@loc@TMPa}% \let\pgfplots@loc@TMPa=\pgfmathresult - \if#1x% + \if\pgfplots@bar@direction@choice@ x% \pgfqpointxy{\pgfplots@loc@TMPa}{0}% \edef\pgfmathresult{\pgf@sys@tonumber\pgf@x}% \else @@ -460,7 +475,7 @@ }% \def\pgfplots@bar@mathparse@error#1#2{% - \pgfplots@error{Sorry, the value '#2=\pgfkeysvalueof{/pgf/#2}' is given in terms of a unit -- but I do not know which axis! Please set one of 'xbar' or 'ybar' before evaluating the value of '#2'}% + \pgfplotsthrow{invalid argument}{\pgfplots@bar@direction@choice@}{Sorry, the value '#2=\pgfkeysvalueof{/pgf/#2}' is given in terms of a unit -- but I do not know which axis! Next steps: either (a) set one of 'xbar' or 'ybar' before evaluating the value of '#2' or (b) define 'bar direction=x or y'}\pgfeov% }% % Resets the plot handler routines. @@ -482,8 +497,14 @@ \let\pgfplotsplothandlersurveypointattime=\pgfplotsplothandlersurveypointattime@default \let\pgfplotsplothandlertransformslopedattime=\pgfplotsplothandlertransformslopedattime@default \let\pgfplotsplothandlerifcurrentpointcanbefirstlast=\pgfplotsplothandlerifcurrentpointcanbefirstlast@default + % + \let\pgfplotsplothandlersurveybeforesetpointmeta=\pgfplotsplothandlersurveybeforesetpointmeta@default + \let\pgfplotsplothandlersurveyaftersetpointmeta=\pgfplotsplothandlersurveyaftersetpointmeta@default }% +\def\pgfplotsplothandlersurveybeforesetpointmeta@default{} +\def\pgfplotsplothandlersurveyaftersetpointmeta@default{} + % \pgfplotsplothandlersurveystart \def\pgfplotsplothandlersurveystart@default{}% @@ -1253,7 +1274,7 @@ \pgfkeyslet{/data point/#1#2}\pgfplots@loc@TMPa \fi \def#3{% - \edef\pgfmathresult{\pgfkeysvalueof{/data point/#1#2}} + \edef\pgfmathresult{\pgfkeysvalueof{/data point/#1#2}}% %\message{parse coordinate #1#2 (\pgfmathresult) ...^^J}% }% % @@ -1583,6 +1604,7 @@ \tikz@plot@handler \pgf@plotstreamstart }% + \def\pgfplotsplothandlername{hist}% \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@hist \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@hist \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@hist @@ -1843,6 +1865,22 @@ \newif\ifpgfplotsplothandlercontour@labels \newif\ifpgfplotsplothandlercontour@filled +\def\pgfplotsplothandlercontour@axis@set@inverse#1#2#3#4{% + \pgfplotsutilifstringequal{#1}{#4}{% + \expandafter\def\csname pgfplotsplothandlercontour@axis@inv@#4\endcsname{x}% + }{% + \pgfplotsutilifstringequal{#2}{#4}{% + \expandafter\def\csname pgfplotsplothandlercontour@axis@inv@#4\endcsname{y}% + }{% + \pgfplotsutilifstringequal{#3}{#4}{% + \expandafter\def\csname pgfplotsplothandlercontour@axis@inv@#4\endcsname{z}% + }{% + \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Sorry, the choice axes={#1}{#2}{#3} is illegal. Please use only values x, y, and z and ensure that there is a 1:1 correspondence}\pgfeov% + }% + }% + }% +} + \pgfplotsset{ contour prepared/.code={% \let\tikz@plot@handler=\pgfplotsplothandlercontourprepared @@ -1880,7 +1918,7 @@ inner sep=2pt, font=\scriptsize, every node/.style={mapped color!50!black,fill=white},% - /pgf/number format/relative={\pgfplotspointmetarangeexponent},% + /pgf/number format/relative*={\pgfplotspointmetarangeexponent},% %every node/.style={yshift=10pt},% }, contour/labels over line/.style={ @@ -1905,6 +1943,25 @@ contour/levels/.initial=, % % + contour/contour dir/.is choice, + contour/contour dir/x/.style={/pgfplots/contour/axes={y}{z}{x}}, + contour/contour dir/y/.style={/pgfplots/contour/axes={x}{z}{y}}, + contour/contour dir/z/.style={/pgfplots/contour/axes={x}{y}{z}}, + contour/axes/.code args={#1#2#3}{% + \edef\pgfplotsplothandlercontour@axis@x{#1}% + \edef\pgfplotsplothandlercontour@axis@y{#2}% + \edef\pgfplotsplothandlercontour@axis@z{#3}% + % + \edef\pgfplots@loc@TMPa{{\pgfplotsplothandlercontour@axis@x}{\pgfplotsplothandlercontour@axis@y}{\pgfplotsplothandlercontour@axis@z}}% + % + \expandafter\pgfplotsplothandlercontour@axis@set@inverse\pgfplots@loc@TMPa{x}% + \expandafter\pgfplotsplothandlercontour@axis@set@inverse\pgfplots@loc@TMPa{y}% + \expandafter\pgfplotsplothandlercontour@axis@set@inverse\pgfplots@loc@TMPa{z}% + % + },% + contour/contour dir=z, + % + % % Interface to external tools: contour external/.code={% \edef\tikz@plot@handler{\noexpand\pgfplotsplothandlercontourexternal}% @@ -1941,11 +1998,14 @@ }, }, }% + \def\pgfplotsplothandlercontourprepared{% \pgfplotsresetplothandler \pgfplotsset{empty line=jump}% \let\pgf@plotstreamstart=\pgfplotsplothandlervisstart@contour + \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@contour \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@contour + \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@contour \if m\pgfplotsplothandlercontourprepared@format \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@contourmatlabformat \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@contourmatlabformat @@ -1954,7 +2014,29 @@ }% \fi \pgfplotsplothandlercontour@prepare@point@meta + \def\pgfplotsplothandlersurveybeforesetpointmeta{% + % ensure that 'point meta=z' respects 'axes={y}{z}{x}' -- it + % should assign the 'x' coordinate as point meta! + % To this end, we have to convert to reordered axes + % temporarily. + \pgfplotsplothandlersurveypoint@contour@axes@std@to@reordered + \pgfplotsplothandlersurveybeforesetpointmeta@default + }% + \def\pgfplotsplothandlersurveyaftersetpointmeta{% + \pgfplotsplothandlersurveyaftersetpointmeta@default + % ... and undo the reordering after point meta has been set: + \pgfplotsplothandlersurveypoint@contour@axes@reordered@to@std + } }% + +\def\pgfplotsplothandlersurveystart@contour{% + \pgfplotsplothandlersurveystart@default + % + \pgfplotsplothandlersurveypoint@contour@prepare@axes x% + \pgfplotsplothandlersurveypoint@contour@prepare@axes y% + \pgfplotsplothandlersurveypoint@contour@prepare@axes z% +}% + \def\pgfplotsplothandlercontour@prepare@point@meta{% \ifpgfplots@curplot@threedim \pgfplotsset{/pgfplots/set point meta if empty=z}% @@ -1984,6 +2066,8 @@ \def\c@pgfplotsplothandlercontourprepared@matlabformat@count{0}% \pgfmathfloatparsenumber{nan}% \let\pgfplotsplothandlercontourprepared@matlabformat@meta=\pgfmathresult + % + \pgfplotsplothandlersurveystart@contour } \def\pgfplotsplothandlersurveypoint@contourmatlabformat{% \ifnum\c@pgfplotsplothandlercontourprepared@matlabformat@cur=\c@pgfplotsplothandlercontourprepared@matlabformat@count\relax @@ -2005,10 +2089,18 @@ \else \let\pgfplots@current@point@z=\pgfplotsplothandlercontourprepared@matlabformat@meta \let\pgfplots@current@point@meta=\pgfplotsplothandlercontourprepared@matlabformat@meta - \pgfplotsplothandlersurveypoint@default + \pgfplotsplothandlersurveypoint@contour \pgfplotsutil@advancestringcounter\c@pgfplotsplothandlercontourprepared@matlabformat@cur \fi }% + +\def\pgfplotsplothandlersurveypoint@contour{% + % + \pgfplotsplothandlersurveypoint@contour@axes@reordered@to@std + % + \pgfplotsplothandlersurveypoint@default +} + \def\pgfplotsplothandlersurveyend@contour{% \pgfplotsplothandlercontour@init@limits \ifx\pgfplotsplothandlercontour@limits@low@meta\pgfutil@empty @@ -2485,7 +2577,60 @@ \let\pgfplotsplothandlersurveyend@tofile=\pgfplotsplothandlersurveyend \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@contourexternal \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@contourexternal + % + \pgfplotsplothandlersurveypoint@contour@prepare@axes x% + \pgfplotsplothandlersurveypoint@contour@prepare@axes y% + \pgfplotsplothandlersurveypoint@contour@prepare@axes z% +}% + +% #1: either x, y, or z +% POSTCONDITION: +% The following three macros are defined: +% \pgfplotsplothandlersurveypoint@contour@set@axes@x +% \pgfplotsplothandlersurveypoint@contour@set@axes@y +% \pgfplotsplothandlersurveypoint@contour@set@axes@z +% they take no arguments and assign their result to \pgfmathresult. +\def\pgfplotsplothandlersurveypoint@contour@prepare@axes#1{% + \expandafter\edef\csname pgfplotsplothandlersurveypoint@contour@set@axes@#1\endcsname{% + \noexpand\let\noexpand\pgfmathresult=\expandafter\noexpand\csname pgfplots@current@point@\csname pgfplotsplothandlercontour@axis@#1\endcsname\endcsname + }% + \expandafter\edef\csname pgfplotsplothandlersurveypoint@contour@set@axes@@#1\endcsname{% + \noexpand\let\noexpand\pgfmathresult=\expandafter\noexpand\csname pgfplots@current@point@\csname pgfplotsplothandlercontour@axis@inv@#1\endcsname\endcsname + }% + % +%\message{axes #1: STD -> \expandafter\meaning\csname pgfplotsplothandlersurveypoint@contour@set@axes@#1\endcsname^^J}% +%\message{axes #1: INV -> \expandafter\meaning\csname pgfplotsplothandlersurveypoint@contour@set@axes@@#1\endcsname^^J}% +} + +\def\pgfplotsplothandlersurveypoint@contour@axes@reordered@to@std{% + \pgfplotsplothandlersurveypoint@contour@set@axes@@x + \let\pgfplotsplothandlersurveypoint@contour@set@axes@x@=\pgfmathresult + % + \pgfplotsplothandlersurveypoint@contour@set@axes@@y + \let\pgfplotsplothandlersurveypoint@contour@set@axes@y@=\pgfmathresult + % + \pgfplotsplothandlersurveypoint@contour@set@axes@@z + \let\pgfplotsplothandlersurveypoint@contour@set@axes@z@=\pgfmathresult + % + \let\pgfplots@current@point@x=\pgfplotsplothandlersurveypoint@contour@set@axes@x@ + \let\pgfplots@current@point@y=\pgfplotsplothandlersurveypoint@contour@set@axes@y@ + \let\pgfplots@current@point@z=\pgfplotsplothandlersurveypoint@contour@set@axes@z@ }% +\def\pgfplotsplothandlersurveypoint@contour@axes@std@to@reordered{% + \pgfplotsplothandlersurveypoint@contour@set@axes@x + \let\pgfplotsplothandlersurveypoint@contour@set@axes@x@=\pgfmathresult + % + \pgfplotsplothandlersurveypoint@contour@set@axes@y + \let\pgfplotsplothandlersurveypoint@contour@set@axes@y@=\pgfmathresult + % + \pgfplotsplothandlersurveypoint@contour@set@axes@z + \let\pgfplotsplothandlersurveypoint@contour@set@axes@z@=\pgfmathresult + % + \let\pgfplots@current@point@x=\pgfplotsplothandlersurveypoint@contour@set@axes@x@ + \let\pgfplots@current@point@y=\pgfplotsplothandlersurveypoint@contour@set@axes@y@ + \let\pgfplots@current@point@z=\pgfplotsplothandlersurveypoint@contour@set@axes@z@ +}% + \def\pgfplotsplothandlersurveypoint@contourexternal{% % temporarily disable updates to point meta limits. They should be % updated during the contour prepared processing. @@ -2497,6 +2642,8 @@ % \let\pgfplots@set@perpointmeta@limits=\pgfplotsplothandlercontourexternal@orig@perpointlimits@limits % + \pgfplotsplothandlersurveypoint@contour@axes@std@to@reordered + % %\message{contour gnuplot: collecting point (\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z) [\pgfplots@current@point@meta]...}% \pgfplotsplothandlersurveypoint@tofile }% @@ -2542,7 +2689,10 @@ % % \pgfplotsplothandlercontourprepared - \let\pgfplots@coord@stream@start=\relax% has already been done. + % the PREPARE steps in the coord stream start/end have already + % been done. we only need to init the plot handler survey + % start/end: + \def\pgfplots@coord@stream@start{\pgfplotsplothandlersurveystart}% \def\pgfplots@coord@stream@end{\pgfplotsplothandlersurveyend}% \pgfkeysgetvalue{/pgfplots/contour external/output point meta}\pgfplots@loc@TMPa \ifx\pgfplots@loc@TMPa\pgfutil@empty diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex index a76168b25db..6c89ab7016a 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex @@ -313,6 +313,15 @@ % % So, this command here does all numerics which is to be done and % assembles a NEW, REVERSED STORED PLOT LIST. +% +% FIXME : this routine is a mess. It is largely out-of-sync with the +% remaining implementation of pgfplots and has way too many +% responsabilities. I suppose it should be rewritten from scratch. +% From what I see, it is more complicated than simply reversing the +% list of stored plots and their legends: one needs to postprocess the +% stacking order as it seems (?). +% +% \def\pgfplots@stacked@finalize@stored@plots{% \pgfplotslistnewempty\pgfplots@stored@plotlist@reversed \begingroup diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex index 98cb20753e4..66e9cd8693f 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex @@ -148,6 +148,10 @@ % FIXME : does that need further attention? \def\pgfplots@init@scaled@tick@for#1{% \global\def\pgfplots@glob@TMPa{0}% + \expandafter\pgfplotslistcheckempty\csname pgfplots@prepared@tick@positions@major@#1\endcsname + \ifpgfplotslistempty + % we have no tick labels. Omit the tick scale label as well! + \else \begingroup \ifcase\csname pgfplots@scaled@ticks@#1@choice\endcsname\relax % CASE 0 : scaled #1 ticks=false: do nothing here. @@ -172,17 +176,18 @@ % \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@min@unscaled\relax\pgfmathfloat@a@E \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@max@unscaled\relax\pgfmathfloat@b@E + \pgfplots@init@scaled@tick@normalize@exponents \ifnum\pgfmathfloat@b@E<\pgfmathfloat@a@E \pgfmathfloat@b@E=\pgfmathfloat@a@E \fi \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@above@exponent}% - \expandafter\ifnum\pgfplots@glob@TMPa<\pgfmathfloat@b@E + \ifnum\pgfplots@glob@TMPa<\pgfmathfloat@b@E % ok, scale it: \multiply\pgfmathfloat@b@E by-1 \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% \else \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@below@exponent}% - \expandafter\ifnum\pgfplots@glob@TMPa>\pgfmathfloat@b@E + \ifnum\pgfplots@glob@TMPa>\pgfmathfloat@b@E % ok, scale it: \multiply\pgfmathfloat@b@E by-1 \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% @@ -207,9 +212,88 @@ \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@scaled@ticks@#1@arg\endcsname \fi \endgroup + \fi \expandafter\let\csname pgfplots@tick@scale@#1\endcsname=\pgfplots@glob@TMPa% } +% Handles the case that one of the limits is 0 (or unbounded, although +% that might not be a use-case at all). +% +% Note that 0 = 0*10^A (naturally). In this case, A can be undefined, +% and we want to use B's exponent (only) for the decision here. +% +% INPUT: +% - \pgfplots@cur@min@unscaled, +% - \pgfplots@cur@max@unscaled, +% - \pgfmathfloat@a@E +% - \pgfmathfloat@b@E +% +% Output: +% normalized values of \pgfmathfloat@a@E and \pgfmathfloat@b@E +\def\pgfplots@init@scaled@tick@normalize@exponents{% + \pgfmathfloatgetflags\pgfplots@cur@min@unscaled\pgfmathfloat@a@S + \pgfmathfloatgetflags\pgfplots@cur@max@unscaled\pgfmathfloat@b@S + \ifcase\pgfmathfloat@a@S% + % min = 0. + \ifcase\pgfmathfloat@b@S + % max =0 + % normalize to 0 * 10^0 ! + \pgfmathfloat@a@E=0 % + \pgfmathfloat@b@E=0 % + \or + % max > 0 + % since 0 = 0 * 10^A for any A, tick scaling is based on + % B only. + \pgfmathfloat@a@E=\pgfmathfloat@b@E + \or + % max < 0 + \pgfmathfloat@a@E=\pgfmathfloat@b@E + \else + % max is unbounded. normalize exponent to something + % useful: + \pgfmathfloat@a@E=0 % + \pgfmathfloat@b@E=0 % + \fi + \or + % min>0 + \ifcase\pgfmathfloat@b@S + % max =0 + % since 0 = 0 * 10^B for any B, tick scaling is based on + % A only. + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \or + % max > 0 + \or + % max < 0 + \else + % max is unbounded. normalize exponent to something + % useful: + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \fi + \or + % min<0 + \ifcase\pgfmathfloat@b@S + % max =0 + % since 0 = 0 * 10^B for any B, tick scaling is based on + % A only. + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \or + % max > 0 + \or + % max < 0 + \else + % max is unbounded. normalize exponent to something + % useful: + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \fi + \else + % min is unbounded: + % normalize somehow. + \pgfmathfloat@a@E=0 % + \pgfmathfloat@b@E=0 % + \fi +} + % x-axis tick labels for #1th tick % #1: the axis (x,y or z) % #2: the value @@ -445,6 +529,7 @@ \pgfplotsqpointoutsideofaxis{\csname pgfplots@#1ticklabelaxisspec\endcsname}{#2}{#3}% }% \def\pgfplotsqpointoutsideofticklabelaxisrel#1#2#3{% +%\message{using \string\pgfplotsqpointoutsideofaxisrel{\csname pgfplots@#1ticklabelaxisspec\endcsname}{#2}{#3}^^J}% \pgfplotsqpointoutsideofaxisrel{\csname pgfplots@#1ticklabelaxisspec\endcsname}{#2}{#3}% }% \def\pgfplotsqpointoutsideofticklabelaxistransformed#1#2#3{% @@ -536,26 +621,41 @@ \tick } +\def\pgfplots@limit@max@reg#1{% + \if\pgfkeysvalueof{/pgfplots/#1 dir/value}n% + \csname pgfplots@#1max@reg\endcsname + \else + \csname pgfplots@#1min@reg\endcsname + \fi +}% +\def\pgfplots@limit@min@reg#1{% + \if\pgfkeysvalueof{/pgfplots/#1 dir/value}n% + \csname pgfplots@#1min@reg\endcsname + \else + \csname pgfplots@#1max@reg\endcsname + \fi +}% + % Check if a label does not cross the x-axis \def\pgfplots@ytick@check@tickshow{% \pgfplots@tickshowtrue \if\pgfplots@yaxislinesnum2% center \ifcase\pgfplots@xaxislinesnum\relax \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@ymin@reg} + {\pgfplots@tmpa}{\pgfplots@limit@min@reg{y}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse }{}% \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@ymax@reg} + {\pgfplots@tmpa}{\pgfplots@limit@max@reg{y}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse }{}% \or \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@ymin@reg} + {\pgfplots@tmpa}{\pgfplots@limit@min@reg{y}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse @@ -570,7 +670,7 @@ }{}% \or \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@ymax@reg} + {\pgfplots@tmpa}{\pgfplots@limit@max@reg{y}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse @@ -726,20 +826,20 @@ \if\pgfplots@xaxislinesnum2% center \ifcase\pgfplots@yaxislinesnum\relax \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@xmin@reg} + {\pgfplots@tmpa}{\pgfplots@limit@min@reg{x}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse }{}% \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@xmax@reg} + {\pgfplots@tmpa}{\pgfplots@limit@max@reg{x}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse }{}% \or \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@xmin@reg} + {\pgfplots@tmpa}{\pgfplots@limit@min@reg{x}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse @@ -753,7 +853,7 @@ }{}% \or \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@xmax@reg} + {\pgfplots@tmpa}{\pgfplots@limit@max@reg{x}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse @@ -1972,7 +2072,7 @@ \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@#1tick\endcsname \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPb\csname pgfplots@tick@distance@#1\endcsname \else - \pgfplots@warning{Tick computation for direction #1 failed; there are always too few tick labels (try min ticks has already been advanced to \axisdefaulttryminticks)}% + \pgfplotswarning{tick computation failed}{#1}{\axisdefaulttryminticks}\pgfeov% \def\pgfplots@tick@returnval@ready{0}% \fi \pgfmath@smuggleone\pgfplots@tick@returnval@ready diff --git a/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-dvipdfmx.def b/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-dvipdfmx.def new file mode 100644 index 00000000000..29deb7dfa1b --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-dvipdfmx.def @@ -0,0 +1,180 @@ +%-------------------------------------------- +% +% Package pgfplots +% +% Provides a user-friendly interface to create function plots (normal +% plots, semi-logplots and double-logplots). +% +% It is based on Till Tantau's PGF package. +% +% Copyright 2007-2012 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 +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +%-------------------------------------------- + +\newcount\c@pgfplotslibrarysurf@streamlen + +\def\pgfplotslibrarysurf@initstream{% + % binary doesn't work due to limitations of DVI. + % We NEED an ASCII encoding. + % + \def\pgfplotslibrarysurf@filter@encode{ASCIIHexEncode}% + \def\pgfplotslibrarysurf@filter@decode{ASCIIHexDecode}% + \global\c@pgfplotslibrarysurf@streamlen=0 % +}% + +\def\pgfplotslibrarysurf@advancestreamlen#1{% + \global\advance\c@pgfplotslibrarysurf@streamlen by#1\relax +}% + +% The lowlevel call for surface shadings. It uses a pattern type 2 +% dictionary as fill color and has thus several things to do. This is +% a little bit more complicated than using the '/sh' operator (as +% other pgf shadings do): the surface shading must be positioned +% exactly at the requested coordinates, otherwise it is quite useless. +% +% Since shadings are *not* affected by changes in the canvas +% transformation matrix (shifts, rotations etc), it is necessary to +% pack the shading into a separate xform object which is then rotated +% and translated correctly. +% +% There is just one more transformation necessary: the shift inside of +% the xform. This shift is done using changes in the canvas +% transformation matrix and it is UNDONE in the /Matrix argument of +% the pattern dictionary. This last step can't be done with the /sh +% operator which is why I am using pattern dictionaries. +\def\pgfplotslibrarysurfdraw{% + \begingroup + \setbox\pgfutil@tempboxa=\hbox + {% + \pgfpicture + \pgfplotssys@do@surfshading@fillpaths\pgfplots@loc@TMPa% + \global\let\pgfplots@glob@TMPa=\pgfplots@loc@TMPa + \pgfpathrectanglecorners + {\pgfplotslibrarysurf@corner@sw} + {\pgfplotslibrarysurf@corner@ne}% + \pgfplotslibrarysurfusepath + \endpgfpicture + }% + % + % NOTE : this code was broken due to some driver in pgf. I fixed + % that and brought the fix with pgfplots. + % + % for some reason, dvipdfmx requires to move the XObject + % declaration out of the current stream. + % Perhaps I should rephrase and say that for some reason, this appears to be + % unnecessary for pdftex. + % + % FIXME : this might have N^2 time due to "box-append"! + \pgfutil@insertatbegincurrentpagefrombox + {% + \special{pdf: bxobj @pgfplotsX\pgfplotslibrarysurf@count\space + width \the\wd\pgfutil@tempboxa\space height \the\ht\pgfutil@tempboxa}% + \special{pdf: put @resources + % write the pattern resource dictionary of the XObject + % (only!): + << /Pattern << \pgfplots@glob@TMPa >> >> + }% + % + % no need to add the pattern to the page's resource list! + % we do not need this: + %\pgfutil@addpdfresource@patterns{\pgfplots@glob@TMPa}% + \leavevmode + \box\pgfutil@tempboxa + \special{pdf: exobj}% + }% + \endgroup + \special{pdf: uxobj @pgfplotsX\pgfplotslibrarysurf@count\space}% + \pgfplotsutil@advancestringcounter@global\pgfplotslibrarysurf@count +} + +% To be used inside of a pgfpicture. +% +% #1: a macro name. The contents of this macro needs to be written +% into the pdf pattern dictionary contained in the pdf resources of +% the current context. The current context is either the current page +% or an xform object. +% +% +\def\pgfplotssys@do@surfshading@fillpaths#1{% + % it contain the BINARY bytes. But it is ASCII encoded, see docs of ASCIIHexEncode. + \global\multiply\c@pgfplotslibrarysurf@streamlen by2 % + % + \def\pgfplots@loc@TMPa{% + % stream length will be computed automatically + /ShadingType \pgfplotslibrarysurf@type\space + /BitsPerCoordinate \pgfplotslibrarysurf@bitspercoordinate\space + /BitsPerComponent \pgfplotslibrarysurf@bitspercomponent\space + \if5\pgfplotslibrarysurf@type + /VerticesPerRow \pgfkeysvalueof{/pgfplots/surf shading/cols} + \else + /BitsPerFlag 8 + \fi + /ColorSpace /Device\pgfplotslibrarysurf@colorspace + /Decode [\pgfplotslibrarysurf@decode] + \ifpgfplotslibrarysurf@usecolormap + /Function \pgfkeysvalueof{/pgfplots/surf shading/colormap} + \fi + \ifx\pgfplotslibrarysurf@filter@decode\pgfutil@empty + \else + /Filter /\pgfplotslibrarysurf@filter@decode\space + \fi + /Length \the\c@pgfplotslibrarysurf@streamlen + }% + % + \pgf@process{\pgfpointdiff{\pgfplotslibrarysurf@corner@sw}{\pgfkeysvalueof{/pgfplots/surf shading/anchor}}}% + \pgf@sys@bp@correct\pgf@x% + \pgf@sys@bp@correct\pgf@y% + % + %\noexpand\pgfutil@insertatbegincurrentpagefrombox + {% + \special{pdf: object @pgfplotsShading\pgfplotslibrarysurf@count\space << \pgfplots@loc@TMPa >> + stream^^J% + \pgfplotslibrarysurf@binarystream + endstream + }% + \special{pdf: close @pgfplotsShading\pgfplotslibrarysurf@count\space }% + \special{pdf: object @pgfplotsPattern\pgfplotslibrarysurf@count\space << + /Type /Pattern + /PatternType 2 + % /Matrix [\pgf@pt@aa\space\pgf@pt@ab\space\pgf@pt@ba\space\pgf@pt@bb\space\pgf@sys@tonumber\pgf@pt@x\space\pgf@sys@tonumber\pgf@pt@y] + % FIXME: INCORPORATE TIKZ CM + /Matrix [1 0 0 1 \pgf@sys@tonumber\pgf@x\space \pgf@sys@tonumber\pgf@y] %226.533 518.141] + %-------------------------------------------------- + % /ExtGState + % << + % /LW 2 + % /OP true + % /OPM 1 + % >> + %-------------------------------------------------- + /Shading @pgfplotsShading\pgfplotslibrarysurf@count + >> + }% + \special{pdf: close @pgfplotsPattern\pgfplotslibrarysurf@count\space }% + }% + \pgfplots@loc@TMPb + \edef#1{% + /pgfplotsSurface\pgfplotslibrarysurf@count\space @pgfplotsPattern\pgfplotslibrarysurf@count + }% + % + % I inlined \pgfsys@setpatterncolored here because it appears to be + % natural - and in order to bring this driver to PGF 2.00 (which + % would fail otherwise) + \pgfsysprotocol@literal{/Pattern cs /pgfplotsSurface\pgfplotslibrarysurf@count\space scn}% +} + +\endinput +% vi: ft=tex diff --git a/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-dvips.def b/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-dvips.def index e81a53a44d8..85ed333152c 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-dvips.def +++ b/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-dvips.def @@ -1,5 +1,4 @@ %-------------------------------------------- -% $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/sys/pgflibrarysurfshading.pgfsys-dvips.def,v 1.1 2009/06/11 07:14:52 ludewich Exp $ % % Package pgfplots % @@ -50,7 +49,7 @@ \pgfpathrectanglecorners {\pgfplotslibrarysurf@corner@sw} {\pgfplotslibrarysurf@corner@ne}% - \pgfusepath{fill}% + \pgfplotslibrarysurfusepath \endpgfpicture \leavevmode% ?? } @@ -77,7 +76,7 @@ << /ShadingType \pgfplotslibrarysurf@type\space /BitsPerCoordinate \pgfplotslibrarysurf@bitspercoordinate\space - /BitsPerComponent 16 % Note: this here is the reason why I can't use ASCII85Decode + /BitsPerComponent \pgfplotslibrarysurf@bitspercomponent\space % Note: this here is the reason why I can't use ASCII85Decode \if5\pgfplotslibrarysurf@type /VerticesPerRow \pgfkeysvalueof{/pgfplots/surf shading/cols} \else @@ -85,7 +84,9 @@ \fi /ColorSpace /Device\pgfplotslibrarysurf@colorspace /Decode [\pgfplotslibrarysurf@decode] - /Function \pgfkeysvalueof{/pgfplots/surf shading/colormap} + \ifpgfplotslibrarysurf@usecolormap + /Function \pgfkeysvalueof{/pgfplots/surf shading/colormap} + \fi /DataSource currentfile % direct binary output not possible: DVI diff --git a/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-pdftex.def b/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-pdftex.def index d28777ad4dd..70d1c1e889e 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-pdftex.def +++ b/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-pdftex.def @@ -43,6 +43,7 @@ % operator which is why I am using pattern dictionaries. \def\pgfplotslibrarysurfdraw{% \begingroup + %\pgfinterruptpicture% needed? \setbox\pgfutil@tempboxa=\hbox{% \pgfpicture \pgfplotssys@do@surfshading@fillpaths\pgfplots@loc@TMPa% @@ -50,7 +51,7 @@ \pgfpathrectanglecorners {\pgfplotslibrarysurf@corner@sw} {\pgfplotslibrarysurf@corner@ne}% - \pgfusepath{fill}% + \pgfplotslibrarysurfusepath \endpgfpicture }% \immediate\pdfxform resources{ @@ -58,6 +59,7 @@ }\pgfutil@tempboxa \leavevmode \pdfrefxform\pdflastxform + %\endpgfinterruptpicture \endgroup } @@ -82,7 +84,7 @@ % stream length will be computed automatically /ShadingType \pgfplotslibrarysurf@type\space /BitsPerCoordinate \pgfplotslibrarysurf@bitspercoordinate\space - /BitsPerComponent 16 + /BitsPerComponent \pgfplotslibrarysurf@bitspercomponent\space \if5\pgfplotslibrarysurf@type /VerticesPerRow \pgfkeysvalueof{/pgfplots/surf shading/cols} \else @@ -90,7 +92,9 @@ \fi /ColorSpace /Device\pgfplotslibrarysurf@colorspace /Decode [\pgfplotslibrarysurf@decode] - /Function \pgfkeysvalueof{/pgfplots/surf shading/colormap} + \ifpgfplotslibrarysurf@usecolormap + /Function \pgfkeysvalueof{/pgfplots/surf shading/colormap} + \fi \ifx\pgfplotslibrarysurf@filter@decode\pgfutil@empty \else /Filter /\pgfplotslibrarysurf@filter@decode\space diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.multiaxis.code.tex b/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-xetex.def index 0c6f9a7e292..1f9245b276a 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.multiaxis.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-xetex.def @@ -7,7 +7,7 @@ % % It is based on Till Tantau's PGF package. % -% Copyright 2007/2008/2009 by Christian Feuersänger. +% Copyright 2007-2012 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 @@ -24,16 +24,7 @@ % %-------------------------------------------- +\input pgflibrarypgfplots.surfshading.pgfsys-dvipdfmx.def -\def\pgfplots@environment@multiaxis{% - \pgfutil@ifnextchar[{\pgfplots@@environment@multiaxis}{\pgfplots@@environment@multiaxis[]}% -} -\def\pgfplots@@environment@multiaxis[#1]{% - \begingroup -} -\def\endpgfplots@environment@multiaxis{% - \endgroup -} -\tikzaddtikzonlycommandshortcutlet\multiaxis\pgfplots@environment@multiaxis -\tikzaddtikzonlycommandshortcutlet\endmultiaxis\endpgfplots@environment@multiaxis - +\endinput +% vi: ft=tex diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex index 6414f57a9a8..ca2c74c5f58 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex @@ -522,9 +522,9 @@ \def\pgfplotsbinaryencodesignedmaplinearly#1{% \begingroup \global\let\pgfplotsbinaryresult=\pgfplotsbinaryempty - \c@pgfplotsbin@input=#1 % + \c@pgfplotsbin@input=#1\relax% \pgfplotsbinaryencodesignedmaplinearly@prepare - \ifnum\c@pgfplotsbin@input<0 + \ifnum\c@pgfplotsbin@input<0 % % compute + 2^31 - 1 \pgfplotsbinary@add@signed@largest@absolute \else @@ -533,7 +533,7 @@ \let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO@LINEARMAP \let\pgfplotsbinary@hook=\pgfplotsbinary@hook@signed@linearmap % and compute the -1 explicitly here: - \advance\c@pgfplotsbin@input by-1 + \advance\c@pgfplotsbin@input by-1 % \fi \pgfplotsbinaryencode@badic@unsigned@% \endgroup diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolor.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolor.code.tex new file mode 100644 index 00000000000..dc1a7a0aa78 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolor.code.tex @@ -0,0 +1,631 @@ +%-------------------------------------------- +% +% Package pgfplots +% +% Provides a user-friendly interface to create function plots (normal +% plots, semi-logplots and double-logplots). +% +% It is based on Till Tantau's PGF package. +% +% Copyright 2007-2013 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 +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +%-------------------------------------------- + +\pgfkeys{ + /pgfplots/color sequence/reset/.style={ + /pgfplots/color sequence/colorspace, + /pgfplots/color sequence/default input colorspace, + /pgfplots/color sequence/every input component/.code=, + /pgfplots/color sequence/context message, + }, + /pgfplots/color sequence/colorspace/.initial=auto, + /pgfplots/color sequence/colorspace/.default=auto, + /pgfplots/color sequence/default input colorspace/.initial=, + /pgfplots/color sequence/default input colorspace/.default=\pgfkeysvalueof{/pgfplots/color sequence/colorspace}, + % applied to every INPUT component, i.e. before transforming it to some target color space. + /pgfplots/color sequence/every input component/.code=, + /pgfplots/color sequence/context message/.code={\def\pgfplotscolornormalizesequence@context@message{#1}}, + /pgfplots/color sequence/context message/.default=\pgfplotscolornormalizesequence@context@message@default, + /pgfplots/color sequence/reset, +} + +\newif\ifpgfplotscolor@colorspaceknown + +% the beginning of a normalized color sequence. +% +% It is to be used like +% \pgfplotscolornormalizesequence[colorspace=rgb] +% +% \pgfplotscolornormalizesequencenext{1,1,1} +% -> \pgfplotsretval = {1,1,1} % uses default colorspace +% \pgfplotscolornormalizesequencenext{color=red} +% -> \pgfplotsretval = {1,0,0} +% \pgfplotscolornormalizesequencenext{color=blue} +% -> \pgfplotsretval = {0,0,1} +% \pgfplotscolornormalizesequencenext{rgb=1,0,0} +% -> \pgfplotsretval = {1,0,0} +% \pgfplotscolornormalizesequencenext{cmyk=1,0,0,1} +% -> \pgfplotsretval = {<converted value>} +% +% \endpgfplotscolornormalizesequence +% +% Every color provided in the sequence will be normalized by +% transforming it to the common color space and by computing the +% separate components representing the color in that space. +% +% These components are available for use in interpolation routines. +% +% #1 : keys in the /pgfplots/color sequence path +\def\pgfplotscolornormalizesequence[#1]{% + \pgfqkeys{/pgfplots/color sequence}{% + #1,% + }% + \pgfkeysgetvalue{/pgfplots/color sequence/colorspace}\pgfplots@loc@TMPa + \pgfkeysgetvalue{/pgfplots/color sequence/default input colorspace}\pgfplotscolornormalizesequence@colspace@input + \edef\pgfplotscolornormalizesequence@colspace@input{\pgfplotscolornormalizesequence@colspace@input} + \pgfkeysgetvalue{/pgfplots/color sequence/every input component/.@cmd}\pgfplotscolornormalizesequencenext@every@component + \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}% + \def\pgfplots@loc@TMPb{auto}% + \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa + % colorspace=auto: same as empty. + \let\pgfplots@loc@TMPa=\pgfutil@empty + \fi + \ifx\pgfplots@loc@TMPa\pgfutil@empty + % colorspace=auto: + \def\pgfplotscolornormalizesequence@colspace{}% + \else + \def\pgfplots@loc@TMPb{rgb}% + \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa + % colorspace=rgb: + \def\pgfplotscolornormalizesequence@colspace{rgb}% + \else + \def\pgfplots@loc@TMPb{cmyk}% + \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa + % colorspace=cmyk: + \def\pgfplotscolornormalizesequence@colspace{cmyk}% + \else + \def\pgfplots@loc@TMPb{gray}% + \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa + % colorspace=gray: + \def\pgfplotscolornormalizesequence@colspace{gray}% + \else + \pgfplots@error{Sorry, the choice colorspace=\pgfplots@loc@TMPa\space is unsupported as interpolation colorspace in pgfplots, please use one of 'auto,rgb,cmyk,gray'}% + \fi + \fi + \fi + \fi +}% + +% ends a normalized color sequence and returns the final colorspace +% and its number of components into \pgfplotsretval and +% \pgfplotsretvalb, respectively +\def\endpgfplotscolornormalizesequence{% + \let\pgfplotsretval=\pgfplotscolornormalizesequence@colspace + \pgfplotscolor@get@num@components{\pgfplotsretval}{\pgfplotsretvalb}% + \pgfqkeys{/pgfplots/color sequence}{reset}% +}% + +% accepts the next color in a sequence of colors. The color will be +% normalized and the normalized result written to \pgfplotsretval. +% +% SEE \pgfplotscolornormalizesequencenext -- it is MUCH more powerful! +% +% #1 the color space of the color. +% #2 the components of the color, separated by comma. +% +% POSTCONDITION: +% \pgfplotsretval contains '{<color space>}{<comma-separated-components>}' +% -> including the curly braces. +% +% \pgfplotsretvalb contains the number of input components in +% \pgfplotsretval +\def\pgfplotscolornormalizesequencenextbycomponents#1#2{% + \edef\pgfplotscolornormalizesequence@cur@colspace{#1}% + \pgfplotscolornormalizesequencenextbycomponents@normalize@components{#2}% + % + \ifx\pgfplotscolornormalizesequence@cur@colspace\pgfplotscolornormalizesequence@colspace + \else + \ifx\pgfplotscolornormalizesequence@colspace\pgfutil@empty + \pgfplotscolornormalizesequencenextbycomponents@assign@auto@colspace + \fi + % + \ifx\pgfplotscolornormalizesequence@colspace\pgfplotscolornormalizesequence@cur@colspace + % Ah, ok - the colorspace is NOW the correct one (because + % we chose it as the colorspace for this complete color + % sequence. + \else + % Oh. We need to convert the color space! + \edef\pgfplots@loc@TMPa{{\pgfplotscolornormalizesequence@cur@colspace}{\pgfplotsretval}}% + \expandafter\pgfutil@convertcolorspec\pgfplots@loc@TMPa + {\pgfplotscolornormalizesequence@colspace}% target color spaces + {\pgfplotsretval}% target macro + \fi + \fi + \edef\pgfplotsretval{\pgfplotsretval}% + \pgfplotscolor@get@num@components{\pgfplotscolornormalizesequence@colspace}{\pgfplotsretvalb}% +} + +\def\pgfplotscolornormalizesequencenextbycomponents@assign@auto@colspace{% + % Ah; we have '/pgfplots/color sequence/colorspace=auto'. + % Well, check if the current colorspace (stored in + % \pgfplotscolornormalizesequence@cur@colspace) is suitable. + % + % It is suitable if it is rgb or cmyk. In all other cases, + % we choose either rgb or cmyk. More precisely. 'cmy' is + % mapped to cmyk. All other cases are treated as rgb. + % + \def\pgfplots@loc@TMPa{cmyk}% + \ifx\pgfplotscolornormalizesequence@cur@colspace\pgfplots@loc@TMPa + \let\pgfplotscolornormalizesequence@colspace=\pgfplotscolornormalizesequence@cur@colspace + \else + \def\pgfplots@loc@TMPa{cmy}% + \ifx\pgfplotscolornormalizesequence@cur@colspace\pgfplots@loc@TMPa + \def\pgfplotscolornormalizesequence@colspace{cmyk}% + \else + % rgb appears to be the best choice: (1) it is backwards + % compatible and (2) gray or something like that might fit + % badly to any other colors in the sequence. + \def\pgfplotscolornormalizesequence@colspace{rgb}% + \fi + \fi +} + +% #1: color components +% +% PRECONDITION: \pgfplotscolornormalizesequence@cur@colspace is the +% current color space +% +% POSTCONDITION: \pgfplotsretval contains the normalized color +% components +\def\pgfplotscolornormalizesequencenextbycomponents@normalize@components#1{% + \pgfutil@ifundefined{pgfplots@colspace@name@\pgfplotscolornormalizesequence@cur@colspace}{% + \pgfplotscolor@colorspaceknownfalse + }{% + \pgfplotscolor@colorspaceknowntrue + }% + \edef\pgfplots@loc@TMPb{#1}% + \def\pgfplotsretval{}% + \c@pgf@counta=0 % + \expandafter\pgfplotscolornormalizesequencenext@prepare@loop\pgfplots@loc@TMPb,\pgfplots@EOI,% +}% + +% assigns the number of color components for the given colorspace to +% \pgfplotsretval +\def\pgfplotscolorspacegetcomponents#1{% + \pgfplotscolor@get@num@components{#1}{\pgfplotsretval}% +}% + +% Defines \pgfplotsretval to contain the number of components in the +% color space. +\def\pgfplotscolornormalizesequencegetnumcomponents{% + \ifx\pgfplotscolornormalizesequence@colspace\pgfutil@empty + \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Cannot create color with zero components: no colorspace set for the normalized color sequence.}\pgfeov% + \fi + \pgfplotscolorspacegetcomponents{\pgfplotscolornormalizesequence@colspace}% +}% + +\def\pgfplotscolor@get@num@components#1#2{% + \pgfutil@ifundefined{pgfplots@colspace@numcomp@#1}{% + \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{The input color has an unsupported color space '#1'}\pgfeov% + }{% + \edef#2{\csname pgfplots@colspace@numcomp@#1\endcsname}% + }% +}% + + +\def\pgfplots@colspace@numcomp@gray{1}% +\def\pgfplots@colspace@name@gray{gray}% + +\def\pgfplots@colspace@numcomp@rgb{3}% +\def\pgfplots@colspace@name@rgb{rgb}% + +\def\pgfplots@colspace@numcomp@cmyk{4}% +\def\pgfplots@colspace@name@cmyk{cmyk}% + +\def\pgfplots@colspace@numcomp@cmy{3}% +\def\pgfplots@colspace@name@cmy{cmy}% + +\def\pgfplots@colspace@numcomp@wave{1}% +\def\pgfplots@colspace@name@wave{wave}% +\pgfutil@namedef{pgfplots@colspace@minaccept@wave@0}{362.998}% +\pgfutil@namedef{pgfplots@colspace@min@wave@0}{363}% +\pgfutil@namedef{pgfplots@colspace@maxaccept@wave@0}{814.001}% +\pgfutil@namedef{pgfplots@colspace@max@wave@0}{814}% + +\def\pgfplots@colspace@numcomp@Hsb{3}% +\def\pgfplots@colspace@name@Hsb{Hsb}% +\pgfutil@namedef{pgfplots@colspace@minaccept@Hsb@0}{-0.001}% +\pgfutil@namedef{pgfplots@colspace@min@Hsb@0}{0}% +\pgfutil@namedef{pgfplots@colspace@maxaccept@Hsb@0}{\rangeHsb}% +\pgfutil@namedef{pgfplots@colspace@max@Hsb@0}{\rangeHsb}% + +\def\pgfplotscolornormalizesequencenext@prepare@loop#1,{% + \def\pgfmathresult{#1}% + \ifx\pgfmathresult\pgfplots@EOI + \else + \begingroup + \pgfkeyslet{/pgf/fpu/handlers/invalid number/.@cmd}\pgfplotscolornormalizesequencenextbycomponents@parsenumber@error + \expandafter\pgfplotscolornormalizesequencenext@every@component\expandafter{\pgfmathresult}\pgfeov% + \ifpgfplotscolor@colorspaceknown + \expandafter\pgfplotscolornormalizesequencenextbycomponents@parsenumber\expandafter{\pgfmathresult}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup + \ifpgfplotscolor@colorspaceknown + \expandafter\pgfplotscolornormalizesequencenextbycomponents@sanitize\expandafter{\pgfmathresult}% + \fi + \ifx\pgfplotsretval\pgfutil@empty + \edef\pgfplotsretval{\pgfmathresult}% + \else + \edef\pgfplotsretval{\pgfplotsretval,\pgfmathresult}% + \fi + \advance\c@pgf@counta by1 % + \expandafter\pgfplotscolornormalizesequencenext@prepare@loop + \fi +} + +\def\pgfplotscolornormalizesequencenextbycomponents@parsenumber#1{% + \pgfmathfloatparsenumber{#1}% + \pgfmathfloattofixed\pgfmathresult +} + +\def\pgfplotscolornormalizesequencenextbycomponents@parsenumber@error#1#2\pgfeov{% + \pgfplotsthrow{invalid color component}{\pgfmathresult}{Sorry, the color component value '#1' is no number. Did you mean 'color=#1'? The error occured near `\pgfplotscolornormalizesequence@context@message'}\pgfeov% + \pgfmathfloatcreate{0}{0.0}{0}% +}% + +% #1 the color component value +\def\pgfplotscolornormalizesequencenextbycomponents@sanitize#1{% + \pgf@xa=#1pt % + % + % check if we have something like + % \csname pgfplots@colspace@minaccept@<colorspace name>@2\endcsname where 2 is component index: + \edef\pgfplots@loc@TMPc{@\pgfplotscolornormalizesequence@cur@colspace @\the\c@pgf@counta}% + \pgfutil@ifundefined{pgfplots@colspace@minaccept\pgfplots@loc@TMPc}{% + % NO - implicitly defined to [0,1] + \def\pgfplots@colspace@minaccept@@{-0.001}% + \def\pgfplots@colspace@min@@{-0.001}% + \def\pgfplots@colspace@maxaccept@@{1.001}% + \def\pgfplots@colspace@max@@{1}% + }{% + % YES - expect all four values: + \edef\pgfplots@colspace@minaccept@@{\csname pgfplots@colspace@minaccept\pgfplots@loc@TMPc\endcsname}% + \edef\pgfplots@colspace@min@@{\csname pgfplots@colspace@min\pgfplots@loc@TMPc\endcsname}% + \edef\pgfplots@colspace@maxaccept@@{\csname pgfplots@colspace@maxaccept\pgfplots@loc@TMPc\endcsname}% + \edef\pgfplots@colspace@max@@{\csname pgfplots@colspace@max\pgfplots@loc@TMPc\endcsname}% + }% + \ifdim\pgf@xa<\pgfplots@colspace@minaccept@@ pt % + \edef\pgfmathresult{\pgfplots@colspace@min@@}% + \pgfplotscolor@rangeexception{#1}% + \else + \ifdim\pgf@xa>\pgfplots@colspace@maxaccept@@ pt % + \edef\pgfmathresult{\pgfplots@colspace@max@@}% + \pgfplotscolor@rangeexception{#1}% + \else + % Ah - the common case! + \edef\pgfmathresult{\pgf@sys@tonumber\pgf@xa}% normalize number (strip trailing zeros etc). + \fi + \fi +} + +\def\pgfplotscolor@rangeexception#1{% + \pgfplotsthrow{invalid color component}{\pgfmathresult}{Sorry, the color component value #1 (no. \the\c@pgf@counta) is out of range. The allowed range is 0 <= value <= 1. The error occured near `\pgfplotscolornormalizesequence@context@message'}\pgfeov% +} + + +% Same as \pgfplotscolornormalizesequencenextbycomponents but with +% more freedom in the input. +% +% #1 some color. +% Accepted formats: +% 'color=<xcolor value>' +% <xcolor value> is any valid expression of the xcolor package. +% +% 'rgb=R,G,B' +% R,G,B are numbers in [0,1] +% +% 'rgb255=R,G,B' +% R,G,B are numbers in [0,255] +% +% 'cmyk=C,M,Y,K' +% C, M, Y, and K are numbers in [0,1] +% +% 'cmyk255=C,M,Y,K' +% C, M, Y, and K are numbers in [0,255] +% +% 'gray=G' +% G is a gray scale number in [0,1] +% +% 'C1,C2,C3' +% any number of Ci can folow, each is interpreted in the default +% colorspace (i.e. the one set before at the beginning of the +% sequence) +% +% +% Example: +% \pgfplotscolornormalizesequencenext{color=blue} +% \pgfplotscolornormalizesequencenext{rgb=1,0,0} +% \pgfplotscolornormalizesequencenext{cmyk=1,0,0,1} +% \pgfplotscolornormalizesequencenext{1,0,0} (interpreted in the +% colorspace set at \pgfplotscolornormalizesequence) +% +% POSTCONDITION: see \pgfplotscolornormalizesequencenextbycomponents +\def\pgfplotscolornormalizesequencenext#1{% + \edef\pgfplotscolornormalizesequence@context@message@default{#1}% + \expandafter\pgfplotscolornormalizesequencenext@\pgfplotscolornormalizesequence@context@message@default\pgfplots@EOI +} +\def\pgfplotscolornormalizesequencenext@{% + \pgfutil@ifnextchar c{% + \pgfplotscolornormalizesequencenext@c + }{% + \pgfutil@ifnextchar r{% + \pgfplotscolornormalizesequencenext@rgb + }{% + \pgfutil@ifnextchar g{% + \pgfplotscolornormalizesequencenext@gray + }{% + \pgfplotscolornormalizesequencenext@defaultcolspace + }% + }% + }% +} + +\def\pgfplotscolornormalizesequencenext@gray gray=#1\pgfplots@EOI{% + % FIXME : we might be better off with real support for a gray + % colorspace! + \pgfplotscolornormalizesequencenextbycomponents{rgb}{#1,#1,#1}% +} + +\def\pgfplotscolornormalizesequencenext@defaultcolspace#1\pgfplots@EOI{% + \edef\pgfplotsretval{#1}% + \ifx\pgfplotsretval\pgfutil@empty + % hm. Ok, simply return the empty input. + % + % ... and the number of components. + \pgfplotscolor@get@num@components{\pgfplotscolornormalizesequence@colspace}{\pgfplotsretvalb}% + % + \else + \expandafter\pgfutil@in@\expandafter=\expandafter{\pgfplotsretval}% + \ifpgfutil@in@ + \expandafter\pgfplotscolornormalizesequencenext@unknown@colspace\pgfplotsretval\pgfplots@EOI + \else + \ifx\pgfplotscolornormalizesequence@colspace@input\pgfutil@empty + \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{The input color #1 cannot be interpreted; please assign a default color space first}\pgfeov% + \fi + \pgfplotscolornormalizesequencenextbycomponents{\pgfplotscolornormalizesequence@colspace@input}{#1}% + \fi + \fi +} + +\def\pgfplotscolornormalizesequencenext@unknown@colspace#1=#2\pgfplots@EOI{% + \pgfplotscolornormalizesequencenextbycomponents{#1}{#2}% +} + +\def\pgfplotscolornormalizesequencenext@rgb rgb{% + \pgfutil@ifnextchar2{% + \pgfplotscolornormalizesequencenext@rgb@two@five@five + }{% + \pgfplotscolornormalizesequencenext@rgb@plain + }% +} +\def\pgfplotscolornormalizesequencenext@rgb@plain=#1\pgfplots@EOI{% + \pgfplotscolornormalizesequencenextbycomponents{rgb}{#1}% +} + +\def\pgfplotscolorsequence@two@five@five@rescale#1{% + \pgfmath@basic@multiply@{0.003921568}{#1}% +}% +\def\pgfplotscolornormalizesequencenext@rgb@two@five@five255=#1,#2,#3\pgfplots@EOI{% + \pgfplotscolorsequence@two@five@five@rescale{#1}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \pgfplotscolorsequence@two@five@five@rescale{#2}% + \let\pgfplots@loc@TMPb=\pgfmathresult + \pgfplotscolorsequence@two@five@five@rescale{#3}% + \edef\pgfplots@loc@TMPc{{rgb}{\pgfplots@loc@TMPa,\pgfplots@loc@TMPb,\pgfmathresult}}% + \expandafter\pgfplotscolornormalizesequencenextbycomponents\pgfplots@loc@TMPc% +} + +\def\pgfplotscolornormalizesequencenext@c c{% + \pgfutil@ifnextchar m{% + \pgfplotscolornormalizesequencenext@cmyk + }{% + \pgfplotscolornormalizesequencenext@color + }% +}% + +\def\pgfplotscolornormalizesequencenext@cmyk myk{% + \pgfutil@ifnextchar2{% + \pgfplotscolornormalizesequencenext@cmyk@two@five@five + }{% + \pgfplotscolornormalizesequencenext@cmyk@plain + }% +}% + +\def\pgfplotscolornormalizesequencenext@cmyk@plain=#1\pgfplots@EOI{% + \pgfplotscolornormalizesequencenextbycomponents{cmyk}{#1}% +}% +\def\pgfplotscolornormalizesequencenext@cmyk@two@five@five255=#1,#2,#3,#4\pgfplots@EOI{% + \pgfplotscolorsequence@two@five@five@rescale{#1}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \pgfplotscolorsequence@two@five@five@rescale{#2}% + \let\pgfplots@loc@TMPb=\pgfmathresult + \pgfplotscolorsequence@two@five@five@rescale{#3}% + \let\pgfplots@loc@TMPc=\pgfmathresult + \pgfplotscolorsequence@two@five@five@rescale{#4}% + \edef\pgfplots@loc@TMPc{{cmyk}{\pgfplots@loc@TMPa,\pgfplots@loc@TMPb,\pgfplots@loc@TMPc,\pgfmathresult}}% + \expandafter\pgfplotscolornormalizesequencenextbycomponents\pgfplots@loc@TMPc% +} + +% The implementation of \pgfutil@extractcolorspec for plain tex and +% context is ... strange. I prefer one which does the same as the +% xcolor version (which is also what pgf does for latex): +\def\pgfplotsutil@extractcolorspec@xcolor@substitute#1#2{% + \begingroup + % this here relies on PGF's emulation of color in plain tex and + % context. Let's hope it works in the future... + \def\xcolor@##1##2##3##4{% + \edef#2{{##3}{##4}}% + }% + \csname\string\color@#1\endcsname + \global\let\pgfutil@extractcolorspec@@temp=#2% + \endgroup + \let#2=\pgfutil@extractcolorspec@@temp +}% + +\def\pgfplots@glob@TMPa#1#2{% + \def#2{{#1}}% +}% + +\pgfutil@IfUndefined{extractcolorspec}{% + % Ah. We do not have a suitable implementation of + % \extractcolorspec -- \pgfutil@extractcolorspec does not yield + % the colorspec on context and plain tex. + \def\pgfplotsutil@extractcolorspec{\pgfplotsutil@extractcolorspec@xcolor@substitute}% +}{% + \ifx\extractcolorspec\pgfplots@glob@TMPa + % Same problem as above: pgfutil-plain.def says + % \let\extractcolorspec=\pgfutil@extractcolorspec and that one + % is broken. + % Use my substitute: + \def\pgfplotsutil@extractcolorspec{\pgfplotsutil@extractcolorspec@xcolor@substitute}% + \else + \def\pgfplotsutil@extractcolorspec{\extractcolorspec}% + \fi +}% + +\def\pgfplotscolornormalizesequencenext@color olor=#1\pgfplots@EOI{% + \pgfutil@colorlet{pgf@tempcol}{#1}% + \pgfplotsutil@extractcolorspec{pgf@tempcol}{\pgf@tempcolor}% + \edef\pgfplots@loc@TMPa{\expandafter\pgfutil@firstoftwo\pgf@tempcolor}% + \edef\pgfplots@loc@TMPb{\expandafter\pgfutil@secondoftwo\pgf@tempcolor}% + % + % I expect that \pgf@tempcolor is of the form + % {<colorspace>}{<comma-separated components>} + % + % unfortunately, the <colorspace> has strange catcodes such that + % we cannot easily compare it by means of \ifx. I normalize it + % here: + \pgfutil@ifundefined{pgfplots@colspace@name@\pgfplots@loc@TMPa}{% + % ohoh. we cannot normalize the name. Let's hope that works out. + % note that we cannot throw an exception here as we might very well be able + % to convert the color to some suitable color space! + }{% + \edef\pgfplots@loc@TMPa{% + \csname pgfplots@colspace@name@\pgfplots@loc@TMPa\endcsname% + }% + }% + \edef\pgf@tempcolor{% + {\pgfplots@loc@TMPa}% + {\pgfplots@loc@TMPb}% + }% + \expandafter\pgfplotscolornormalizesequencenextbycomponents\pgf@tempcolor% + % +}% + +% Defines \pgfplotsretval to be a "neutral" color, i.e. one in which +% all components are zero. +% @see \pgfplotscolorzero +% @see \pgfplotscoloraddweighted +\def\pgfplotscolornormalizesequencezero{% + \pgfplotscolornormalizesequencegetnumcomponents + \pgfplotscolorzero{\pgfplotsretval}% +} + +% Defines \pgfplotsretval to be a "neutral" color, i.e. one in which +% all components are zero. +% +% #1: the number of color components to be used (like 3 for rgb) +% @see \pgfplotscoloraddweighted +\def\pgfplotscolorzero#1{% + \c@pgf@countb=#1\relax + % + \c@pgf@counta=1 % + \def\pgfplotsretval{0}% + \pgfutil@loop + \ifnum\c@pgf@counta<\c@pgf@countb + \edef\pgfplotsretval{\pgfplotsretval,0}% + \advance\c@pgf@counta by1 % + \pgfutil@repeat +}% + +% Defines \pgfplotsretval to be the interpolated color #1 + #2*#3. +% #1 the first color (like 0,0,0) +% #2 a scaling factor (like 4) +% #3 the second color (like 1,0,0.5) +% +% POSTCONDITION: \pgfplotsretval contains the result +% +% @see \pgfplotscolorzero +% @see \pgfplotscoloraddweighted +\def\pgfplotscolornormalizesequenceaddweighted#1#2#3{% + \begingroup + \pgfplotscolornormalizesequencegetnumcomponents + \global\let\pgfplots@glob@TMPd\pgfplotsretval + \endgroup + \pgfplotscoloraddweighted{\pgfplots@glob@TMPd}{#1}{#2}{#3}% +} + +% Defines \pgfplotsretval to be the interpolated color #2 + #3*#4. +% #1 the number of color components to be used (3 for rgb) +% #2 the first color (like 0,0,0) +% #3 a scaling factor (like 4) +% #4 the second color (like 1,0,0.5) +% +% POSTCONDITION: \pgfplotsretval contains the result +% +% @see \pgfplotscolorzero +\def\pgfplotscoloraddweighted#1#2#3#4{% + \begingroup + \expandafter\global + \expandafter\let + \expandafter\pgfplots@glob@TMPd\csname pgfplotscolornormalizesequencegetnumcomponents@#1\endcsname + \endgroup + \edef\pgfplots@loc@TMPa{#2:#4\noexpand\relax{#3}}% + \expandafter\pgfplots@glob@TMPd\pgfplots@loc@TMPa% +}% + +\def\pgfplotscolornormalizesequenceaddweighted@single#1#2#3{% + \pgf@xa=#1pt % + \pgf@xb=#3pt % + \advance\pgf@xa by#2\pgf@xb + \edef\pgfplotsretval{\pgf@sys@tonumber\pgf@xa}% +}% + +\expandafter\def\csname pgfplotscolornormalizesequencegetnumcomponents@1\endcsname#1:#2\relax#3{% + \pgfplotscolornormalizesequenceaddweighted@single{#1}{#3}{#2}% +}% +\expandafter\def\csname pgfplotscolornormalizesequencegetnumcomponents@3\endcsname#1,#2,#3:#4,#5,#6\relax#7{% + \pgfplotscolornormalizesequenceaddweighted@single{#1}{#7}{#4}% + \let\pgfplots@loc@TMPa=\pgfplotsretval + \pgfplotscolornormalizesequenceaddweighted@single{#2}{#7}{#5}% + \let\pgfplots@loc@TMPb=\pgfplotsretval + \pgfplotscolornormalizesequenceaddweighted@single{#3}{#7}{#6}% + \let\pgfplots@loc@TMPc=\pgfplotsretval + \edef\pgfplotsretval{\pgfplots@loc@TMPa,\pgfplots@loc@TMPb,\pgfplots@loc@TMPc}% +}% +\expandafter\def\csname pgfplotscolornormalizesequencegetnumcomponents@4\endcsname#1,#2,#3,#4:#5,#6,#7,#8\relax#9{% + \pgfplotscolornormalizesequenceaddweighted@single{#1}{#9}{#5}% + \let\pgfplots@loc@TMPa=\pgfplotsretval + \pgfplotscolornormalizesequenceaddweighted@single{#2}{#9}{#6}% + \let\pgfplots@loc@TMPb=\pgfplotsretval + \pgfplotscolornormalizesequenceaddweighted@single{#3}{#9}{#7}% + \let\pgfplots@loc@TMPc=\pgfplotsretval + \pgfplotscolornormalizesequenceaddweighted@single{#4}{#9}{#8}% + \let\pgfplots@loc@TMPd=\pgfplotsretval + \edef\pgfplotsretval{\pgfplots@loc@TMPa,\pgfplots@loc@TMPb,\pgfplots@loc@TMPc,\pgfplots@loc@TMPd}% +}% + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex index 838e0393e2e..4e369084a29 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex @@ -8,7 +8,7 @@ % % It is based on Till Tantau's PGF package. % -% Copyright 2007/2008 by Christian Feuersänger. +% Copyright 2007-2013 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 @@ -25,6 +25,8 @@ % %-------------------------------------------- +\input pgfplotscolor.code.tex + \pgfkeyssetvalue{/pgfplots/colormap default colorspace}{auto} % This package relies on pgfplots temporary registers and its array @@ -78,39 +80,19 @@ \expandafter\let\csname\pgfplots@createcolormap@name @h\endcsname=\pgfplots@createcolormap@H \pgfmathreciprocal@{\pgfplots@createcolormap@H}% \expandafter\let\csname\pgfplots@createcolormap@name @invh\endcsname=\pgfmathresult - \expandafter\let\csname\pgfplots@createcolormap@name @col@comps\endcsname=\pgfplots@createcolormap@col@comps - \expandafter\let\csname\pgfplots@createcolormap@name @colspace\endcsname=\pgfplots@createcolormap@colspace + % + \endpgfplotscolornormalizesequence% + \expandafter\let\csname\pgfplots@createcolormap@name @colspace\endcsname=\pgfplotsretval + \expandafter\let\csname\pgfplots@createcolormap@name @col@comps\endcsname=\pgfplotsretvalb %\pgfplots@colormap@showdebuginfofor{#1}% } + + \def\pgfplots@createcolormap@initcolorspace{% - \pgfkeysgetvalue{/pgfplots/colormap default colorspace}\pgfplots@loc@TMPa - \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}% - \def\pgfplots@loc@TMPb{auto}% - \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa - % colormap default colorspace=auto: same as empty. - \let\pgfplots@loc@TMPa=\pgfutil@empty - \fi - \ifx\pgfplots@loc@TMPa\pgfutil@empty - % colormap default colorspace=auto: - \def\pgfplots@createcolormap@col@comps{}% to be filled from first point - \def\pgfplots@createcolormap@colspace{}% - \else - \def\pgfplots@loc@TMPb{rgb}% - \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa - % colormap default colorspace=rgb: - \def\pgfplots@createcolormap@colspace{rgb}% - \def\pgfplots@createcolormap@col@comps{3}% - \else - \def\pgfplots@loc@TMPb{cmyk}% - \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa - % colormap default colorspace=cmyk: - \def\pgfplots@createcolormap@colspace{cmyk}% - \def\pgfplots@createcolormap@col@comps{4}% - \else - \pgfplots@error{Sorry, the choice 'colormap default colorspace=\pgfplots@loc@TMPa' is unknown to pgfplots, please use one of 'auto,rgb,cmyk'}% - \fi - \fi - \fi + \pgfplotscolornormalizesequence[ + colorspace=\pgfkeysvalueof{/pgfplots/colormap default colorspace}, + context message=\pgfplots@createcolormap@context, + ]% }% \def\pgfplots@createcolormap@seth[#1]{% \def\pgfplots@createcolormap@context{[#1]}% @@ -132,16 +114,9 @@ {% \pgfutil@ifnextchar;{\pgfplots@createcolormap@grabsemicolon}% {% - \pgfutil@ifnextchar r{\pgfplots@createcolormap@grabrgb}% + \expandafter\pgfutil@ifnextchar\pgfplots@activesemicolon{\pgfplots@createcolormap@grabsemicolon@active}% {% - \pgfutil@ifnextchar g{\pgfplots@createcolormap@grabgray}% - {% - \pgfutil@ifnextchar c{\pgfplots@createcolormap@grabc}% - { - \expandafter\pgfutil@ifnextchar\pgfplots@activesemicolon{\pgfplots@createcolormap@grabsemicolon@active}% - {\pgfplots@createcolormap@error}% - }% - }% + \pgfplots@createcolormap@grabnext }% }% }% @@ -153,230 +128,129 @@ \pgfplots@error{Illformed colormap specification: I could not read the substring `\the\t@pgfplots@toka' starting at `\the\t@pgfplots@tokb'}% }% }% -\def\pgfplots@createcolormap@grabsemicolon;{\pgfplots@createcolormap@}% -{ - \catcode`\;=13 - \gdef\pgfplots@createcolormap@grabsemicolon@active;{\pgfplots@createcolormap@}% +\def\pgfplots@createcolormap@grabnext#1({% + \pgfplots@createcolormap@grabnext@{#1}% } +\def\pgfplots@createcolormap@grabnext@#1#2){% + \pgfutil@in@={#1}% + \ifpgfutil@in@ + % Ah. we do not have a position, i.e. we have + % color=(green) + % or something like this. + % + % this here defines \pgfplots@loc@TMPa to contain the + % colorspace: + \pgfplots@createcolormap@grabnext@remove@equal@sign#1\pgfplots@EOI + % + \pgfplots@createcolormap@grabnext@computenextposition + \let\pgfplots@loc@TMPb=\pgfmathresult% posisiton + \def\pgfplots@loc@TMPc{#2}% color data + \let\pgfplots@loc@TMPd=\pgfplots@createcolormap@grabnext@complete + \else + % Ah. We have something like 'color(1cm)' and we did not see + % the equal sign so far. + \def\pgfplots@loc@TMPa{#1}% colorspace + \def\pgfplots@loc@TMPb{#2}% position + % + % and collect the color data: + \def\pgfplots@loc@TMPd{% + \pgfutil@ifnextchar={% + \pgfplots@createcolormap@grabnext@@ + }{% + \pgfplots@createcolormap@error#1(#2)% + }% + }% + \fi + \pgfplots@loc@TMPd +}% -\def\pgfplots@createcolormap@next{% - \pgfutil@ifnextchar({% - \pgfplots@createcolormap@next@ - }{% - % determine next step size automatically: - \ifx\pgfplots@createcolormap@H\pgfutil@empty - \expandafter\pgfplotsarraycheckempty\expandafter{\pgfplots@createcolormap@name}% - \ifpgfplotsarrayempty - % first: - \def\pgfmathresult{0sp}% - \else - % second: - \def\pgfmathresult{1cm}% - \fi - \else - % not first: - \pgfmathadd@\pgfplots@createcolormap@LAST\pgfplots@createcolormap@H - \fi - \expandafter\pgfplots@createcolormap@next@\expandafter(\pgfmathresult)% - }% +\def\pgfplots@createcolormap@grabnext@remove@equal@sign#1=#2\pgfplots@EOI{% + \def\pgfplots@loc@TMPa{#1}% + % + % FIXME : what if #2 is not empty!? }% -\def\pgfplots@createcolormap@grabrgb rgb{ - \pgfutil@ifnextchar2{% - \pgfplots@createcolormap@grabrgb@two@five@five +\def\pgfplots@createcolormap@grabnext@@={% + \pgfutil@ifnextchar({% + \pgfplots@createcolormap@grabnext@@@ }{% - \let\pgfplots@createcolormap@next@\pgfplots@createcolormap@grabrgb@ - \pgfplots@createcolormap@next + \pgfplots@createcolormap@error=% }% -} -\def\pgfplots@createcolormap@grabrgb@(#1)=(#2,#3,#4){% - \def\pgfplots@createcolormap@context{rgb(#1)=(#2,#3,#4)}% - \pgfplots@createcolormap@nextRGB{#1}{#2}{#3}{#4}% - \pgfplots@createcolormap@} -\def\pgfplots@createcolormap@grabrgb@two@five@five@rescale#1{% - \pgfmath@basic@multiply@{0.003921568}{#1}% }% -\def\pgfplots@createcolormap@grabrgb@two@five@five255{% - \let\pgfplots@createcolormap@next@\pgfplots@createcolormap@grabrgb@two@five@five@ - \pgfplots@createcolormap@next -} -\def\pgfplots@createcolormap@grabrgb@two@five@five@(#1)=(#2,#3,#4){% - \def\pgfplots@createcolormap@context{rgb255(#1)=(#2,#3,#4)}% - \pgfplots@createcolormap@grabrgb@two@five@five@rescale{#2}% - \let\pgfplots@loc@TMPa=\pgfmathresult - \pgfplots@createcolormap@grabrgb@two@five@five@rescale{#3}% - \let\pgfplots@loc@TMPb=\pgfmathresult - \pgfplots@createcolormap@grabrgb@two@five@five@rescale{#4}% - \def\pgfplots@loc@TMPc{\pgfplots@createcolormap@nextRGB{#1}}% - \edef\pgfplots@loc@TMPa{{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}{\pgfmathresult}}% - \expandafter\pgfplots@loc@TMPc\pgfplots@loc@TMPa - \pgfplots@createcolormap@} - - -\def\pgfplots@createcolormap@grabcmyk myk{ - \def\pgfplots@createcolormap@colspace@actual{cmyk}% - \def\pgfplots@createcolormap@col@comps@actual{4}% - \pgfutil@ifnextchar2{% - \pgfplots@createcolormap@grabcmyk@two@five@five - }{% - \let\pgfplots@createcolormap@next@\pgfplots@createcolormap@grabcmyk@ - \pgfplots@createcolormap@next - }% -} -\def\pgfplots@createcolormap@grabcmyk@(#1)=(#2,#3,#4,#5){% - \def\pgfplots@createcolormap@context{cmyk(#1)=(#2,#3,#4,#5)}% - \pgfplots@createcolormap@nextcolor{#1}{#2}{#3}{#4}{#5}% - \pgfplots@createcolormap@} -\def\pgfplots@createcolormap@grabcmyk@two@five@five255{% - \let\pgfplots@createcolormap@next@\pgfplots@createcolormap@grabcmyk@two@five@five@ - \pgfplots@createcolormap@next -} -\def\pgfplots@createcolormap@grabcmyk@two@five@five@(#1)=(#2,#3,#4,#5){% - \def\pgfplots@createcolormap@context{cmyk255(#1)=(#2,#3,#4,#5)}% - \pgfplots@createcolormap@grabcmyk@two@five@five@rescale{#2}% - \let\pgfplots@loc@TMPa=\pgfmathresult - \pgfplots@createcolormap@grabcmyk@two@five@five@rescale{#3}% - \let\pgfplots@loc@TMPb=\pgfmathresult - \pgfplots@createcolormap@grabcmyk@two@five@five@rescale{#4}% - \let\pgfplots@loc@TMPc=\pgfmathresult - \pgfplots@createcolormap@grabcmyk@two@five@five@rescale{#5}% - \def\pgfplots@loc@TMPd{\pgfplots@createcolormap@nextcolor{#1}}% - \edef\pgfplots@loc@TMPa{{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPc}{\pgfmathresult}}% - \expandafter\pgfplots@loc@TMPd\pgfplots@loc@TMPa - \pgfplots@createcolormap@} - - -\def\pgfplots@createcolormap@grabgray gray{% - \let\pgfplots@createcolormap@next@\pgfplots@createcolormap@grabgray@ - \pgfplots@createcolormap@next +\def\pgfplots@createcolormap@grabnext@@@(#1){% + \def\pgfplots@loc@TMPc{#1}% + \pgfplots@createcolormap@grabnext@complete }% -\def\pgfplots@createcolormap@grabgray@(#1)=(#2){% - \def\pgfplots@createcolormap@context{gray(#1)=(#2)}% - \pgfplots@createcolormap@nextRGB{#1}{#2}{#2}{#2}% - \pgfplots@createcolormap@} - -\def\pgfplots@createcolormap@grabc c{% - \pgfutil@ifnextchar m{% - \pgfplots@createcolormap@grabcmyk - }{% - \pgfplots@createcolormap@grabcolor + +\def\pgfplots@createcolormap@grabnext@complete{% + \edef\pgfplots@loc@TMPa{% + {\pgfplots@loc@TMPb}% position + {% + \pgfplots@loc@TMPa% colorspace + =\pgfplots@loc@TMPc% color data + }% }% -}% -\def\pgfplots@createcolormap@grabcolor olor{% - \let\pgfplots@createcolormap@next@\pgfplots@createcolormap@grabcolor@ - \pgfplots@createcolormap@next -}% -\def\pgfplots@createcolormap@grabcolor@(#1)=(#2){% - \def\pgfplots@createcolormap@context{color(#1)=(#2)}% - \pgfutil@colorlet{pgf@tempcol}{#2}% - \pgfutil@extractcolorspec{pgf@tempcol}{\pgf@tempcolor}% - \ifx\pgfplots@createcolormap@colspace\pgfutil@empty - % This here is mainly for backwards compatibility... in older - % versions, rgb was the only choice. This should still work - % unless overruled explicitly. - \def\pgfplots@createcolormap@colspace{rgb}% - \def\pgfplots@createcolormap@col@comps{3}% - \fi - % convert the colorspace (if needed): - \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{\pgfplots@createcolormap@colspace}{\pgf@rgbcolor}% - % - \let\pgfplots@createcolormap@colspace@actual=\pgfplots@createcolormap@colspace - \let\pgfplots@createcolormap@col@comps@actual=\pgfplots@createcolormap@col@comps + \expandafter\pgfplots@createcolormap@nextcolor\pgfplots@loc@TMPa % - \if4\pgfplots@createcolormap@col@comps - \let\pgfplots@loc@TMPa=\pgfplots@createcolormap@grabcolor@@@ + % continue loop: + \pgfplots@createcolormap@ +}% + +\def\pgfplots@createcolormap@grabnext@computenextposition{% + % determine next step size automatically: + \expandafter\pgfplotsarraycheckempty\expandafter{\pgfplots@createcolormap@name}% + \ifpgfplotsarrayempty + % first: must be at 0. + \def\pgfmathresult{0sp}% \else - \let\pgfplots@loc@TMPa=\pgfplots@createcolormap@grabcolor@@ + % not first: + \ifx\pgfplots@createcolormap@H\pgfutil@empty + % ah; we really have to deduce something. We are at the + % second node: + \def\pgfmathresult{1cm}% + \else + \pgfmathadd@\pgfplots@createcolormap@LAST\pgfplots@createcolormap@H + \fi \fi - \expandafter\pgfplots@loc@TMPa\pgf@rgbcolor\relax{#1}% -}% -\def\pgfplots@createcolormap@grabcolor@@#1,#2,#3\relax#4{% - \pgfplots@createcolormap@nextRGB{#4}{#1}{#2}{#3}% - \pgfplots@createcolormap@} -\def\pgfplots@createcolormap@grabcolor@@@#1,#2,#3,#4\relax#5{% - \pgfplots@createcolormap@nextcolor{#5}{#1}{#2}{#3}{#4}% - \pgfplots@createcolormap@} - -\def\pgfplots@createcolormap@rgbrangeexception#1#2#3{% - \pgfplots@error{Sorry, RGB[#1,#2,#3] is not supported. The allowed range is 0 <= r,g,b <= 1. The error occured near `\pgfplots@createcolormap@context'}% }% -\def\pgfplots@createcolormap@rangeexception#1#2{% - \pgfplots@error{Sorry, the color component at index #1 (value #2) is out of range. The allowed range is 0 <= value <= 1. The error occured near `\pgfplots@createcolormap@context'}% + +\def\pgfplots@createcolormap@grabsemicolon;{\pgfplots@createcolormap@}% + +{ + \catcode`\;=13 + \gdef\pgfplots@createcolormap@grabsemicolon@active;{\pgfplots@createcolormap@}% } -% Ok, we parsed the next single spec. -% #1: the width -% #2,#3,#4 RGB values. -\def\pgfplots@createcolormap@nextRGB#1#2#3#4{% - \def\pgfplots@createcolormap@colspace@actual{rgb}% - \def\pgfplots@createcolormap@col@comps@actual{3}% - \pgfplots@createcolormap@nextcolor{#1}{#2}{#3}{#4}{}% +\def\pgfplots@createcolormap@nextcolor@tostring#1=#2\pgfplots@EOI#3{% + #1(#3)=(#2)% }% % #1: h -% #2...#5: the color components (at least 3 non-empty, can be 4). -\def\pgfplots@createcolormap@nextcolor#1#2#3#4#5{% - \ifdim#2pt<0pt - \pgfplots@createcolormap@rangeexception0{#2}% - \fi - \ifdim#3pt<0pt - \pgfplots@createcolormap@rangeexception1{#3}% - \fi - \ifdim#4pt<0pt - \pgfplots@createcolormap@rangeexception2{#4}% - \fi - \ifdim#2pt>1pt - \pgfplots@createcolormap@rangeexception0{#2}% - \fi - \ifdim#3pt>1pt - \pgfplots@createcolormap@rangeexception1{#3}% - \fi - \ifdim#4pt>1pt - \pgfplots@createcolormap@rangeexception2{#4}% - \fi - \if4\pgfplots@createcolormap@col@comps@actual - \ifdim#5pt<0pt - \pgfplots@createcolormap@rangeexception3{#5}% - \fi - \ifdim#5pt>1pt - \pgfplots@createcolormap@rangeexception3{#5}% - \fi - \fi - \def\pgfplots@loc@TMPb{\pgfplots@createcolormap@nextcolor@{#1}{#2}{#3}{#4}{#5}}% - \ifx\pgfplots@createcolormap@colspace@actual\pgfplots@createcolormap@colspace - \else - \ifx\pgfplots@createcolormap@colspace\pgfutil@empty - \let\pgfplots@createcolormap@colspace=\pgfplots@createcolormap@colspace@actual - \let\pgfplots@createcolormap@col@comps=\pgfplots@createcolormap@col@comps@actual - \else - % Oh. We need to convert the color space! - \edef\pgfplots@loc@TMPa{{\pgfplots@createcolormap@colspace@actual}{#2,#3,#4\if4\pgfplots@createcolormap@col@comps@actual,#5\fi}}% - \expandafter\pgfutil@convertcolorspec\pgfplots@loc@TMPa{\pgfplots@createcolormap@colspace}{\pgfplots@loc@TMPa}% - % invoke - % \pgfplots@createcolormap@nextcolor@{#1}{C1}{C2}{C3}{C4}. - % We need to compute C1 ... C4 : - \def\pgf@colmarshal{{#1}}% - \expandafter\pgf@uncomma\pgfplots@loc@TMPa,,% - \if4\pgfplots@createcolormap@col@comps - \else - % ok, we have C4={}. Append it: - \edef\pgf@colmarshal{\pgf@colmarshal{}}% - \fi - \def\pgfplots@loc@TMPb{\expandafter\pgfplots@createcolormap@nextcolor@\pgf@colmarshal}% - \fi - \fi - \pgfplots@loc@TMPb +% #2: a compound element of the form +% '<colorspace>=<comma-separated-color-components>' +% The format is chosen such that it can be forwarded directly to +% \pgfplotscolornormalizesequencenext +% +% see \pgfplotscolornormalizesequencenext for details +\def\pgfplots@createcolormap@nextcolor#1#2{% + \def\pgfplots@createcolormap@context{\pgfplots@createcolormap@nextcolor@tostring#2\pgfplots@EOI{#1}}% + % + \pgfplotscolornormalizesequencenext{#2}% + \let\pgfplots@createcolormap@col@comps=\pgfplotsretvalb + % + \edef\pgfplots@loc@TMPa{{#1}{\pgfplotsretval}}% + \expandafter\pgfplots@createcolormap@nextcolor@\pgfplots@loc@TMPa% }% -\def\pgfplots@createcolormap@nextcolor@#1#2#3#4#5{% -%\message{processing color #1=(#2,#3,#4,#5) with \pgfplots@createcolormap@col@comps@actual\space components^^J}% +\def\pgfplots@createcolormap@nextcolor@#1#2{% +%\message{processing color #1=(#2)^^J}% % compute 'h': \pgfmathparse{#1}% \let\pgfplots@createcolormap@MAX=\pgfmathresult \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@createcolormap@LAST}% - \let\pgfplots@createcolormap@LAST=\pgfplots@createcolormap@MAX \let\pgfplots@createcolormap@H@cur=\pgfmathresult -%\message{found current diff = \pgfplots@createcolormap@H@cur\ ( from #1 - \pgfplots@createcolormap@LAST pt)}% +%\message{found current diff = \pgfplots@createcolormap@H@cur\ ( from \pgfplots@createcolormap@MAX pt - \pgfplots@createcolormap@LAST pt)^^J}% + \let\pgfplots@createcolormap@LAST=\pgfplots@createcolormap@MAX \ifx\pgfplots@createcolormap@H\pgfutil@empty \expandafter\pgfplotsarraycheckempty\expandafter{\pgfplots@createcolormap@name}% \ifpgfplotsarrayempty @@ -406,30 +280,35 @@ \ifx\pgfmathresult\pgfutil@empty % I can't do that yet. \else - \let\pgfplots@loc@TMPb=\pgfmathresult + \let\pgfplots@createcolormap@loop@end=\pgfmathresult % interpolate missing values using the already fixed H. % This interpolation procedure is stupid because it works % only in forward direction - but it works at least. % For the backwards direction, you can provide the % meshwidth explicitly at % \pgfplotscreatecolormap{}{[1pt]} - \pgfplotsforeachungrouped \c@pgfplots@createcolormap in {1,2,...,\pgfplots@loc@TMPb} {% - \ifdim\c@pgfplots@createcolormap pt=\pgfplots@loc@TMPb pt + \pgfplotsforeachungrouped \c@pgfplots@createcolormap in {1,2,...,\pgfplots@createcolormap@loop@end} {% + \ifdim\c@pgfplots@createcolormap pt=\pgfplots@createcolormap@loop@end pt % % omit the last. \else - \pgfmathparse{\pgfplots@createcolormap@lastA + \c@pgfplots@createcolormap/\pgfplots@loc@TMPb * ( #2 - \pgfplots@createcolormap@lastA )}% - \let\pgfplots@createcolormap@nextA=\pgfmathresult - \pgfmathparse{\pgfplots@createcolormap@lastB + \c@pgfplots@createcolormap/\pgfplots@loc@TMPb * ( #3 - \pgfplots@createcolormap@lastB )}% - \let\pgfplots@createcolormap@nextB=\pgfmathresult - \pgfmathparse{\pgfplots@createcolormap@lastC + \c@pgfplots@createcolormap/\pgfplots@loc@TMPb * ( #4 - \pgfplots@createcolormap@lastC )}% - \let\pgfplots@createcolormap@nextC=\pgfmathresult - \if4\pgfplots@createcolormap@col@comps - \pgfmathparse{\pgfplots@createcolormap@lastD + \c@pgfplots@createcolormap/\pgfplots@loc@TMPb * ( #4 - \pgfplots@createcolormap@lastD )}% - \let\pgfplots@createcolormap@nextD=\pgfmathresult - \fi + \pgfmathparse{\c@pgfplots@createcolormap/\pgfplots@createcolormap@loop@end}% + \let\pgfplots@createcolormap@scale@current=\pgfmathresult + \pgfmathparse{1-\pgfplots@createcolormap@scale@current}% + \let\pgfplots@createcolormap@scale@last=\pgfmathresult + % + \pgfplotscolornormalizesequencezero + \pgfplotscolornormalizesequenceaddweighted + {\pgfplotsretval} + {\pgfplots@createcolormap@scale@current} + {#2}% + \pgfplotscolornormalizesequenceaddweighted + {\pgfplotsretval} + {\pgfplots@createcolormap@scale@last} + {\pgfplots@createcolormap@last}% % +%\message{interpolation step \c@pgfplots@createcolormap = \pgfplotsretval^^J}% \edef\pgfplots@loc@TMPa{% - \noexpand\pgfplotsarraypushback{\pgfplots@createcolormap@nextA,\pgfplots@createcolormap@nextB,\pgfplots@createcolormap@nextC\if4\pgfplots@createcolormap@col@comps,\pgfplots@createcolormap@nextD\fi}% + \noexpand\pgfplotsarraypushback{\pgfplotsretval}% \noexpand\to}% \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@createcolormap@name}% \fi @@ -437,12 +316,9 @@ \fi \fi \fi - \edef\pgfplots@loc@TMPa{\noexpand\pgfplotsarraypushback{#2,#3,#4\if4\pgfplots@createcolormap@col@comps,#5\fi}\noexpand\to}% + \edef\pgfplots@loc@TMPa{\noexpand\pgfplotsarraypushback{#2}\noexpand\to}% \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@createcolormap@name}% - \edef\pgfplots@createcolormap@lastA{#2}% - \edef\pgfplots@createcolormap@lastB{#3}% - \edef\pgfplots@createcolormap@lastC{#4}% - \edef\pgfplots@createcolormap@lastD{#5}% + \edef\pgfplots@createcolormap@last{#2}% }% \def\pgfplots@createcolormap@nextRGB@consider@reinterpolation#1\relax{% \pgf@xa=#1pt @@ -488,6 +364,21 @@ \endgroup } +% Defines \pgfplotsretval to contain the mesh width of colormap #1 +\def\pgfplotscolormapgetmeshwidth#1{% + \expandafter\let\expandafter\pgfplotsretval\csname pgfpl@cm@#1@h\endcsname% +}% + +% defines macro #2 to contain a serialized variant of the color +% components (only the color components!) +\def\pgfplotscolormapserializecomponentstomacro#1#2{% + \pgfplotsapplistXnewempty\pgfplots@serialize@list@ + \pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\elem{% + \expandafter\pgfplotsapplistXpushback\expandafter{\elem},\to\pgfplots@serialize@list@ + }% + \pgfplotsapplistXlet#2=\pgfplots@serialize@list@ +}% + % Copies the contents of the colormap named '#1' into a macro '#2'. % Invocation of the macro will then re-create the colormap. % @@ -495,11 +386,7 @@ % #2: a macro name \def\pgfplotscolormapserializetomacro#1#2{% \begingroup - \pgfplotsapplistXnewempty\pgfplots@serialize@list@ - \pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\elem{% - \expandafter\pgfplotsapplistXpushback\expandafter{\elem},\to\pgfplots@serialize@list@ - }% - \pgfplotsapplistXlet\pgfplots@serialize@list=\pgfplots@serialize@list@ + \pgfplotscolormapserializecomponentstomacro{#1}\pgfplots@serialize@list \toks0={\expandafter\def\csname pgfpl@cm@#1@h\endcsname}% \toks1={\expandafter\def\csname pgfpl@cm@#1@invh\endcsname}% \toks2={% @@ -552,12 +439,16 @@ \def\pgfplots@loc@TMPa{}% \def\pgfplots@loc@TMPb{}% \def\pgfplots@loc@TMPc{}% + \ifnum\csname pgfpl@cm@#1@col@comps\endcsname>4 + \pgfplots@error{Sorry, processing more than 4 color components (as required for color map #1) is unsupported in this context}% + \fi \pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\cdata{% - \if4\csname pgfpl@cm@#1@col@comps\endcsname - \edef\cdata{\expandafter\pgfplotscolormaptopdffunction@convertcdata@four\cdata\relax}% - \else - \edef\cdata{\expandafter\pgfplotscolormaptopdffunction@convertcdata\cdata\relax}% - \fi + \edef\cdata{% + \expandafter + \expandafter + \csname pgfplotscolormaptopdffunction@convertcdata@\csname pgfpl@cm@#1@col@comps\endcsname\endcsname + \cdata\relax + }% \ifnum\c@pgf@counta>0 \t@pgfplots@toka=\expandafter{\pgfplotsretval}% \xdef\pgfplotsretval{% @@ -589,8 +480,10 @@ }% \endgroup }% -\def\pgfplotscolormaptopdffunction@convertcdata#1,#2,#3\relax{#1 #2 #3}% -\def\pgfplotscolormaptopdffunction@convertcdata@four#1,#2,#3,#4\relax{#1 #2 #3 #4}% +\expandafter\def\csname pgfplotscolormaptopdffunction@convertcdata@1\endcsname#1\relax{#1}% +\expandafter\def\csname pgfplotscolormaptopdffunction@convertcdata@2\endcsname#1,#2\relax{#1 #2}% +\expandafter\def\csname pgfplotscolormaptopdffunction@convertcdata@3\endcsname#1,#2,#3\relax{#1 #2 #3}% +\expandafter\def\csname pgfplotscolormaptopdffunction@convertcdata@4\endcsname#1,#2,#3,#4\relax{#1 #2 #3 #4}% % Invokes '#2' if a color map named '#1' exists and '#3' if no such color map exists. \def\pgfplotscolormapifdefined#1#2#3{\pgfplotsarrayifdefined{pgfpl@cm@#1}{#2}{#3}}% @@ -639,7 +532,7 @@ \else \pgfutil@ifundefined{pgfpl@cm@#1@warned}{% \expandafter\gdef\csname pgfpl@cm@#1@warned\endcsname{1}% - \pgfplots@warning{I am about to convert colormap '#1' from \pgfplots@colspace\space to rgb (which might be lossy). Perhaps the choice 'colorbar sampled={surf,shader=interp}' yields better results since it supports \pgfplots@colspace.}% + \pgfplotswarning{lossy colormap rgb conversion}{#1}{\pgfplots@colspace}\pgfeov% }{% }% \edef\pgf@tempcolor{{\pgfplots@colspace}{\pgfplotscolormaptoshadingspec@TMP}}% @@ -752,6 +645,8 @@ \expandafter\pgfplots@discardperiod\pgfmathresult\relax \pgfmathsubtract@{\pgfplotscolormapfind@transformedx@divh}{\pgfplotscolormapfind@intervalno}% \let\pgfplots@loc@factor=\pgfmathresult + \pgfmathsubtract@{1}{\pgfplots@loc@factor}% + \let\pgfplots@loc@factor@two=\pgfmathresult %\message{mapping [#1,#2] -> [0,\pgfplotscolormaprange] yielded phi(#4) = \pgfplotscolormapfind@transformedx, situated in interval no \pgfplotscolormapfind@intervalno.}% % Step 2: interpolate the desired RGB value using vector valued % interpolation on the identified interval. @@ -760,53 +655,30 @@ \advance\c@pgf@counta by1 \pgfplotsarrayselect\c@pgf@counta\of{pgfpl@cm@#5}\to\pgfplotscolormapfind@rgb@RIGHT %\message{After lookup: the corresponding RGB interval boundaries are [\pgfplotscolormapfind@rgb@LEFT: \pgfplotscolormapfind@rgb@RIGHT].}% - \edef\pgfplots@loc@TMPa{\pgfplotscolormapfind@rgb@LEFT:\pgfplotscolormapfind@rgb@RIGHT}% - \if4\csname pgfpl@cm@#5@col@comps\endcsname - \expandafter\pgfplotscolormapfind@interpolate@four\pgfplots@loc@TMPa\relax - \else - \expandafter\pgfplotscolormapfind@interpolate\pgfplots@loc@TMPa\relax - \fi + % + % + % color^m(x) = ( x/h - i ) * ( c_{i+1}^m - c_{i}^m ) + c_i^m + % = s * c_{i+1}^m + S * c_i^m + % + % s= x_h / h -i + % S = 1 - s + \pgfplotscolorzero{\csname pgfpl@cm@#5@col@comps\endcsname}% + \pgfplotscoloraddweighted + {\csname pgfpl@cm@#5@col@comps\endcsname} + {\pgfplotsretval}% + {\pgfplots@loc@factor@two}% + {\pgfplotscolormapfind@rgb@LEFT}% + \pgfplotscoloraddweighted + {\csname pgfpl@cm@#5@col@comps\endcsname} + {\pgfplotsretval}% + {\pgfplots@loc@factor}% + {\pgfplotscolormapfind@rgb@RIGHT}% + \let\pgfmathresult=\pgfplotsretval \pgfmath@smuggleone\pgfmathresult \endgroup %\message{-> got finally mapping(#4, #5) = RGB'\pgfmathresult'.}% }% -% internal helper method which computes -% -% color^m(x) = ( x/h - i ) * ( c_{i+1}^m - c_{i}^m ) + c_i^m -% for each m in {red,green,blue} and defines \pgfmathresult to be -% 'R,G,B' , the single results. -\def\pgfplotscolormapfind@interpolate#1,#2,#3:#4,#5,#6\relax{% - % R: - \pgfmathsubtract@{#4}{#1}% - \let\pgfplotscolormapfind@Cdiff=\pgfmathresult - \pgfmathmultiply@{\pgfplots@loc@factor}{\pgfplotscolormapfind@Cdiff}% - \expandafter\pgfmathadd@\expandafter{\pgfmathresult}{#1}% - \let\RED=\pgfmathresult - % G: - \pgfmathsubtract@{#5}{#2}% - \let\pgfplotscolormapfind@Cdiff=\pgfmathresult - \pgfmathmultiply@{\pgfplots@loc@factor}{\pgfplotscolormapfind@Cdiff}% - \expandafter\pgfmathadd@\expandafter{\pgfmathresult}{#2}% - \let\GREEN=\pgfmathresult - % B: - \pgfmathsubtract@{#6}{#3}% - \let\pgfplotscolormapfind@Cdiff=\pgfmathresult - \pgfmathmultiply@{\pgfplots@loc@factor}{\pgfplotscolormapfind@Cdiff}% - \expandafter\pgfmathadd@\expandafter{\pgfmathresult}{#3}% - \let\BLUE=\pgfmathresult - \edef\pgfmathresult{\RED,\GREEN,\BLUE}% -}% -\def\pgfplotscolormapfind@interpolate@four#1,#2,#3,#4:#5,#6,#7,#8\relax{% - \pgfplotscolormapfind@interpolate#1,#2,#3:#5,#6,#7\relax - \let\CMY=\pgfmathresult - \pgfmathsubtract@{#8}{#4}% - \let\pgfplotscolormapfind@Cdiff=\pgfmathresult - \pgfmathmultiply@{\pgfplots@loc@factor}{\pgfplotscolormapfind@Cdiff}% - \expandafter\pgfmathadd@\expandafter{\pgfmathresult}{#4}% - \let\K=\pgfmathresult - \edef\pgfmathresult{\CMY,\K}% -} % Performs a direct color access into color map '#2' using an index % '#1'. @@ -856,8 +728,10 @@ \pgfutil@definecolor{mapped color}{rgb}{0,0,0}% make sure this color exists. It will be overwritten if needed. +% ATTENTION: replicated in pgfplots.code.tex : \pgfplotscreatecolormap{hot}{color(0cm)=(blue); color(1cm)=(yellow); color(2cm)=(orange); color(3cm)=(red)} +\def\pgfplotspointmetatransformedrange{0:1000} % Defines the 'mapped color' on the basis of % the current color map. diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex index 0ef2cb01c8d..57cc47873dd 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex @@ -1131,11 +1131,21 @@ }{% \pgfplotscoordmath{#5}{op}{divide}{{\pgfplots@x}{\pgfplots@r}}% \let\pgfplots@quot=\pgfmathresult + % + \pgfplotscoordmath{#5}{one}% + \let\pgfplots@loc@TMPc=\pgfmathresult + \pgfplotscoordmath{#5}{min}{\pgfplots@quot}{\pgfplots@loc@TMPc}% + \let\pgfplots@quot=\pgfmathresult + \pgfplotscoordmath{#5}{-one}% + \let\pgfplots@loc@TMPc=\pgfmathresult + \pgfplotscoordmath{#5}{max}{\pgfplots@quot}{\pgfplots@loc@TMPc}% + \let\pgfplots@quot=\pgfmathresult + % \pgfplotscoordmath{#5}{op}{acos}{{\pgfplots@quot}}% % \pgfplotscoordmath{#5}{if is}{\pgfplots@y}{-}{% \let\pgfplots@acos=\pgfmathresult - \pgfplotscoordmath{#5}{parsenumber}{-1}% + \pgfplotscoordmath{#5}{-one}% \pgfplotscoordmath{#5}{op}{multiply}{{\pgfmathresult}{\pgfplots@acos}}% }{}% }% @@ -1976,7 +1986,7 @@ \catcode`\%=12 \gdef\pgfplotsPERCENT{%}} \pgfutil@IfUndefined{directlua}{}{% - \directlua{require(\pgfplotsDQ pgfplots.lua\pgfplotsDQ)}% + \directlua{require(\pgfplotsDQ pgfplots\pgfplotsDQ)}% }% % swaps the content of two macros |