From 916b6828e77bd92bd88d57bad094c4520f0ad65c Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Wed, 30 Jun 2021 03:03:03 +0000
Subject: CTAN sync 202106300303

---
 graphics/pgf/contrib/pgf-spectra/pgf-spectra.sty | 444 ++++++++++++++++++++---
 1 file changed, 391 insertions(+), 53 deletions(-)

(limited to 'graphics/pgf/contrib/pgf-spectra/pgf-spectra.sty')

diff --git a/graphics/pgf/contrib/pgf-spectra/pgf-spectra.sty b/graphics/pgf/contrib/pgf-spectra/pgf-spectra.sty
index 5d3fecdd93..abb2e58a3b 100644
--- a/graphics/pgf/contrib/pgf-spectra/pgf-spectra.sty
+++ b/graphics/pgf/contrib/pgf-spectra/pgf-spectra.sty
@@ -1,9 +1,10 @@
 % Hugo Gomes @ 15/04/2016 (v1.0)
 % Hugo Gomes @ 15/03/2021 (v2.0.0)
 % Hugo Gomes @ 12/05/2021 (v2.1.0)
+% Hugo Gomes @ 27/06/2021 (v2.1.1)
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \NeedsTeXFormat{LaTeX2e}%
-\ProvidesPackage{pgf-spectra}[12/05/2021 pgf-spectra v2.1.0]%
+\ProvidesPackage{pgf-spectra}[27/06/2021 pgf-spectra v2.1.1]%
 \RequirePackage{tikz}%
 \DeclareOption{LSE}{\input{spectra.data.LSE.tex}}%
 \DeclareOption{NIST}{\input{spectra.data.NIST.tex}}%
@@ -1041,7 +1042,9 @@ use visible shading,backVIS=black}}% NEW v2.1.0 -> use visible shading
 \ifnum#3>780\relax\def\wl@shade@end{780}\else\pgfmathparse{int(#3)}\edef\wl@shade@end{\pgfmathresult}\fi%
 \pgfmathparse{(\wl@shade@end-\wl@shade@begin)/50}\edef\wl@shadecolor@step{\pgfmathresult}%
 %\foreach \n in {1,...,51}{%
-\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
+\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
+                21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,%
+                39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
 \pgfmathparse{\wl@shade@begin+(\n-1)*\wl@shadecolor@step}\edef\wl@currentwl{\pgfmathresult}%
 \wlcolor{\wl@currentwl}%
 \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%%
@@ -1057,7 +1060,11 @@ use visible shading,backVIS=black}}% NEW v2.1.0 -> use visible shading
 \fi\fi%
 }%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newif\ifwl@logshade% NEW v2.1.1
 \pgfkeys{/wl/.cd,%
+shade begin/.get=\wl@shadebegin,% NEW v2.1.1
+shade begin/.store in=\wl@shadebegin,% NEW v2.1.1
+shade begin/.default=380,% NEW v2.1.1
 shade end/.get=\wl@shadeend,%
 shade end/.store in=\wl@shadeend,%
 shade end/.default=780,%
@@ -1066,64 +1073,389 @@ shade opacity/.store in=\wl@shade@opacity,%
 shade opacity/.default=1,%
 shade opacity color/.get=\wl@shade@opacitycolor,%
 shade opacity color/.store in=\wl@shade@opacitycolor,%
-shade opacity color/.default=white%
+shade opacity color/.default=white,%
+logarithmic/.is if=wl@logshade% NEW v2.1.1
 }%
-\pgfkeys{/wl/.cd,shade end,shade opacity,shade opacity color}%
+\pgfkeys{/wl/.cd,shade begin,shade end,shade opacity,shade opacity color,logarithmic=false}%
 % \pgfspectraplotshade{name} or
 % \pgfspectraplotshade[options]{name}
