summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/util
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-08-01 00:47:16 +0000
committerKarl Berry <karl@freefriends.org>2011-08-01 00:47:16 +0000
commitaec2bbc3994991ebc6c5f4dbc90ad15c55f1a1fb (patch)
tree8940f33f6b173fb5cc630cc58ed4b791ad29e3fe /Master/texmf-dist/tex/generic/pgfplots/util
parent868233e6288b5e35a7d7aabd79bf8e56a802bc12 (diff)
pgfplots 1.5 (29jul11)
git-svn-id: svn://tug.org/texlive/trunk@23292 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/util')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex286
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex320
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.verb.code.tex97
3 files changed, 625 insertions, 78 deletions
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 b1496a8fc1b..838e0393e2e 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex
@@ -25,6 +25,8 @@
%
%--------------------------------------------
+\pgfkeyssetvalue{/pgfplots/colormap default colorspace}{auto}
+
% This package relies on pgfplots temporary registers and its array
% data structure.
@@ -53,6 +55,7 @@
\expandafter\pgfplotsarraynewempty\expandafter{\pgfplots@createcolormap@name}%
\def\pgfplots@createcolormap@MIN{0}% NORMALIZATION: assume that lower-end is 0pt.
\def\pgfplots@createcolormap@MAX{0}% To be computed.
+ \pgfplots@createcolormap@initcolorspace
\let\pgfplots@createcolormap@LAST=\pgfplots@createcolormap@MIN
% PARSE IT:
\edef\pgfplots@loc@TMPa{#2}%
@@ -75,8 +78,40 @@
\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
%\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
+}%
\def\pgfplots@createcolormap@seth[#1]{%
\def\pgfplots@createcolormap@context{[#1]}%
\pgfmathparse{#1}%
@@ -101,7 +136,7 @@
{%
\pgfutil@ifnextchar g{\pgfplots@createcolormap@grabgray}%
{%
- \pgfutil@ifnextchar c{\pgfplots@createcolormap@grabcolor}%
+ \pgfutil@ifnextchar c{\pgfplots@createcolormap@grabc}%
{
\expandafter\pgfutil@ifnextchar\pgfplots@activesemicolon{\pgfplots@createcolormap@grabsemicolon@active}%
{\pgfplots@createcolormap@error}%
@@ -177,6 +212,41 @@
\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
@@ -185,7 +255,15 @@
\def\pgfplots@createcolormap@context{gray(#1)=(#2)}%
\pgfplots@createcolormap@nextRGB{#1}{#2}{#2}{#2}%
\pgfplots@createcolormap@}
-\def\pgfplots@createcolormap@grabcolor color{%
+
+\def\pgfplots@createcolormap@grabc c{%
+ \pgfutil@ifnextchar m{%
+ \pgfplots@createcolormap@grabcmyk
+ }{%
+ \pgfplots@createcolormap@grabcolor
+ }%
+}%
+\def\pgfplots@createcolormap@grabcolor olor{%
\let\pgfplots@createcolormap@next@\pgfplots@createcolormap@grabcolor@
\pgfplots@createcolormap@next
}%
@@ -193,36 +271,105 @@
\def\pgfplots@createcolormap@context{color(#1)=(#2)}%
\pgfutil@colorlet{pgf@tempcol}{#2}%
\pgfutil@extractcolorspec{pgf@tempcol}{\pgf@tempcolor}%
- \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}%
- \expandafter\pgfplots@createcolormap@grabcolor@@\pgf@rgbcolor\relax{#1}}%
+ \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
+ %
+ \if4\pgfplots@createcolormap@col@comps
+ \let\pgfplots@loc@TMPa=\pgfplots@createcolormap@grabcolor@@@
+ \else
+ \let\pgfplots@loc@TMPa=\pgfplots@createcolormap@grabcolor@@
+ \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'}%
+}
+
% 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}{}%
+}%
+
+% #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@rgbrangeexception{#2}{#3}{#4}%
+ \pgfplots@createcolormap@rangeexception0{#2}%
\fi
\ifdim#3pt<0pt
- \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}%
+ \pgfplots@createcolormap@rangeexception1{#3}%
\fi
\ifdim#4pt<0pt
- \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}%
+ \pgfplots@createcolormap@rangeexception2{#4}%
\fi
\ifdim#2pt>1pt
- \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}%
+ \pgfplots@createcolormap@rangeexception0{#2}%
\fi
\ifdim#3pt>1pt
- \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}%
+ \pgfplots@createcolormap@rangeexception1{#3}%
\fi
\ifdim#4pt>1pt
- \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}%
+ \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
+}%
+\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}%
% compute 'h':
\pgfmathparse{#1}%
\let\pgfplots@createcolormap@MAX=\pgfmathresult
@@ -270,14 +417,19 @@
\ifdim\c@pgfplots@createcolormap pt=\pgfplots@loc@TMPb pt
% omit the last.
\else
- \pgfmathparse{\pgfplots@createcolormap@lastR + \c@pgfplots@createcolormap/\pgfplots@loc@TMPb * ( #2 - \pgfplots@createcolormap@lastR )}%
- \let\pgfplots@createcolormap@nextR=\pgfmathresult
- \pgfmathparse{\pgfplots@createcolormap@lastG + \c@pgfplots@createcolormap/\pgfplots@loc@TMPb * ( #3 - \pgfplots@createcolormap@lastG )}%
- \let\pgfplots@createcolormap@nextG=\pgfmathresult
- \pgfmathparse{\pgfplots@createcolormap@lastB + \c@pgfplots@createcolormap/\pgfplots@loc@TMPb * ( #4 - \pgfplots@createcolormap@lastB )}%
+ \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
%
\edef\pgfplots@loc@TMPa{%
- \noexpand\pgfplotsarraypushback{\pgfplots@createcolormap@nextR,\pgfplots@createcolormap@nextG,\pgfmathresult}%
+ \noexpand\pgfplotsarraypushback{\pgfplots@createcolormap@nextA,\pgfplots@createcolormap@nextB,\pgfplots@createcolormap@nextC\if4\pgfplots@createcolormap@col@comps,\pgfplots@createcolormap@nextD\fi}%
\noexpand\to}%
\expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@createcolormap@name}%
\fi
@@ -285,11 +437,12 @@
\fi
\fi
\fi
- \def\pgfplots@loc@TMPa{\pgfplotsarraypushback{#2,#3,#4}\to}%
+ \edef\pgfplots@loc@TMPa{\noexpand\pgfplotsarraypushback{#2,#3,#4\if4\pgfplots@createcolormap@col@comps,#5\fi}\noexpand\to}%
\expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@createcolormap@name}%
- \edef\pgfplots@createcolormap@lastR{#2}%
- \edef\pgfplots@createcolormap@lastG{#3}%
- \edef\pgfplots@createcolormap@lastB{#4}%
+ \edef\pgfplots@createcolormap@lastA{#2}%
+ \edef\pgfplots@createcolormap@lastB{#3}%
+ \edef\pgfplots@createcolormap@lastC{#4}%
+ \edef\pgfplots@createcolormap@lastD{#5}%
}%
\def\pgfplots@createcolormap@nextRGB@consider@reinterpolation#1\relax{%
\pgf@xa=#1pt
@@ -318,19 +471,20 @@
% Shows debug info about colormap #1 into the console.
\def\pgfplots@colormap@showdebuginfofor#1{%
- \message{Debug info for color map '#1':}%
- \message{(Transformed) Range: [0:\pgfplotscolormaprange]; }%
- \message{H: \csname pgfpl@cm@#1@h\endcsname; }%
- \message{H:^{-1}: \csname pgfpl@cm@#1@invh\endcsname; }%
+ \message{Debug info for color map '#1':^^J}%
+ \message{(Transformed) Range: [0:\pgfplotscolormaprange]; ^^J}%
+ \message{H: \csname pgfpl@cm@#1@h\endcsname; ^^J}%
+ \message{H:^{-1}: \csname pgfpl@cm@#1@invh\endcsname; ^^J}%
\pgfplotsarraysizetomacro{pgfpl@cm@#1}\to\pgfplots@loc@TMPa
- \message{Size: \pgfplots@loc@TMPa; }%
- \message{RGB Values: }%
+ \message{Size: \pgfplots@loc@TMPa; ^^J}%
+ \message{Colorspace: \csname pgfpl@cm@#1@colspace\endcsname^^JValues (\csname pgfpl@cm@#1@col@comps\endcsname\space components each): ^^J}%
\begingroup
\c@pgf@counta=0
\pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\elem{%
\message{\#\the\c@pgf@counta: \elem; }%
\advance\c@pgf@counta by1
}%
+ \message{^^J}%
\endgroup
}
@@ -358,11 +512,15 @@
}%
}%
\toks3=\expandafter{\pgfplots@serialize@list}%
+ \toks4=\expandafter{\expandafter\def\csname pgfpl@cm@#1@colspace\endcsname}%
+ \toks5=\expandafter{\expandafter\def\csname pgfpl@cm@#1@col@comps\endcsname}%
\xdef\pgfplots@glob@TMPa{%
\the\toks0 {\csname pgfpl@cm@#1@h\endcsname}%
\the\toks1 {\csname pgfpl@cm@#1@invh\endcsname}%
\noexpand\def\noexpand\pgfplots@loc@TMPa{\the\toks3 }%
\the\toks2
+ \the\toks4 {\csname pgfpl@cm@#1@colspace\endcsname}%
+ \the\toks5 {\csname pgfpl@cm@#1@col@comps\endcsname}%
}%
\endgroup
\let#2=\pgfplots@glob@TMPa
@@ -395,7 +553,11 @@
\def\pgfplots@loc@TMPb{}%
\def\pgfplots@loc@TMPc{}%
\pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\cdata{%
- \edef\cdata{\expandafter\pgfplotscolormaptopdffunction@convertcdata\cdata\relax}%
+ \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
\ifnum\c@pgf@counta>0
\t@pgfplots@toka=\expandafter{\pgfplotsretval}%
\xdef\pgfplotsretval{%
@@ -428,6 +590,7 @@
\endgroup
}%
\def\pgfplotscolormaptopdffunction@convertcdata#1,#2,#3\relax{#1 #2 #3}%
+\def\pgfplotscolormaptopdffunction@convertcdata@four#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}}%
@@ -459,6 +622,7 @@
\def\pgfplotscolormaptoshadingspec#1#2#3{%
\pgfplotscolormapassertexists{#1}%
\begingroup
+ \def\pgfplots@rgb{rgb}%
\pgfmathparse{#2}%
\expandafter\pgfmathdivide@\expandafter{\pgfmathresult}{\pgfplotscolormaprange}%
\let\pgfplots@loc@TMPb=\pgfmathresult
@@ -467,12 +631,23 @@
\c@pgf@counta=0
\let#3=\pgfutil@empty
\pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\pgfplotscolormaptoshadingspec@TMP{%
- \ifnum\c@pgf@counta=0
- \edef\pgfplots@loc@TMPc{rgb(0pt)=(\pgfplotscolormaptoshadingspec@TMP)}%
- \else
- \pgf@yb=\c@pgf@counta\pgf@ya
- \edef\pgfplots@loc@TMPc{rgb(\the\pgf@yb)=(\pgfplotscolormaptoshadingspec@TMP)}%
+ \pgf@yb=\c@pgf@counta\pgf@ya
+ \edef\pgfplots@colspace{\csname pgfpl@cm@#1@colspace\endcsname}%
+ % FIXME : PGF shadings accept only RGB!
+ \if1\pgfplotscolormaptoshadingspectorgb
+ \ifx\pgfplots@colspace\pgfplots@rgb
+ \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.}%
+ }{%
+ }%
+ \edef\pgf@tempcolor{{\pgfplots@colspace}{\pgfplotscolormaptoshadingspec@TMP}}%
+ \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgfplotscolormaptoshadingspec@TMP}%
+ \def\pgfplots@colspace{rgb}%
+ \fi
\fi
+ \edef\pgfplots@loc@TMPc{\pgfplots@colspace(\the\pgf@yb)=(\pgfplotscolormaptoshadingspec@TMP)}%
\ifx#3\pgfutil@empty
\t@pgfplots@toka={}%
\else
@@ -485,6 +660,7 @@
\pgfmath@smuggleone#3%
\endgroup
}%
+\def\pgfplotscolormaptoshadingspectorgb{1}%
% The same as \pgfplotscolormaptoshadingspec, but this here yields the
% *reversed* sequence.
@@ -501,10 +677,20 @@
% end is fixed to '0'.
\def\pgfplotscolormaprange{1000}
-% Linearly maps the number #4 into the colormap #5 and returns the interpolated RGB triple
-% into \pgfmathresult.
+\def\pgfplotscolormapgetcolorspace#1{%
+ \edef\pgfplotsretval{\csname pgfpl@cm@#1@colspace\endcsname}%
+}%
+\def\pgfplotscolormapgetcolorcomps#1{%
+ \edef\pgfplotsretval{\csname pgfpl@cm@#1@col@comps\endcsname}%
+}%
+
+
+% Linearly maps the number #4 into the colormap #5 and returns the
+% interpolated colors into \pgfmathresult. The result will be a triple
+% for an RGB colormap and it will contain four numbers for CMYK. The
+% components of the result will be in the range [0:1].
%
-% [#1:#2] the number range of the data source. This is required to
+% [#1:#2] the number range of the data source (i.e. of #4). This is required to
% map into the colormap.
% [#3] (optional) the quantity
% s := \pgfplotscolormaprange / (#2-#1).
@@ -564,6 +750,8 @@
% without '.0' suffix:
\def\pgfplots@discardperiod##1.##2\relax{\def\pgfplotscolormapfind@intervalno{##1}}%
\expandafter\pgfplots@discardperiod\pgfmathresult\relax
+ \pgfmathsubtract@{\pgfplotscolormapfind@transformedx@divh}{\pgfplotscolormapfind@intervalno}%
+ \let\pgfplots@loc@factor=\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.
@@ -573,7 +761,11 @@
\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}%
- \expandafter\pgfplotscolormapfind@interpolate\pgfplots@loc@TMPa\relax
+ \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
\pgfmath@smuggleone\pgfmathresult
\endgroup
%\message{-> got finally mapping(#4, #5) = RGB'\pgfmathresult'.}%
@@ -588,26 +780,33 @@
% R:
\pgfmathsubtract@{#4}{#1}%
\let\pgfplotscolormapfind@Cdiff=\pgfmathresult
- \pgfmathsubtract@{\pgfplotscolormapfind@transformedx@divh}{\pgfplotscolormapfind@intervalno}%
- \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplotscolormapfind@Cdiff}%
+ \pgfmathmultiply@{\pgfplots@loc@factor}{\pgfplotscolormapfind@Cdiff}%
\expandafter\pgfmathadd@\expandafter{\pgfmathresult}{#1}%
\let\RED=\pgfmathresult
% G:
\pgfmathsubtract@{#5}{#2}%
\let\pgfplotscolormapfind@Cdiff=\pgfmathresult
- \pgfmathsubtract@{\pgfplotscolormapfind@transformedx@divh}{\pgfplotscolormapfind@intervalno}%
- \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplotscolormapfind@Cdiff}%
+ \pgfmathmultiply@{\pgfplots@loc@factor}{\pgfplotscolormapfind@Cdiff}%
\expandafter\pgfmathadd@\expandafter{\pgfmathresult}{#2}%
\let\GREEN=\pgfmathresult
% B:
\pgfmathsubtract@{#6}{#3}%
\let\pgfplotscolormapfind@Cdiff=\pgfmathresult
- \pgfmathsubtract@{\pgfplotscolormapfind@transformedx@divh}{\pgfplotscolormapfind@intervalno}%
- \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplotscolormapfind@Cdiff}%
+ \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'.
@@ -655,6 +854,7 @@
\fi
}%
+
\pgfutil@definecolor{mapped color}{rgb}{0,0,0}% make sure this color exists. It will be overwritten if needed.
\pgfplotscreatecolormap{hot}{color(0cm)=(blue); color(1cm)=(yellow); color(2cm)=(orange); color(3cm)=(red)}
@@ -670,7 +870,7 @@
{#1}
{\pgfkeysvalueof{/pgfplots/colormap name}}
%\message{Color for current point is RGB '\pgfmathresult' (determined using meta 'phi(\pgfplotspointmeta) = \pgfplotspointmetatransformed')}%
- \def\pgfplots@loc@TMPb{\pgfutil@definecolor{mapped color}{rgb}}%
+ \def\pgfplots@loc@TMPb{\pgfutil@definecolor{mapped color}{\csname pgfpl@cm@\pgfkeysvalueof{/pgfplots/colormap name}@colspace\endcsname}}%
\expandafter\pgfplots@loc@TMPb\expandafter{\pgfmathresult}%
}%
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 60df282f8bb..2dacf8f7458 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
@@ -161,6 +161,7 @@
\expandafter\def\expandafter\pgfplots@command@to@string@@\pgfplots@glob@TMPa#1\pgfplots@EOI#2{%
\def#2{#1}%
}%
+\def\pgfplotscommandtostring#1#2{\pgfplots@command@to@string{#1}{#2}}%
% As \pgfplots@command@to@string, but it works for commands accepting
% arguments. More precisely, #2 will be a string (!) of the form
@@ -205,7 +206,9 @@
% \pgfplotsutil@ifdefinedui{\csname abc\endcsname} -> no
% \pgfplotsutil@ifdefinedui{a_file_name} -> no
\def\pgfplotsutil@ifdefinedui#1#2#3{%
- \def\pgfplotsutil@@arg@ifdefined{#1}%
+ {\toks0={#1}% this construction is necessary to handle '#' characters in '#1'
+ \xdef\pgfplotsutil@@arg@ifdefined{\the\toks0}%
+ }%
\pgfplots@command@to@string\pgfplotsutil@@arg@ifdefined\pgfplotsutil@@arg@ifdefined
\expandafter\pgfplotsutil@trim\expandafter{\pgfplotsutil@@arg@ifdefined}%
\pgfutil@ifundefined{\pgfplotsretval}{#3}{#2}%
@@ -214,7 +217,9 @@
% '#1' after '#1' has been normalized.
% It invokes '#3' if '#1#2' is defined and '#4' if not.
\def\pgfplotsutil@ifdefinedui@withsuffix#1#2#3#4{%
- \def\pgfplotsutil@@arg@ifdefined{#1}%
+ {\toks0={#1}%
+ \xdef\pgfplotsutil@@arg@ifdefined{\the\toks0}%
+ }%
\pgfplots@command@to@string\pgfplotsutil@@arg@ifdefined\pgfplotsutil@@arg@ifdefined
\expandafter\pgfplotsutil@trim\expandafter{\pgfplotsutil@@arg@ifdefined}%
\pgfutil@ifundefined{\pgfplotsretval #2}{#4}{#3}%
@@ -304,7 +309,7 @@
\edef\pgfmathresult{#2}%
\fi
}%
-\def\pgfplotsmathlessthan#1#2{\ifdim#1 pt<#2 pt \pgfmathfloatcomparisontrue\else\pgfmathfloatcomparisonfalse\fi}
+\def\pgfplotsmathlessthan#1#2{\ifdim#1pt<#2pt \pgfmathfloatcomparisontrue\else\pgfmathfloatcomparisonfalse\fi}
% Re-define two-argument function for min and max.
% The pgfmath engine now uses a variable number of arguments.
@@ -555,6 +560,7 @@
% Discards any token up to (and including) \relax.
\def\pgfplots@gobble@until@relax#1\relax{}%
+\def\pgfplots@gobble@until@EOI#1\pgfplots@EOI{}%
% A (simple) replacement for \foreach which
% 1. does NOT scope the argument
@@ -573,13 +579,24 @@
% scopes.
%
% This loop *can* be nested.
-\def\pgfplotsforeachungrouped#1{\pgfplotsforeachungrouped@{#1}}%
-\long\def\pgfplotsforeachungrouped@#1in #2#3{%
- \pgfplotsforeachungrouped@isuniform{#2}%
- \ifpgfplots@loc@tmp
- \pgfplotsforeachungroupeduniform@{#1}#2\relax{#3}%
+\def\pgfplotsforeachungrouped#1{%
+ \pgfutil@ifnextchar/{\pgfplotsforeachungrouped@{#1}}{\pgfplotsforeachungrouped@{#1}/{}}%
+}%
+\long\def\pgfplotsforeachungrouped@#1/#2in #3#4{%
+ \def\pgfplots@foreach@loc@TMPa{#2}%
+ \ifx\pgfplots@foreach@loc@TMPa\pgfutil@empty
+ \pgfplotsforeachungrouped@isuniform{#3}%
+ \ifpgfplots@loc@tmp
+ % special handling:
+ % \foreach #1 in {a,b,...,c} can be improved:
+ \pgfplotsforeachungroupeduniform@{#1}#3\relax{#4}%
+ \else
+ % invoke \foreach #1 in {#3} and transport results:
+ \pgfplotsforeachungroupednonuniform@#1{#3}{#4}%
+ \fi
\else
- \pgfplotsforeachungroupednonuniform@#1{#2}{#3}%
+ % invoke \foreach #1/#2 in {#3} and transport results:
+ \pgfplotsforeachungroupedslashed@#1/#2{#3}{#4}%
\fi
}
\let\pgfplots@original@pgfmathadd@=\pgfmathadd@
@@ -659,6 +676,25 @@
#3%
}%
}
+\long\def\pgfplotsforeachungroupedslashed@#1/#2#3#4{%
+ \pgfplotsapplistXXglobalnewempty
+ \foreach\pgfplots@foreach@loc@TMPa/\pgfplots@foreach@loc@TMPb in {#3} {%
+ \edef\pgfplots@foreach@loc@TMPa{\pgfplots@foreach@loc@TMPa/\pgfplots@foreach@loc@TMPb}%
+ \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@foreach@loc@TMPa,}%
+ }%
+ \pgfplotsapplistXXgloballet\pgfplots@foreach@loc@TMPa
+ \pgfplotsapplistXXglobalclear
+ \expandafter\pgfplotsforeachentryinCSVisterminated\expandafter\pgfplots@foreach@loc@TMPa\expandafter{\pgfplots@foreach@loc@TMPa}{%
+ \expandafter\pgfplotsforeachungroupedslashed@@\pgfplots@foreach@loc@TMPa\pgfplots@EOI
+ \let#1=\pgfplots@foreach@loc@TMPa
+ \let#2=\pgfplots@foreach@loc@TMPb
+ #4%
+ }%
+}
+\def\pgfplotsforeachungroupedslashed@@#1/#2\pgfplots@EOI{%
+ \def\pgfplots@foreach@loc@TMPa{#1}%
+ \def\pgfplots@foreach@loc@TMPb{#2}%
+}%
% Sets \ifpgfplots@loc@tmp to true if and only if '#1' is of the form
% #1 = <number1>,<number2>,...,<number3>.
@@ -741,6 +777,12 @@
% Both, #1 and #2 will be provided as floating point numbers unless
% configured otherwise with \pgfplotsforeachlogarithmicsetoutput,
% see above.
+%
+% Arithmethics will be carried out with the math class
+% '\pgfplotsforeachlogarithmicmathid'.
+% This macro should expand to something which is usable inside of
+% \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{....}
+% the default is 'float'
%
% FIXME : THIS CAN'T BE NESTED YET!
\def\pgfplotsforeachlogarithmicungrouped[#1]#2/#3{\pgfplotsforeachlogarithmicungrouped@[#1]{#2}{#3}}%
@@ -749,18 +791,18 @@
% \pgfplots@foreach@loc@TMPd = N in fixed point
% \pgfplots@foreach@loc@TMPc = N-1 in float :
\edef\pgfplots@plot@samples@@{#1}%
- \pgfmathfloatcreate{1}{1.0}{0}%
+ \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{one}%
\let\pgfplots@foreach@loc@TMPa=\pgfmathresult
- \pgfmathfloatparsenumber{\pgfplots@plot@samples@@}%
- \expandafter\pgfmathfloatsubtract@\expandafter{\pgfmathresult}{\pgfplots@foreach@loc@TMPa}%
+ \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{parsenumber}{\pgfplots@plot@samples@@}%
+ \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{op}{subtract}{{\pgfmathresult}{\pgfplots@foreach@loc@TMPa}}%
\let\pgfplots@foreach@loc@TMPc=\pgfmathresult
%
\edef\pgfplots@loc@TMPb{#4}%
\expandafter\pgfplotsforeachlogarithmicungrouped@readdomain\pgfplots@loc@TMPb\relax
% compute mesh width into \pgfplots@foreach@loc@TMPc:
% \pgfplots@foreach@loc@TMPc := h := ( log(xmax) - log(xmin) ) / (N-1)
- \pgfmathfloatsubtract@{\pgfplots@foreach@loc@TMPb}{\pgfplots@foreach@loc@TMPa}%
- \pgfmathfloatdivide@{\pgfmathresult}{\pgfplots@foreach@loc@TMPc}%
+ \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{op}{subtract}{{\pgfplots@foreach@loc@TMPb}{\pgfplots@foreach@loc@TMPa}}%
+ \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{op}{divide}{{\pgfmathresult}{\pgfplots@foreach@loc@TMPc}}%
\let\pgfplots@foreach@loc@TMPc=\pgfmathresult
%
% apply local scoping here:
@@ -772,13 +814,14 @@
\pgfutil@loop
\ifnum\c@pgf@counta<\pgfplots@plot@samples@@
% compute exp(log(min) + i * h)
- \expandafter\pgfmathfloatparsenumber\expandafter{\the\c@pgf@counta}%
- \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfplots@foreach@loc@TMPc}%
- \expandafter\pgfmathfloatadd@\expandafter{\pgfmathresult}{\pgfplots@foreach@loc@TMPa}%
+ \edef\pgfplots@loc@TMPa{\the\c@pgf@counta}%
+ \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{parsenumber}{\pgfplots@loc@TMPa}%
+ \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{op}{multiply}{{\pgfmathresult}{\pgfplots@foreach@loc@TMPc}}%
+ \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{op}{add}{{\pgfmathresult}{\pgfplots@foreach@loc@TMPa}}%
\let\pgfplots@loc@TMPa=\pgfmathresult
\pgfplotsforeachlogarithmicungrouped@finalizeresult%
\let#3=\pgfmathresult
- \pgfmathfloatexp@{\pgfplots@loc@TMPa}%
+ \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{exp}{\pgfplots@loc@TMPa}%
\pgfplotsforeachlogarithmicungrouped@finalizeresult%
\let#2=\pgfmathresult
%
@@ -798,16 +841,16 @@
\def\pgfplotsforeachlogarithmicungrouped@finalizeresult{}%
+\def\pgfplotsforeachlogarithmicmathid{float}
+
% defines
% \pgfplots@foreach@loc@TMPa := log(firstintervalpt)
% and
% \pgfplots@foreach@loc@TMPb := log(secondintervalpt)
\def\pgfplotsforeachlogarithmicungrouped@readdomain#1:#2\relax{%
- \pgfmathfloatparsenumber{#1}%
- \pgfmathfloatln@{\pgfmathresult}%
+ \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{log}{#1}%
\let\pgfplots@foreach@loc@TMPa=\pgfmathresult
- \pgfmathfloatparsenumber{#2}%
- \pgfmathfloatln@{\pgfmathresult}%
+ \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{log}{#2}%
\let\pgfplots@foreach@loc@TMPb=\pgfmathresult
}
@@ -820,7 +863,7 @@
\def\pgfplots@logfileopen#1{%
\immediate\write-1{PGFPlots: reading {#1}}%
\pgfutil@ifundefined{tikzifexternalizingcurrent}{%
- % version not up-to-date!?
+ % version not up-to-date or external lib not loaded?
}{%
% adjust the .dep file only if we are externalizing.
% Otherwise, it may be overwritten by \pgfplotstableread
@@ -851,15 +894,23 @@
\begingroup
\c@pgf@counta=#2\relax
\c@pgf@countb=#1\relax
- \c@pgf@countc=\c@pgf@countb
- \ifnum\c@pgf@counta=0
- \pgfplots@error{Can't compute \the\c@pgf@countb\space mod \the\c@pgf@counta\space -- this yields division by zero (second argument is zero)!}%
- \edef\pgfmathresult{#1}%
+ \ifnum\c@pgf@counta=2
+ \ifodd\c@pgf@countb
+ \def\pgfmathresult{1}%
+ \else
+ \def\pgfmathresult{0}%
+ \fi
\else
- \divide\c@pgf@countc by\c@pgf@counta
- \multiply\c@pgf@countc by\c@pgf@counta
- \advance\c@pgf@countb by-\c@pgf@countc
- \edef\pgfmathresult{\the\c@pgf@countb}%
+ \c@pgf@countc=\c@pgf@countb
+ \ifnum\c@pgf@counta=0
+ \pgfplots@error{Can't compute \the\c@pgf@countb\space mod \the\c@pgf@counta\space -- this yields division by zero (second argument is zero)!}%
+ \edef\pgfmathresult{#1}%
+ \else
+ \divide\c@pgf@countc by\c@pgf@counta
+ \multiply\c@pgf@countc by\c@pgf@counta
+ \advance\c@pgf@countb by-\c@pgf@countc
+ \edef\pgfmathresult{\the\c@pgf@countb}%
+ \fi
\fi
\pgfmath@smuggleone\pgfmathresult
\endgroup
@@ -967,6 +1018,81 @@
\def\pgfplots@strcmp@rest{#2}%
}%
+% Takes two dimensional cartesian coordinates #1,#2 and
+% defines the macros #3 and #4 to contain the associated polar
+% coordinates.
+%
+% #1: x
+% #2: y
+% #3: a macro which will be filled with the angle (in degrees)
+% #4: a macro which will be filled with the radius
+\def\pgfplotsmathcarttopol#1#2#3#4{%
+ \pgfplotsmathcarttopol@{#1}{#2}{#3}{#4}{default}%
+}%
+\def\pgfplotsmathcarttopolbasic#1#2#3#4{%
+ \pgfplotsmathcarttopol@{#1}{#2}{#3}{#4}{pgfbasic}%
+}%
+% #5: the math engine to use (\pgfplotscoordmath argument)
+\def\pgfplotsmathcarttopol@#1#2#3#4#5{%
+ \begingroup
+ \pgfplotscoordmath{#5}{parsenumber}{#1}%
+ \let\pgfplots@x=\pgfmathresult
+ \pgfplotscoordmath{#5}{parsenumber}{#2}%
+ \let\pgfplots@y=\pgfmathresult
+ \pgfplotscoordmath{#5}{op}{veclen}{{\pgfplots@x}{\pgfplots@y}}%
+ \let\pgfplots@r=\pgfmathresult
+ \pgfplotscoordmath{#5}{if is}{\pgfplots@r}{0}{%
+ \pgfplotscoordmath{#5}{parsenumber}{0}%
+ }{%
+ \pgfplotscoordmath{#5}{op}{divide}{{\pgfplots@x}{\pgfplots@r}}%
+ \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}{op}{multiply}{{\pgfmathresult}{\pgfplots@acos}}%
+ }{}%
+ }%
+ \let\pgfplots@deg=\pgfmathresult
+ \xdef\pgfplots@glob@TMPa{\noexpand\def\noexpand#3{\pgfplots@deg}\noexpand\def\noexpand#4{\pgfplots@r}}%
+ \endgroup
+ \pgfplots@glob@TMPa
+}%
+
+% Takes two dimensional polar coordinates #1,#2 and
+% defines the macros #3 and #4 to contain the associated cartesian
+% coordinates.
+%
+% #1: angle (in degrees)
+% #2: radius
+% #3: a macro which will be filled with the x value
+% #4: a macro which will be filled with the y value
+\def\pgfplotsmathpoltocart#1#2#3#4{%
+ \pgfplotsmathpoltocart@{#1}{#2}{#3}{#4}{default}%
+}%
+\def\pgfplotsmathpoltocartbasic#1#2#3#4{%
+ \pgfplotsmathpoltocart@{#1}{#2}{#3}{#4}{pgfbasic}%
+}%
+% #5: the math engine to use (\pgfplotscoordmath argument)
+\def\pgfplotsmathpoltocart@#1#2#3#4#5{%
+ \begingroup
+ \pgfplotscoordmath{#5}{parsenumber}{#1}%
+ \let\pgfplots@deg=\pgfmathresult
+ \pgfplotscoordmath{#5}{parsenumber}{#2}%
+ \let\pgfplots@r=\pgfmathresult
+ \pgfplotscoordmath{#5}{op}{sin}{{\pgfplots@deg}}%
+ \pgfplotscoordmath{#5}{op}{multiply}{{\pgfplots@r}{\pgfmathresult}}%
+ \let\pgfplots@y=\pgfmathresult
+ \pgfplotscoordmath{#5}{op}{cos}{{\pgfplots@deg}}%
+ \pgfplotscoordmath{#5}{op}{multiply}{{\pgfplots@r}{\pgfmathresult}}%
+ \let\pgfplots@x=\pgfmathresult
+ \xdef\pgfplots@glob@TMPa{\noexpand\def\noexpand#3{\pgfplots@x}\noexpand\def\noexpand#4{\pgfplots@y}}%
+ \endgroup
+ \pgfplots@glob@TMPa
+}%
+
+
\pgfutil@ifundefined{pgfmathdeclarefunction}{%
% BACKWARDS COMPATIBILITY: We have PGF 2.00 :
@@ -1184,17 +1310,17 @@
% #4: code to invoke in case arg1>=arg2
% the iflessthan method will be invoked within local scopes.
/pgfplots/fixed </.style={%
- /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifdim##1pt<##2pt\relax##3\else##4\fi},%
+ /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifdim##1pt<##2pt\relax##3\else ##4\fi},%
},
/pgfplots/fixed <,
/pgfplots/fixed >/.style={%
- /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifdim##1pt>##2pt\relax##3\else##4\fi},%
+ /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifdim##1pt>##2pt\relax##3\else ##4\fi},%
},
/pgfplots/int </.style={%
- /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifnum##1<##2\relax##3\else##4\fi},%
+ /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifnum##1<##2\relax##3\else ##4\fi},%
},
/pgfplots/int >/.style={%
- /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifnum##1>##2\relax##3\else##4\fi},%
+ /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifnum##1>##2\relax##3\else ##4\fi},%
},
/pgfplots/float </.style={%
/pgfplots/iflessthan/.code args={##1##2##3##4}{%
@@ -1303,12 +1429,136 @@
\let\pgfplots@auxwrite=\pgfplots@auxwrite@latex
}%
+% sorts three elements.
+%
+% #1,#2,#3 are three macros containing the input.
+% On output, these macros are redefined to represent the sorted range.
+% The values of these macros must be a <dimen>, followed by anything
+% else (but no \relax please)
+%
+% Example:
+% \def\A{10pt furthervalues}
+% \def\B{4pt value of b}
+% \def\C{1pt value of c}
+% \pgfplotsutilsortthree\A\B\C
+% ->
+% \A={1pt value of c}
+% \B={4pt value of b}
+% \C={10pt furthervalues}
+%
+% It uses insertion sort.
+\def\pgfplotsutilsortthree#1#2#3{%
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xa=#1\relax
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xb=#2\relax
+ \ifdim\pgf@xa>\pgf@xb
+ \let\pgfplots@loc@TMPa=#2%
+ \let#2=#1%
+ \let#1=\pgfplots@loc@TMPa%
+ \fi
+ % first two are sorted.
+ %
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xa=#2\relax
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xb=#3\relax
+ \let\pgfplots@loc@TMPa=#3%
+ \ifdim\pgf@xa>\pgf@xb
+ \let#3=#2%
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xa=#1\relax
+ \ifdim\pgf@xa>\pgf@xb
+ \let#2=#1%
+ \let#1=\pgfplots@loc@TMPa%
+ \else
+ \let#2=\pgfplots@loc@TMPa%
+ \fi
+ \fi
+ % ok.
+}%
+
+% Like \pgfplotsutilsortthree, but for four elements (of the same
+% form, see \pgfplotsutilsortthree).
+%
+% It uses insertion sort.
+\def\pgfplotsutilsortfour#1#2#3#4{%
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xa=#1\relax
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xb=#2\relax
+ \ifdim\pgf@xa>\pgf@xb
+ \let\pgfplots@loc@TMPa=#2%
+ \let#2=#1%
+ \let#1=\pgfplots@loc@TMPa%
+ \fi
+ % first two are sorted.
+ %
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xa=#2\relax
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xb=#3\relax
+ \let\pgfplots@loc@TMPa=#3%
+ \ifdim\pgf@xa>\pgf@xb
+ \let#3=#2%
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xa=#1\relax
+ \ifdim\pgf@xa>\pgf@xb
+ \let#2=#1%
+ \let#1=\pgfplots@loc@TMPa%
+ \else
+ \let#2=\pgfplots@loc@TMPa%
+ \fi
+ \fi
+ % ok, first three are sorted.
+ %
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xa=#3\relax
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xb=#4\relax
+ \let\pgfplots@loc@TMPa=#4%
+ \ifdim\pgf@xa>\pgf@xb
+ \let#4=#3%
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xa=#2\relax
+ \ifdim\pgf@xa>\pgf@xb
+ \let#3=#2%
+ \afterassignment\pgfplots@gobble@until@relax \pgf@xa=#1\relax
+ \ifdim\pgf@xa>\pgf@xb
+ \let#2=#1%
+ \let#1=\pgfplots@loc@TMPa%
+ \else
+ \let#2=\pgfplots@loc@TMPa%
+ \fi
+ \else
+ \let#3=\pgfplots@loc@TMPa%
+ \fi
+ \fi
+ % ok, first four are sorted.
+}%
+
+% A variant of \pgfutil@ifnextchar which allows the '#' character
+% inside of either '#2' or '#3'.
+%
+% It is slightly more expensive and relies on \t@pgfplots@tokc
+\long\def\pgfplotsutil@ifnextchar#1#2#3{%
+ \let\pgfplotsutil@reserved@d=#1%
+ \t@pgfplots@tokc={#2}%
+ \edef\pgfplotsutil@reserved@a{\the\t@pgfplots@tokc}%
+ \t@pgfplots@tokc={#3}%
+ \def\pgfplotsutil@reserved@b{\the\t@pgfplots@tokc}%
+ \futurelet\pgfplotsutil@let@token\pgfplotsutil@ifnch}
+\def\pgfplotsutil@ifnch{%
+ \ifx\pgfplotsutil@let@token\pgfplotsutil@sptoken
+ \let\pgfplotsutil@reserved@c\pgfplotsutil@xifnch
+ \else
+ \ifx\pgfplotsutil@let@token\pgfplotsutil@reserved@d
+ \let\pgfplotsutil@reserved@c\pgfplotsutil@reserved@a
+ \else
+ \let\pgfplotsutil@reserved@c\pgfplotsutil@reserved@b
+ \fi
+ \fi
+ \pgfplotsutil@reserved@c}
+{%
+ \def\:{\global\let\pgfplotsutil@sptoken= } \:
+ \def\:{\pgfplotsutil@xifnch} \expandafter\gdef\: {\futurelet\pgfplotsutil@let@token\pgfplotsutil@ifnch}
+}
+
\input pgfplotsliststructure.code.tex
\input pgfplotsliststructureext.code.tex
\input pgfplotsarray.code.tex
+\input pgfplotsmatrix.code.tex
\input pgfplotstableshared.code.tex
\input pgfplotsdeque.code.tex
\input pgfplotsbinary.code.tex
+\input pgfplotsutil.verb.code.tex
\usepgfplotslibrary{surfshading}
diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.verb.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.verb.code.tex
new file mode 100644
index 00000000000..8590ba908d6
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.verb.code.tex
@@ -0,0 +1,97 @@
+%--------------------------------------------
+%
+% Package pgfplots
+%
+% Copyright 2007-2011 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/>.
+%
+%--------------------------------------------
+%
+% This source file contains helper utilities for verbatim character
+% processing.
+
+
+%
+% USAGE:
+% \beginpgfplotsverbatim[result/.code={\message{I read #1}}]
+% <verbatim code>
+% \endpgfplotsverbatim
+%
+% The verbatim code MUST start at the line after the ']' (or after
+% \beginpgfplotsverbatim if there is no ']')
+\def\beginpgfplotsverbatim{\pgfutil@ifnextchar[{\beginpgfplotsverbatim@}{\beginpgfplotsverbatim@[]}}
+\def\beginpgfplotsverbatim@[#1]{%
+ \begingroup
+ \pgfqkeys{/pgfplots/verb}{#1}%
+ \pgfplots@verbatim@prepare@collect
+ \beginpgfplotsverbatim@gobbleuntileol
+}
+
+\begingroup
+\catcode`\|=0
+\catcode`\\=12
+|gdef|endpgfplotsverbatim{\endpgfplotsverbatim}%
+|endgroup
+
+\expandafter\long\expandafter\def\expandafter\pgfplots@verbatim@collect@until\expandafter#\expandafter1\endpgfplotsverbatim{%
+ \begingroup
+ \pgfplots@verbatim@newline@handler
+ \xdef\pgfplots@glob@TMPa{#1}%
+ \endgroup
+ \pgfkeysgetvalue{/pgfplots/verb/result/.@cmd}\pgfplots@loc@TMPb
+ \global\let\pgfplots@glob@TMPb=\pgfplots@loc@TMPb
+ \endgroup% restore old catcodes etc.
+ \expandafter\pgfplots@glob@TMPb\expandafter{\pgfplots@glob@TMPa}\pgfeov%
+}%
+
+\begingroup
+\long\def\pgfplots@loc@TMPa{
+}%^^M}%
+\catcode`\^^M=13 %
+\gdef\beginpgfplotsverbatim@gobbleuntileol^^M{\pgfplots@verbatim@collect@until}%
+\gdef\pgfplots@verbatim@newline@toHATHATJ{\def^^M{^^J}}%
+\xdef\pgfplots@verbatim@newline@IDENTITY{\noexpand\long\noexpand\def\noexpand^^M{\pgfplots@loc@TMPa}}%
+\endgroup
+
+\pgfkeys{
+ /pgfplots/verb/result/.code={%
+ \pgfplots@error{Please use \string\beginpgfplotsverbatim[result/.code=....] to configure what to do with the content of \string\beginpgfplotsverbatim...\endpgfplotsverbatim\space (or use \string\pgfplotsset{verb/.cd,result/.code=....} in your preamble)}%
+ },
+ /pgfplots/verb/newline handler/.is choice,
+ /pgfplots/verb/newline handler/to outfile/.code=
+ {\let\pgfplots@verbatim@newline@handler=\pgfplots@verbatim@newline@toHATHATJ},
+ /pgfplots/verb/newline handler/identity/.code=
+ {\let\pgfplots@verbatim@newline@handler=\pgfplots@verbatim@newline@IDENTITY},
+ /pgfplots/verb/newline handler/identity,
+}
+
+\def\pgfplots@verbatim@prepare@collect{%
+ \def\do##1{\catcode`##1=12 }\dospecials
+ \catcode`\^^M=13
+ \catcode`\^^J=12
+ \catcode`\^^I=12
+}%
+
+\def\pgfplots@verbatim@restore@catcodes{%
+ \catcode`\^^M=5
+ \catcode`\^^J=10
+ \catcode`\^^I=10
+ % this is important to get \scantokens to work: otherwise, it will
+ % eat up the ^^M chars:
+ \endlinechar=`\^^M
+ \newlinechar=\endlinechar
+}%
+
+\endinput