diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex | 60 |
1 files changed, 46 insertions, 14 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 290fbfe9292..b1496a8fc1b 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex @@ -56,6 +56,7 @@ \let\pgfplots@createcolormap@LAST=\pgfplots@createcolormap@MIN % PARSE IT: \edef\pgfplots@loc@TMPa{#2}% + \let\pgfplots@createcolormap@context=\pgfutil@empty % this does also init @H: \expandafter\pgfplots@createcolormap@startloop\pgfplots@loc@TMPa\pgfplots@EOI \expandafter\pgfplotsarraycheckempty\expandafter{\pgfplots@createcolormap@name}% @@ -77,6 +78,7 @@ %\pgfplots@colormap@showdebuginfofor{#1}% } \def\pgfplots@createcolormap@seth[#1]{% + \def\pgfplots@createcolormap@context{[#1]}% \pgfmathparse{#1}% \let\pgfplots@createcolormap@H=\pgfmathresult \pgfplots@createcolormap@ @@ -102,13 +104,20 @@ \pgfutil@ifnextchar c{\pgfplots@createcolormap@grabcolor}% { \expandafter\pgfutil@ifnextchar\pgfplots@activesemicolon{\pgfplots@createcolormap@grabsemicolon@active}% - {\pgfplots@error{Illformed colormap specification}}% + {\pgfplots@createcolormap@error}% }% }% }% }% }% } +\def\pgfplots@createcolormap@error#1#2\pgfplots@EOI{% + {% + \t@pgfplots@toka={#1#2}% + \t@pgfplots@tokb={#1}% + \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@}% { @@ -147,6 +156,7 @@ }% } \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{% @@ -157,6 +167,7 @@ \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}% @@ -171,6 +182,7 @@ \pgfplots@createcolormap@next }% \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@grabcolor color{% @@ -178,6 +190,7 @@ \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}% \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% @@ -186,7 +199,7 @@ \pgfplots@createcolormap@nextRGB{#4}{#1}{#2}{#3}% \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.}% + \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'}% }% % Ok, we parsed the next single spec. % #1: the width @@ -222,7 +235,7 @@ \ifpgfplotsarrayempty \ifdim\pgfplots@createcolormap@MAX pt=0pt \else - \pgfplots@error{Sorry, the left end of a colormap (at 0pt) must be provided explicitly. You cannot start with \pgfplots@createcolormap@MAX pt.}% + \pgfplots@error{Sorry, the left end of a colormap (at 0pt) must be provided explicitly. You cannot start with \pgfplots@createcolormap@MAX pt. The error occured near `\pgfplots@createcolormap@context'}% \def\pgfplots@createcolormap@MAX{0}% \fi \else @@ -243,9 +256,8 @@ \c@pgf@counta=\pgfmathresult\relax \pgfmath@smuggleone\pgfmathresult \endgroup - \if\pgfmathresult\pgfutil@empty + \ifx\pgfmathresult\pgfutil@empty % I can't do that yet. - \pgfplots@error{Sorry, non-uniform colormaps are only partially implemented, yet: the provided points must be multiples of the mesh width h=\pgfplots@createcolormap@H pt. Perhaps it helps to provide the mesh widths as argument as in {<name>}{[1cm] <color arguments>}?}% \else \let\pgfplots@loc@TMPb=\pgfmathresult % interpolate missing values using the already fixed H. @@ -253,7 +265,7 @@ % only in forward direction - but it works at least. % For the backwards direction, you can provide the % meshwidth explicitly at - % \pgfplotscreatecolormap[h]{}{} + % \pgfplotscreatecolormap{}{[1pt]} \pgfplotsforeachungrouped \c@pgfplots@createcolormap in {1,2,...,\pgfplots@loc@TMPb} {% \ifdim\c@pgfplots@createcolormap pt=\pgfplots@loc@TMPb pt % omit the last. @@ -280,10 +292,27 @@ \edef\pgfplots@createcolormap@lastB{#4}% }% \def\pgfplots@createcolormap@nextRGB@consider@reinterpolation#1\relax{% - \ifdim#1pt<0.0005pt - \edef\pgfmathresult{\the\c@pgf@counta}% - \else + \pgf@xa=#1pt + \ifdim\pgf@xa>0.5pt % we have something like 99.995 or so. + % round up and compute 1 - #1: + \advance\c@pgf@counta by1 + \pgf@xa=1pt \advance\pgf@xa by-#1pt + \fi + % + % compute relative error: + \pgf@xb=\the\c@pgf@counta pt + \divide\pgf@xb by10000 +%\message{Checking H/h = \pgfplots@createcolormap@H@cur pt/\pgfplots@createcolormap@H pt = \the\c@pgf@counta+-\pgf@sys@tonumber\pgf@xa\space: \the\pgf@xa > \the\pgf@xb\space (relative to \the\c@pgf@counta)?}% + % + \ifdim\pgf@xa>\pgf@xb + \pgfplots@error{Sorry, non-uniform colormaps are only partially implemented, yet: the provided points must be multiples of the mesh width h=\pgfplots@createcolormap@H pt (but I found one with H/h = \pgfplots@createcolormap@H@cur pt/\pgfplots@createcolormap@H pt = \the\c@pgf@counta+-\pgf@sys@tonumber\pgf@xa\space which is no integer). Perhaps it helps to provide the mesh widths as argument as in {<name>}{[1cm] <color arguments>}? The error occured near `\pgfplots@createcolormap@context'}% \let\pgfmathresult=\pgfutil@empty + \else + \ifnum\c@pgf@counta=0 + \let\pgfmathresult=\pgfutil@empty + \else + \edef\pgfmathresult{\the\c@pgf@counta}% + \fi \fi }% @@ -312,20 +341,23 @@ % #2: a macro name \def\pgfplotscolormapserializetomacro#1#2{% \begingroup - \pgfplotslistnewempty\pgfplots@serialize@list + \pgfplotsapplistXnewempty\pgfplots@serialize@list@ \pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\elem{% - \expandafter\pgfplotslistpushback\elem\to\pgfplots@serialize@list + \expandafter\pgfplotsapplistXpushback\expandafter{\elem},\to\pgfplots@serialize@list@ }% + \pgfplotsapplistXlet\pgfplots@serialize@list=\pgfplots@serialize@list@ \toks0={\expandafter\def\csname pgfpl@cm@#1@h\endcsname}% \toks1={\expandafter\def\csname pgfpl@cm@#1@invh\endcsname}% \toks2={% \pgfplotsarraynewempty{pgfpl@cm@#1}% - \pgfplotslistforeachungrouped\pgfplots@loc@TMPa\as\pgfplots@loc@TMPb{% - \expandafter\pgfplotsarraypushback\pgfplots@loc@TMPb\to{pgfpl@cm@#1}% + \expandafter\pgfplotsutilforeachcommasep\pgfplots@loc@TMPa\as\pgfplots@loc@TMPb{% + \ifx\pgfplots@loc@TMPb\pgfutil@empty + \else + \expandafter\pgfplotsarraypushback\pgfplots@loc@TMPb\to{pgfpl@cm@#1}% + \fi }% }% \toks3=\expandafter{\pgfplots@serialize@list}% - \t@pgfplots@toka=\expandafter{\pgfplots@serialize@list}% \xdef\pgfplots@glob@TMPa{% \the\toks0 {\csname pgfpl@cm@#1@h\endcsname}% \the\toks1 {\csname pgfpl@cm@#1@invh\endcsname}% |