+% --- recoded in v2.1.1 ---
 \def\pgfspectraplotshade{\@ifnextchar[\wl@pgfspectraplotshade{\wl@pgfspectraplotshade[]}}%
 \def\wl@pgfspectraplotshade[#1]#2{\ignorespaces%
-\pgfkeys{/wl/.cd,shade end=780,shade opacity=1,shade opacity color=white}%
+\pgfkeys{/wl/.cd,shade begin=380,shade end=780,shade opacity=1,shade opacity color=white,logarithmic=false}%
 \pgfkeys{/wl/.cd,UVcolor=wlUVcolor,IRcolor=wlIRcolor,gamma=.8}%
 \pgfkeys{/wl/.cd,#1}%
 \pgfmathparse{100*\wl@shade@opacity}\edef\@wl@shade@opacity{\pgfmathresult}%
-%
-% x[bp]=25+(380+8*(\n-1))*(50/\wl@shadeend)
-%
+% ---------------------------------------------------------------------------------------------------------------------
+% verifying start & end
+\edef\wl@shadebegin@pt{\wl@shadebegin pt}%
 \edef\wl@shadeend@pt{\wl@shadeend pt}%
-\ifdim\wl@shadeend@pt<381pt\relax%
-\PackageError{pgf-spectra}{shade end must be greater then 380}{Type a wavelength greater then 380}%
+\ifdim\wl@shadebegin@pt<0pt\relax%
+\PackageError{pgf-spectra}{pgfspectraplotshade - minimum wavelength is 0nm!}{}%
+\else\ifdim\wl@shadeend@pt>16000pt\relax%
+\PackageError{pgf-spectra}{pgfspectraplotshade - maximum wavelength is 16000nm!}{}%
+\else\ifdim\wl@shadeend@pt<\wl@shadebegin@pt\relax%
+\PackageError{pgf-spectra}{pgfspectraplotshade - shade end must be greater then shade begin!}{}%
+\else\relax%
+\ifdim\wl@shadeend@pt<380pt\relax%
+\pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
 \else%
-\pgfkeys{/pgf/number format/.cd,fixed,precision=4,set thousands separator={},assume math mode=true}%
-\pgfmathparse{25+379.9/\wl@shadeend*50}%
-\pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
-\edef\xO{\wl@X@tmp bp}%
-\ifdim\wl@shadeend@pt<780pt\relax%
-\pgfkeys{/pgf/number format/.cd,fixed,precision=3,set thousands separator={},assume math mode=true}%
-\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
-\pgfmathparse{380+(\n-1)*(\wl@shadeend/50-7.6)}\edef\wl@currentwl{\pgfmathresult}%
-\wlcolor{\wl@currentwl}%
-\colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
-\edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%%
-\pgfmathparse{24+380/\wl@shadeend*50+\n-380/\wl@shadeend*\n+380/\wl@shadeend}%
-\pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
-\expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
-}%
-\pgfkeys{/pgf/number format/.cd,fixed,precision=4,set thousands separator={},assume math mode=true}%
-\pgfmathparse{25+(\wl@shadeend+.1)/\wl@shadeend*50}%
-\pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
-\edef\xF{\wl@X@tmp bp}%
+\ifdim\wl@shadebegin@pt>780pt\relax%
+\pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
 \else%
-\pgfkeys{/pgf/number format/.cd,fixed,precision=3,set thousands separator={},assume math mode=true}%
-\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
-\pgfmathparse{380+(\n-1)*8}\edef\wl@currentwl{\pgfmathresult}%
-\wlcolor{\wl@currentwl}%
-\colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
-\edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%%
-\pgfmathparse{25+380/\wl@shadeend*50+400/\wl@shadeend*\n-400/\wl@shadeend}%
-\pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
-\expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
-}%
-\pgfkeys{/pgf/number format/.cd,fixed,precision=2,set thousands separator={},assume math mode=true}%
-\pgfmathparse{25+780.1/\wl@shadeend*50}%
-\pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
-\edef\xF{\wl@X@tmp bp}%
-\fi% ifdim<780pt
-% the horizontal shading
-\pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(\xO)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
-color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
-color(\xF)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}
-\fi% ifdim<381pt
+\pgfkeys{/pgf/number format/.cd,fixed,precision=4,set thousands separator={},assume math mode=true}%
+%  ----------------------------------------------------
+    \ifdim\wl@shadebegin@pt<380pt\relax%
+        \ifdim\wl@shadeend@pt>780pt\relax%
+            % ---------------------------------------------------------------------------------------------------------------------
+            % \wl@shadebegin<380nm & \wl@shadeend>780nm ----------------------------------------------------
+            % Shade structure:
+            %       xShade(bp) = f(wl)
+            %       x_from_\wl@shadebegin[bp]@25bp -- x_to_\wl@shadeend[bp]@75bp:
+            %           x_UV_from_\wl@shadebegin[bp]@25bp -- xUV_to_379.9nm@x_end_UV[bp] --
+            %           -- x_VIS_from_380nm@x_start_VIS[bp] -- xVIS_to_780nm@x_end_VIS[bp] --
+            %           -- x_IR_from_780.1nm@x_start_IR[bp] -- -- x\wl@shadeend[bp]@75bp
+            % ------------------------------------------------------------------------------------------------------
+            % if wl@shadebegin=0nm let \wl@shadebegin=0.0001 (log only)
+            % (approximation for supporting shading from 0... not a real situation in a logarithmic plot,
+            % but not detected in the resulting shade if used for other purposes... )
+            % -----------------------------------------------------------------------------------------------------
+            \ifwl@logshade% \wl@logshadetrue
+                \ifnum\wl@shadebegin=0\relax\edef\wl@shadebegin{0.00001}\fi%
+                \pgfmathparse{(\wl@shadeend-\wl@shadebegin)/50}%
+                \pgfmathprintnumberto{\pgfmathresult}{\wl@shadestep}%
+                \pgfmathparse{50/(log10(\wl@shadeend)-log10(\wl@shadebegin))}%
+                \pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
+                \pgfmathparse{25+(log10(379.9)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
+                \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                \edef\wl@X@UV{\wl@X@tmp bp}%
+                \pgfmathparse{25+(log10(780.1)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
+                \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                \edef\wl@X@IR{\wl@X@tmp bp}%
+                \pgfmathparse{25+(log10(380)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
+                \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                \edef\wl@x@start@VIS@log{\wl@X@tmp}%
+                \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
+                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
+                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
+                            \pgfmathparse{372+8*\n}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
+                            \wlcolor{\wl@currentwl}%
+                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
+                            \pgfmathparse{\wl@x@start@VIS@log+(log10(372+8*\n)-log10(380))*\wl@shade@logscale@factor}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
+                            }%
+            \else% \wl@logshadefalse
+                \pgfmathparse{(\wl@shadeend-\wl@shadebegin)/50}%
+                \edef\wl@shade@scale{\pgfmathresult}%
+                \pgfmathparse{25+(379.9-\wl@shadebegin)/\wl@shade@scale}%
+                \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                \edef\wl@X@UV{\wl@X@tmp bp}%
+                \pgfmathparse{25+(780.1-\wl@shadebegin)/\wl@shade@scale}%
+                \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                \edef\wl@X@IR{\wl@X@tmp bp}%
+                \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
+                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
+                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
+                            \pgfmathparse{372+8*\n}% MANTER !!!
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
+                            \wlcolor{\wl@currentwl}%
+                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
+                            \pgfmathparse{25+(372-\wl@shadebegin+8*\n)/\wl@shade@scale}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
+                            }%
+            \fi% \ifwl@logshade
+            % the horizontal shading
+            \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(\wl@X@UV)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
+            color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
+            color(\wl@X@IR)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
+        \else% \wl@shadeendt@pt>780pt
+            % ---------------------------------------------------------------------------------------------------------------------
+            % \wl@shadebegin<380nm & \wl@shadeend<=780nm ----------------------------------------------------
+            % Shade structure:
+            %       25bp -- UV -- \wl@X@UV -- \wl@X@VIS@i --- xVIS_to_\wl@shadeend[bp]@75bp
+            %       VIS region in shade (51 points) -> \n=1,2,...,51
+            % ------------------------------------------------------------------------------------------------------
+            \pgfmathparse{int(\wl@shadeend-380)}\pgfmathprintnumberto{\pgfmathresult}{\wl@shade@VIS@amp@int}%
+            \ifwl@logshade% \wl@logshadetrue
+                \ifnum\wl@shadebegin=0\relax\edef\wl@shadebegin{0.00001}\fi%
+                \ifnum\wl@shade@VIS@amp@int>20\relax%
+                    \pgfmathparse{50/(log10(\wl@shadeend)-log10(\wl@shadebegin))}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
+                    \pgfmathparse{25+(log10(379.9)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                    \edef\wl@X@UV{\wl@X@tmp bp}%
+                    \pgfmathparse{25+(log10(380)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                    \edef\wl@X@VIS{\wl@X@tmp bp}%
+                    \pgfmathparse{(\wl@shadeend-380)/50}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                    \edef\wl@step@VIS{\wl@X@tmp}%
+                    \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
+                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
+                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
+                            \pgfmathparse{380+\wl@step@VIS*(\n-1)}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
+                            \wlcolor{\wl@currentwl}%
+                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
+                            \pgfmathparse{\wl@X@VIS+log10(1+(\n-1)*(\wl@step@VIS/380))*\wl@shade@logscale@factor}% correction factor for log10 calc
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                            \pgfmathparse{\wl@X@tmp*0.99638}% correction factor for log10 calc
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
+                            }%
+                    \edef\xLI{75bp}% not always at 75bp... so forcing it!
+                    % the horizontal shading
+                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(\wl@X@UV)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
+                    color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
+                    color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
+                \else% VIS@amp@int<=20%
+                    \pgfmathparse{1/(log10(\wl@shadeend)-log10(\wl@shadebegin))}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
+                    \pgfmathparse{25+(log10(379.999)-log10(\wl@shadebegin))*50*\wl@shade@logscale@factor}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                    \ifnum\wl@shade@VIS@amp@int=0\relax%
+                        \pgfmathparse{\wl@X@tmp*0.99621-.1898}% correction factor for log10 calc
+                    \else%
+                        \pgfmathparse{\wl@X@tmp*0.99621}% correction factor for log10 calc
+                    \fi%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                    \edef\wl@X@UV{\wl@X@tmp bp}%
+                    \pgfmathparse{25+(log10(380)-log10(\wl@shadebegin))*50*\wl@shade@logscale@factor}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                    \ifnum\wl@shade@VIS@amp@int=0\relax%
+                        \pgfmathparse{\wl@X@tmp*0.99621-.1898}% correction factor for log10 calc
+                    \else%
+                        \pgfmathparse{\wl@X@tmp*0.99621}% correction factor for log10 calc
+                    \fi%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                    \edef\wl@X@VIS{\wl@X@tmp bp}%
+                    \pgfmathparse{(\wl@shadeend-380)/50}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                    \edef\wl@step@VIS{\wl@X@tmp}%
+                    \@for\n:={1,6,11,16,21,26,31,36,41,46,51}\do{%
+                            \pgfmathparse{380+\wl@step@VIS*(\n-1)}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
+                            \wlcolor{\wl@currentwl}%
+                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
+                            \pgfmathparse{\wl@X@VIS+log10(1+(\n-1)*(\wl@step@VIS/380))*50*\wl@shade@logscale@factor}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
+                            }%
+                    \edef\xLI{75bp}%
+                    % the horizontal shading
+                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(\wl@X@UV)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
+                    color(\xI)=(wlshcolI);color(\xVI)=(wlshcolVI);color(\xXI)=(wlshcolXI);color(\xXVI)=(wlshcolXVI);color(\xXXI)=(wlshcolXXI);color(\xXXVI)=(wlshcolXXVI);color(\xXXXI)=(wlshcolXXXI);color(\xXXXVI)=(wlshcolXXXVI);color(\xXLI)=(wlshcolXLI);color(\xXLVI)=(wlshcolXLVI);color(\xLI)=(wlshcolLI);%
+                    color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
+                \fi%
+            \else% \wl@logshadefalse
+                \ifnum\wl@shade@VIS@amp@int=0\relax%
+                    \wlcolor{380}%
+                    \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                    \pgfmathparse{(\wl@shadeend-\wl@shadebegin)/50}%
+                    \edef\wl@shade@scale{\pgfmathresult}%
+                    \pgfmathparse{25+(379.9-\wl@shadebegin)/\wl@shade@scale-.1898}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@UV}%
+                    \pgfmathparse{25+(379.99-\wl@shadebegin)/\wl@shade@scale-.1898}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@VIS}%
+                    % the horizontal shading
+                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(\wl@X@UV)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
+                    color(\wl@X@VIS)=(wlcolor);color(75bp)=(wlcolor);%
+                    color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
+                \else%
+                    \pgfmathparse{(\wl@shadeend-\wl@shadebegin)/50}%
+                    \edef\wl@shade@scale{\pgfmathresult}%
+                    \pgfmathparse{25+(379.99-\wl@shadebegin)/\wl@shade@scale}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                    \edef\wl@X@UV{\wl@X@tmp bp}%
+                    \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
+                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
+                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
+                            \pgfmathparse{380+(\wl@shadeend-380)/50*(\n-1)}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
+                            \wlcolor{\wl@currentwl}%
+                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
+                            \pgfmathparse{25+(380-\wl@shadebegin+(\wl@shadeend-380)/50*(\n-1))/\wl@shade@scale}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
+                            }%
+                    % the horizontal shading
+                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(\wl@X@UV)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
+                    color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
+                    color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
+                \fi%
+            \fi% \ifwl@logshade
+        \fi% \wl@shadeendt@pt>780pt
+    \else%\wl@shadebegin@pt<380pt
+        \ifdim\wl@shadeend@pt>780pt\relax%
+            % ---------------------------------------------------------------------------------------------------------------------
+            % \wl@shadebegin>=380nm & \wl@shadeend>780nm ----------------------------------------------------
+            % Shade structure:
+            %       xShade(bp) = f(wl)
+            %       xVIS_from_\wl@shadebegin[bp]@25bp -- xVIS_to_\wl@shadeend[bp]@75bp
+            %       VIS region in shade (51 points) -> \n=1,2,...,51
+            % ------------------------------------------------------------------------------------------------------
+            \ifwl@logshade% \wl@logshadetrue
+            \pgfmathparse{int(780-\wl@shadebegin)}\pgfmathprintnumberto{\pgfmathresult}{\wl@shade@VIS@amp@int}%
+                \ifnum\wl@shade@VIS@amp@int>20\relax%
+                    \pgfmathparse{50/(log10(\wl@shadeend)-log10(\wl@shadebegin))}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
+                    \pgfmathparse{25+(log10(780.1)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                    \edef\wl@X@IR{\wl@X@tmp bp}%
+                    \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
+                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
+                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
+                            \pgfmathparse{\wl@shadebegin+(780-\wl@shadebegin)/50*(\n-1)}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
+                            \wlcolor{\wl@currentwl}%
+                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
+                            \pgfmathparse{25+(log10(\wl@shadebegin+(780-\wl@shadebegin)/50*(\n-1))-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
+                            }%
+                    % the horizontal shading
+                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.99bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
+                    color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
+                    color(\wl@X@IR)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
+                \else% amp<=20
+                    \pgfmathparse{1/(log10(\wl@shadeend)-log10(\wl@shadebegin))}%
+                    \pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
+                    \ifnum\wl@shade@VIS@amp@int=0\relax%
+                        \pgfmathparse{25+(log10(780.1)-log10(\wl@shadebegin))*50*\wl@shade@logscale@factor}%
+                        \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                        \edef\wl@X@IR{\wl@X@tmp bp}%
+                    \else%
+                        \pgfmathparse{25+(log10(781)-log10(\wl@shadebegin))*50*\wl@shade@logscale@factor}%
+                        \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                        \edef\wl@X@IR{\wl@X@tmp bp}%
+                    \fi%
+                    \@for\n:={1,6,11,16,21,26,31,36,41,46,51}\do{%
+                            \pgfmathparse{\wl@shadebegin+(780-\wl@shadebegin)/50*(\n-1)}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
+                            \wlcolor{\wl@currentwl}%
+                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
+                            \pgfmathparse{25+(log10(\wl@shadebegin+(780-\wl@shadebegin)/50*(\n-1))-log10(\wl@shadebegin))*50*\wl@shade@logscale@factor}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
+                            }%
+                    % the horizontal shading
+                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.99bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
+                    color(\xI)=(wlshcolI);color(\xVI)=(wlshcolVI);color(\xXI)=(wlshcolXI);color(\xXVI)=(wlshcolXVI);color(\xXXI)=(wlshcolXXI);color(\xXXVI)=(wlshcolXXVI);color(\xXXXI)=(wlshcolXXXI);color(\xXXXVI)=(wlshcolXXXVI);color(\xXLI)=(wlshcolXLI);color(\xXLVI)=(wlshcolXLVI);color(\xLI)=(wlshcolLI);%
+                    color(\wl@X@IR)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
+                \fi%
+            \else% \wl@logshadefalse
+                \pgfmathparse{(\wl@shadeend-\wl@shadebegin)/50}%
+                \edef\wl@shade@scale{\pgfmathresult}%
+                \pgfmathparse{25+(780.01-\wl@shadebegin)/\wl@shade@scale}%
+                \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                \edef\wl@X@IR{\wl@X@tmp bp}%
+                \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
+                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
+                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
+                            \pgfmathparse{\wl@shadebegin+(780-\wl@shadebegin)/50*(\n-1)}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
+                            \wlcolor{\wl@currentwl}%
+                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
+                            \pgfmathparse{25+(780-\wl@shadebegin)/50*(\n-1)/\wl@shade@scale}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
+                            }%
+                % the horizontal shading
+                \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.99bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
+                color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
+                color(\wl@X@IR)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
+            \fi% \ifwl@logshade
+        \else% \wl@shadeend@pt>780pt
+            % -----------------------------------------------------------------------------------------------------
+            % \wl@shadebegin>=380nm & \wl@shadeend<=780nm ---------------------------------
+            % Shade structure:
+            %       xShade(bp) = f(wl)
+            %       xVIS_from_\wl@shadebegin[bp]@25bp -- xVIS_to_\wl@shadeend[bp]@75bp
+            %       VIS region in shade (51 points) -> \n=1,2,...,51
+            % ------------------------------------------------------------------------------------------------------
+            \pgfmathparse{(\wl@shadeend-\wl@shadebegin)/50}\pgfmathprintnumberto{\pgfmathresult}{\wl@shade@step}%
+            \ifwl@logshade% \wl@logshadetrue
+                % scale (25 to 75 bp): \wl@shade@amp=\wl@shadeend-\wl@shadebegin ; \wl@shade@scale=\wl@shade@amp/50
+                \pgfmathparse{\wl@shadeend-\wl@shadebegin}\edef\wl@shade@amp{\pgfmathresult}%
+                \pgfmathprintnumberto{\wl@shade@amp}{\wl@shade@amp@int}%
+                \ifnum\wl@shade@amp@int>5\relax%
+                    \pgfmathparse{50/(log10(\wl@shadeend)-log10(\wl@shadebegin))}\pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
+                    \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
+                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
+                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
+                            \pgfmathparse{\wl@shadebegin+(\n-1)*\wl@shade@step}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
+                            \wlcolor{\wl@currentwl}%
+                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
+                            \pgfmathparse{25+((log10(\wl@currentwl)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
+                            }%
+                    \edef\xLI{75bp}%
+                    % the horizontal shading
+                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.94bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.95bp)=(wlshcolI);%
+                        color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
+                        color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
+                \else% \wl@shade@amp@int<5
+                    \pgfmathparse{(log10(\wl@shadeend)-log10(\wl@shadebegin))}\pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
+                    \wlcolor{\wl@shadebegin}%
+                    \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                    \colorlet{wlshcolI}{wlcolor}%
+                    \edef\xI{25bp}%
+                    \@for\n:={11,21,31,41}\do{%
+                            \pgfmathparse{\wl@shadebegin+(\n-1)*\wl@shade@step}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
+                            \wlcolor{\wl@currentwl}%
+                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
+                            \pgfmathparse{25+(log10(\wl@currentwl)*50-log10(\wl@shadebegin)*50)/\wl@shade@logscale@factor}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
+                            }%
+                    \wlcolor{\wl@shadeend}%
+                    \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                    \colorlet{wlshcolLI}{wlcolor}%
+                    \edef\xLI{75bp}%
+                    % the horizontal shading
+                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.94bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.95bp)=(wlshcolI);%
+                        color(\xI)=(wlshcolI);color(\xXI)=(wlshcolXI);color(\xXXI)=(wlshcolXXI);color(\xXXXI)=(wlshcolXXXI);color(\xXLI)=(wlshcolXLI);color(\xLI)=(wlshcolLI);%
+                        color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
+                \fi% amp>5
+            \else% \wl@logshadefalse
+                \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
+                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
+                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
+                            \pgfmathparse{\wl@shadebegin+(\n-1)*\wl@shade@step}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
+                            \wlcolor{\wl@currentwl}%
+                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
+                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
+                            \pgfmathparse{24+\n}%
+                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
+                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
+                            }%
+                % the horizontal shading
+                \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.94bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.95bp)=(wlshcolI);%
+                    color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
+                    color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
+            \fi% \ifwl@logshade
+        \fi% \wl@shadeend@pt>780pt
+    \fi%\wl@shadebegin@pt<380pt\relax
+\fi\fi% \wl@shadeend@pt<380pt || \wl@shadebegin@pt>780pt
+\fi% \wl@shadeend@pt<\wl@shadebegin@pt
+\fi\fi% wl<0nm && wl > 16000 nm
 }%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % \pgfspectraplotmap[<l|h>]{name}
@@ -1133,8 +1465,11 @@ color(\xF)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=
 \def\wl@pgfspectraplotmap[#1]#2{\ignorespaces%
 \def\wl@test{#1}\def\wl@l{l}\def\wl@h{h}%
 \ifx\wl@test\wl@l\relax%
-\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
-\pgfmathparse{380+(\n-1)*8}\edef\wl@currentwl{\pgfmathresult}%
+\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
+21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
+38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
+%\pgfmathparse{380+(\n-1)*8}\edef\wl@currentwl{\pgfmathresult}%
+\pgfmathparse{372+8*\n}\edef\wl@currentwl{\pgfmathresult}%
 \wlcolor{\wl@currentwl}%
 \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%%
 }%
@@ -1190,8 +1525,11 @@ rainbow transparency/.default=0}% -> 0%
 \pgfmathparse{\wl@rainbowstart-1/50*(\wl@rainbowend-\wl@rainbowstart)}%
 \pgfmathprintnumberto{\pgfmathresult}{\wl@rainbowresult}%
 \edef\rO{\wl@rainbowresult pt}%
-\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
-\pgfmathparse{380+(\n-1)*8}\edef\wl@currentwl{\pgfmathresult}%
+\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
+21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
+38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
+%\pgfmathparse{380+(\n-1)*8}\edef\wl@currentwl{\pgfmathresult}%
+\pgfmathparse{372+8*\n}\edef\wl@currentwl{\pgfmathresult}%
 \wlcolor{\wl@currentwl}%
 \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor!100!transparent!\wl@rainbow@transp}%
 \pgfmathparse{\wl@rainbowstart+1/50*(\n-1)*(\wl@rainbowend-\wl@rainbowstart)}%
-- 
cgit v1.2.3

