%%
%% This is file `dataplot-2019-09-27.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% datatool.dtx  (with options: `dataplot-2019-09-27.sty,package')
%% 
%%  datatool.dtx
%%  Copyright 2025 Nicola Talbot
%% 
%%  This work may be distributed and/or modified under the
%%  conditions of the LaTeX Project Public License, either version 1.3
%%  of this license or (at your option) any later version.
%%  The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%%  and version 1.3 or later is part of all distributions of LaTeX
%%  version 2005/12/01 or later.
%% 
%%  This work has the LPPL maintenance status `maintained'.
%% 
%%  The Current Maintainer of this work is Nicola Talbot.
%% 
%%  This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-undetermined.ldf, datatool-latin1.ldf, datatool-utf8.ldf, datatool-l3fp.def, datatool-lua.def, datatool-fp.def, datatool-fp.sty, datatool-pgfmath.def, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst, databar-2019-09-27.sty, databib-2019-09-27.sty, datagidx-2019-09-27.sty, datapie-2019-09-27.sty, dataplot-2019-09-27.sty, datatool-2019-09-27.sty, datatool-base-2019-09-27.sty, datatool-fp-2019-09-27.sty, datatool-pgfmath-2019-09-27.sty, person-2019-09-27.sty.
%% 
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{dataplot}[2019/09/27 v2.32 (NLCT)]
\RequirePackage{xkeyval}
\RequirePackage{tikz}
\RequirePackage{datatool}[=v2.32]
\usetikzlibrary{plotmarks}
\usetikzlibrary{plothandlers}
\usetikzlibrary{calc}
\newcommand*{\DTLplotstream}[4][\boolean{true}]{%
  \@sDTLforeach[#1]{#2}{\dtl@x=#3,\dtl@y=#4}{%
    \DTLconverttodecimal{\dtl@x}{\dtl@decx}%
    \DTLconverttodecimal{\dtl@y}{\dtl@decy}%
    \pgfplotstreampoint{\pgfpointxy{\dtl@decx}{\dtl@decy}}%
  }%
}
\newcommand*{\DTLplotmarks}{%
  \pgfuseplotmark{o},%
  \pgfuseplotmark{x},%
  \pgfuseplotmark{+},%
  \pgfuseplotmark{square},%
  \pgfuseplotmark{triangle},%
  \pgfuseplotmark{diamond},%
  \pgfuseplotmark{pentagon},%
  \pgfuseplotmark{asterisk},%
  \pgfuseplotmark{star}%
}
\newcommand*{\DTLplotmarkcolors}{%
  red,%
  green,%
  blue,%
  yellow,%
  magenta,%
  cyan,%
  orange,%
  black,%
  gray}
\newcommand*{\DTLplotlines}{%
  \pgfsetdash{}{0pt},% solid line
  \pgfsetdash{{10pt}{5pt}}{0pt},%
  \pgfsetdash{{5pt}{5pt}}{0pt},%
  \pgfsetdash{{1pt}{5pt}}{0pt},%
  \pgfsetdash{{5pt}{5pt}{1pt}{5pt}}{0pt},%
  \pgfsetdash{{1pt}{3pt}}{0pt},%
}
\newcommand*{\DTLplotlinecolors}{%
  red,%
  green,%
  blue,%
  yellow,%
  magenta,%
  cyan,%
  orange,%
  black,%
  gray}
\newlength\DTLplotwidth
\setlength\DTLplotwidth{4in}
\newlength\DTLplotheight
\setlength\DTLplotheight{4in}
\newlength\DTLticklength
\setlength\DTLticklength{5pt}
\newlength\DTLminorticklength
\setlength\DTLminorticklength{2pt}
\newlength\DTLticklabeloffset
\setlength\DTLticklabeloffset{8pt}
\newlength\dtl@xticlabelheight
\newlength\dtl@yticlabelwidth
\newlength\DTLmintickgap
\setlength\DTLmintickgap{20pt}
\newlength\DTLminminortickgap
\setlength\DTLminminortickgap{5pt}
\newcounter{DTLplotroundXvar}
\setcounter{DTLplotroundXvar}{2}
\newcounter{DTLplotroundYvar}
\setcounter{DTLplotroundYvar}{2}
\newif\ifDTLxaxis
\DTLxaxistrue
\newcommand*{\DTLXAxisStyle}{-}
\newif\ifDTLyaxis
\DTLyaxistrue
\newcommand*{\DTLYAxisStyle}{-}
\newcommand*{\DTLmajorgridstyle}{color=gray,-}
\newcommand*{\DTLminorgridstyle}{color=gray,loosely dotted}
\newif\ifDTLxticsin
\DTLxticsintrue
\newif\ifDTLyticsin
\DTLyticsintrue
\newcount\dtl@legendsetting
\newlength\DTLlegendxoffset
\setlength\DTLlegendxoffset{10pt}
\newlength\DTLlegendyoffset
\setlength\DTLlegendyoffset{10pt}
\newcommand*{\DTLformatlegend}[1]{%
\setlength{\fboxrule}{1.1pt}%
\fcolorbox{black}{white}{#1}}
\newif\ifDTLshowmarkers
\DTLshowmarkerstrue
\newif\ifDTLshowlines
\DTLshowlinesfalse
\newcommand*{\DTLplotatbegintikz}{}
\newcommand*{\@dtlplothandlermark}[1]{%
  \pgfplothandlermark
  {%
    \pgfmathparse{1/\dtl@scale@x}%
    \pgftransformxscale{\pgfmathresult}%
    \pgfmathparse{1/\dtl@scale@y}%
    \pgftransformyscale{\pgfmathresult}%
   #1%
   }%
}
\newcommand*{\dtlplothandlermark}[1]{%
   \PackageWarning{dataplot}{\string\dtlplothandlermark\space
     found outside \string\DTLplot}%
  \pgfplothandlermark{#1}%
}
\newcommand*{\DTLplotatendtikz}{}
\define@key{dataplot}{x}{%
\def\dtl@xkey{#1}}
\define@key{dataplot}{y}{%
\def\dtl@ykey{#1}}
\define@key{dataplot}{markcolors}{%
\def\DTLplotmarkcolors{#1}}
\define@key{dataplot}{linecolors}{%
\def\DTLplotlinecolors{#1}}
\define@key{dataplot}{colors}{%
\def\DTLplotmarkcolors{#1}%
\def\DTLplotlinecolors{#1}}
\define@key{dataplot}{marks}{%
\def\DTLplotmarks{#1}}
\define@key{dataplot}{lines}{%
\def\DTLplotlines{#1}}
\define@key{dataplot}{width}{%
\setlength\DTLplotwidth{#1}}
\define@key{dataplot}{height}{%
\setlength\DTLplotheight{#1}}
\define@choicekey{dataplot}{style}[\val\nr]{both,lines,markers}{%
\ifcase\nr\relax
 \DTLshowlinestrue
 \DTLshowmarkerstrue
\or
 \DTLshowlinestrue
 \DTLshowmarkersfalse
\or
 \DTLshowmarkerstrue
 \DTLshowlinesfalse
\fi}
\define@choicekey{dataplot}{axes}[\val\nr]{both,x,y,none}[both]{%
\ifcase\nr\relax
 % both
 \DTLxaxistrue
 \DTLxticstrue
 \DTLyaxistrue
 \DTLyticstrue
\or % x
 \DTLxaxistrue
 \DTLxticstrue
 \DTLyaxisfalse
 \DTLyticsfalse
\or % y
 \DTLxaxisfalse
 \DTLxticsfalse
 \DTLyaxistrue
 \DTLyticstrue
\or % none
 \DTLxaxisfalse
 \DTLxticsfalse
 \DTLyaxisfalse
 \DTLyticsfalse
\fi
}
\define@boolkey{dataplot}[DTL]{box}[true]{}
\DTLboxfalse
\define@boolkey{dataplot}[DTL]{xtics}[true]{}
\DTLxticstrue
\define@boolkey{dataplot}[DTL]{ytics}[true]{}
\DTLyticstrue
\define@boolkey{dataplot}[DTL]{xminortics}[true]{%
\ifDTLxminortics \DTLxticstrue\fi}
\DTLxminorticsfalse
\define@boolkey{dataplot}[DTL]{yminortics}[true]{%
\ifDTLyminortics \DTLyticstrue\fi}
\DTLyminorticsfalse
\define@boolkey{dataplot}[DTL]{grid}[true]{}
\define@choicekey{dataplot}{xticdir}[\val\nr]{in,out}{%
\ifcase\nr\relax
 \DTLxticsintrue
\or
 \DTLxticsinfalse
\fi
}
\define@choicekey{dataplot}{yticdir}[\val\nr]{in,out}{%
\ifcase\nr\relax
 \DTLyticsintrue
\or
 \DTLyticsinfalse
\fi
}
\define@choicekey{dataplot}{ticdir}[\val\nr]{in,out}{%
\ifcase\nr\relax
 \DTLxticsintrue
 \DTLyticsintrue
\or
 \DTLxticsinfalse
 \DTLyticsinfalse
\fi
}
\define@key{dataplot}{bounds}{%
\def\dtl@bounds{#1}}
\let\dtl@bounds=\relax
\define@key{dataplot}{minx}{%
\def\dtl@minx{#1}}
\let\dtl@minx=\relax
\define@key{dataplot}{maxx}{%
\def\dtl@maxx{#1}}
\let\dtl@maxx=\relax
\define@key{dataplot}{miny}{%
\def\dtl@miny{#1}}
\let\dtl@miny=\relax
\define@key{dataplot}{maxy}{%
\def\dtl@maxy{#1}}
\let\dtl@maxy=\relax
\define@key{dataplot}{xticpoints}{%
\def\dtl@xticlist{#1}\DTLxticstrue\DTLxaxistrue}
\let\dtl@xticlist=\relax
\define@key{dataplot}{yticpoints}{%
\def\dtl@yticlist{#1}\DTLyticstrue\DTLyaxistrue}
\let\dtl@yticlist=\relax
\define@key{dataplot}{xticgap}{\def\dtl@xticgap{#1}%
\DTLxticstrue\DTLxaxistrue}
\let\dtl@xticgap=\relax
\define@key{dataplot}{yticgap}{\def\dtl@yticgap{#1}%
\DTLyticstrue\DTLyaxistrue}
\let\dtl@yticgap=\relax
\define@key{dataplot}{xticlabels}{%
\def\dtl@xticlabels{#1}\DTLxticstrue\DTLxaxistrue}
\let\dtl@xticlabels=\relax
\define@key{dataplot}{yticlabels}{%
\def\dtl@yticlabels{#1}\DTLyticstrue\DTLyaxistrue}
\let\dtl@yticlabels=\relax
\define@key{dataplot}{xlabel}{%
\def\dtl@xlabel{#1}}
\let\dtl@xlabel=\relax
\define@key{dataplot}{ylabel}{%
\def\dtl@ylabel{#1}}
\let\dtl@ylabel=\relax
\define@choicekey{dataplot}{legend}[\val\nr]{none,north,northeast,%
east,southeast,south,southwest,west,northwest}[northeast]{%
\dtl@legendsetting=\nr\relax
}
\define@key{dataplot}{legendlabels}{\def\dtl@legendlabels{#1}}
\newcommand*{\DTLplot}[3][\boolean{true}]{%
\bgroup
  \let\dtl@xkey=\relax
  \let\dtl@ykey=\relax
  \let\dtl@legendlabels=\relax
  \setkeys{dataplot}{#3}%
  \let\dtl@plotmarklist=\DTLplotmarks
  \let\dtl@plotlinelist=\DTLplotlines
  \let\dtl@plotmarkcolorlist=\DTLplotmarkcolors
  \let\dtl@plotlinecolorlist=\DTLplotlinecolors
  \def\dtl@legend{}%
  \ifx\dtl@legendlabels\relax
   \edef\dtl@legendlabels{#2}%
  \fi
  \ifx\dtl@xkey\relax
    \PackageError{dataplot}{Missing x setting for
      \string\DTLplot}{}%
  \else
    \ifx\dtl@ykey\relax
      \PackageError{dataplot}{Missing y setting for
      \string\DTLplot}{}%
    \else
      \ifx\dtl@bounds\relax
        \DTLcomputebounds[#1]{#2}{\dtl@xkey}{\dtl@ykey}
            {\DTLminX}{\DTLminY}{\DTLmaxX}{\DTLmaxY}%
        \ifx\dtl@minx\relax
        \else
           \let\DTLminX=\dtl@minx
        \fi
        \ifx\dtl@maxx\relax
        \else
           \let\DTLmaxX=\dtl@maxx
        \fi
        \ifx\dtl@miny\relax
        \else
           \let\DTLminY=\dtl@miny
        \fi
        \ifx\dtl@maxy\relax
        \else
           \let\DTLmaxY=\dtl@maxy
        \fi
      \else
        \expandafter\dtl@getbounds\dtl@bounds\@nil
      \fi
      \@dtl@tmpcount=\DTLplotwidth
      \divide\@dtl@tmpcount by 65536\relax
      \dtlsub{\dtl@dx}{\DTLmaxX}{\DTLminX}%
      \dtldiv{\dtl@scale@x}{\number\@dtl@tmpcount}{\dtl@dx}%
      \dtlmul{\dtl@offset@x}{-\dtl@scale@x}{\DTLminX}%
      \@dtl@tmpcount=\DTLplotheight
      \divide\@dtl@tmpcount by 65536\relax
      \dtlsub{\dtl@dy}{\DTLmaxY}{\DTLminY}%
      \dtldiv{\dtl@scale@y}{\number\@dtl@tmpcount}{\dtl@dy}%
      \dtlmul{\dtl@offset@y}{-\dtl@scale@y}{\DTLminY}%
     \ifDTLxtics
       \ifx\dtl@xticlist\relax
         \ifx\dtl@xticgap\relax
         \dtlsub{\dtl@mingap}{\number\DTLmintickgap}{\dtl@offset@x}%
         \dtldiv{\dtl@mingap}{\dtl@mingap}{\dtl@scale@x}%
         \dtldiv{\dtl@mingap}{\dtl@mingap}{65536}%
           \dtl@constructticklist\DTLminX\DTLmaxX
             \dtl@mingap\dtl@xticlist
         \else
           \DTLifFPopenbetween{0}{\DTLminX}{\DTLmaxX}{%
             \dtl@constructticklistwithgapz
               \DTLminX\DTLmaxX\dtl@xticlist\dtl@xticgap}{%
             \dtl@constructticklistwithgap
               \DTLminX\DTLmaxX\dtl@xticlist\dtl@xticgap}%
         \fi
       \fi
       \let\dtl@xminorticlist\@empty
       \ifDTLxminortics
         \let\dtl@prevtick=\relax
         \@for\dtl@nexttick:=\dtl@xticlist\do{%
           \ifx\dtl@prevtick\relax
           \else
             \dtl@constructminorticklist
                \dtl@prevtick\dtl@nexttick\dtl@scale@x\dtl@xminorticlist
           \fi
           \let\dtl@prevtick=\dtl@nexttick
         }%
       \fi
       \ifx\dtl@xticlabels\relax
         \settoheight{\dtl@xticlabelheight}{\dtl@xticlist}%
       \else
         \settoheight{\dtl@xticlabelheight}{\dtl@xticlabels}%
        \fi
     \else
       \setlength{\dtl@xticlabelheight}{0pt}%
     \fi
     \setlength{\dtl@yticlabelwidth}{0pt}%
     \ifDTLytics
       \ifx\dtl@yticlist\relax
         \ifx\dtl@yticgap\relax
         \dtlsub{\dtl@mingap}{\number\DTLmintickgap}{\dtl@offset@y}%
         \dtldiv{\dtl@mingap}{\dtl@mingap}{\dtl@scale@y}%
         \dtldiv{\dtl@mingap}{\dtl@mingap}{65536}%
         \dtl@constructticklist\DTLminY\DTLmaxY
           \dtl@mingap\dtl@yticlist
         \else
           \DTLifFPopenbetween{0}{\DTLminY}{\DTLmaxY}{%
             \dtl@constructticklistwithgapz
               \DTLminY\DTLmaxY\dtl@yticlist\dtl@yticgap}{%
             \dtl@constructticklistwithgap
               \DTLminY\DTLmaxY\dtl@yticlist\dtl@yticgap}%
         \fi
       \fi
       \let\dtl@yminorticlist\@empty
       \ifDTLyminortics
         \let\dtl@prevtick=\relax
         \@for\dtl@nexttick:=\dtl@yticlist\do{%
           \ifx\dtl@prevtick\relax
           \else
             \dtl@constructminorticklist
                \dtl@prevtick\dtl@nexttick\dtl@scale@y\dtl@yminorticlist
           \fi
           \let\dtl@prevtick=\dtl@nexttick
         }%
       \fi
       \ifx\dtl@ylabel\relax
       \else
         \ifx\dtl@yticlabels\relax
           \@for\dtl@thislabel:=\dtl@yticlist\do{%
             \dtlround{\dtl@thislabel}{\dtl@thislabel}
                     {\c@DTLplotroundYvar}%
             \settowidth{\dtl@tmplength}{\dtl@thislabel}%
             \ifdim\dtl@tmplength>\dtl@yticlabelwidth
               \setlength{\dtl@yticlabelwidth}{\dtl@tmplength}%
             \fi
           }%
         \else
           \@for\dtl@thislabel:=\dtl@yticlabels\do{%
             \settowidth{\dtl@tmplength}{\dtl@thislabel}%
             \ifdim\dtl@tmplength>\dtl@yticlabelwidth
               \setlength{\dtl@yticlabelwidth}{\dtl@tmplength}%
             \fi
           }%
         \fi
       \fi
     \fi
       \begin{tikzpicture}
       \pgfsetxvec{\pgfpoint{1pt}{0pt}}%
       \pgfsetyvec{\pgfpoint{0pt}{1pt}}%
   \begin{scope}
   \pgftransformcm{\dtl@scale@x}{0}{0}{\dtl@scale@y}%
     {\pgfpoint{\dtl@offset@x pt}{\dtl@offset@y pt}}%
       \let\dtlplothandlermark\@dtlplothandlermark
       \DTLplotatbegintikz
       \ifDTLbox
         \draw (\DTLminX,\DTLminY) -- (\DTLmaxX,\DTLminY) --
             (\DTLmaxX,\DTLmaxY) -- (\DTLminX,\DTLmaxY) --
               cycle;
       \else
          \ifDTLxaxis
            \expandafter\draw\expandafter[\DTLXAxisStyle]
            (\DTLminX,\DTLminY) -- (\DTLmaxX,\DTLminY);
          \fi
          \ifDTLyaxis
            \expandafter\draw\expandafter[\DTLYAxisStyle]
            (\DTLminX,\DTLminY) -- (\DTLminX,\DTLmaxY);
          \fi
       \fi
       \ifDTLgrid
          \ifDTLxminortics
            \@for\dtl@thistick:=\dtl@xminorticlist\do{%
              \expandafter\draw\expandafter[\DTLminorgridstyle]
             (\dtl@thistick,\DTLminY) -- (\dtl@thistick,\DTLmaxY);
            }%
          \fi
          \ifDTLyminortics
            \@for\dtl@thistick:=\dtl@yminorticlist\do{%
              \expandafter\draw\expandafter[\DTLminorgridstyle]
             (\DTLminX,\dtl@thistick) -- (\DTLmaxX,\dtl@thistick);
            }%
          \fi
          \@for\dtl@thistick:=\dtl@xticlist\do{%
            \expandafter\draw\expandafter[\DTLmajorgridstyle]
             (\dtl@thistick,\DTLminY) -- (\dtl@thistick,\DTLmaxY);
          }%
          \@for\dtl@thistick:=\dtl@yticlist\do{%
            \expandafter\draw\expandafter[\DTLmajorgridstyle]
             (\DTLminX,\dtl@thistick) -- (\DTLmaxX,\dtl@thistick);
          }%
       \fi
       \ifDTLxtics
         \dtlsub{\dtl@ticklength}{\number\DTLticklength}{-\dtl@offset@y}%
         \dtldiv{\dtl@ticklength}{\dtl@ticklength}{\dtl@scale@y}%
         \dtldiv{\dtl@ticklength}{\dtl@ticklength}{65536}%
         \addtolength\dtl@xticlabelheight{\DTLticklabeloffset}%
         \dtlsub{\dtl@ticlabeloffset}{\number\dtl@xticlabelheight}{-\dtl@offset@y}%
         \dtldiv{\dtl@ticlabeloffset}{\dtl@ticlabeloffset}{\dtl@scale@y}%
         \dtldiv{\dtl@ticlabeloffset}{\dtl@ticlabeloffset}{65536}%
         \@for\dtl@thistick:=\dtl@xticlist\do{%
           \let\dtl@thisticklabel\dtl@thistick
           \ifx\dtl@xticlabels\relax
             \dtlround{\dtl@thislabel}{\dtl@thistick}
                     {\c@DTLplotroundXvar}%
           \else
             \dtl@chopfirst\dtl@xticlabels\dtl@thislabel\dtl@rest
             \let\dtl@xticlabels=\dtl@rest
           \fi
           \ifDTLxticsin
             \draw (\dtl@thistick,\DTLminY) -- ++(0,\dtl@ticklength);
             \draw (\dtl@thistick,\DTLminY)
                 ++ (0,-\dtl@ticlabeloffset) node {\dtl@thislabel};
           \else
             \draw (\dtl@thistick,\DTLminY) -- ++(0,-\dtl@ticklength)
                 ++ (0,-\dtl@ticlabeloffset) node {\dtl@thislabel};
           \fi
           \ifDTLbox
             \ifDTLxticsin
               \draw (\dtl@thistick,\DTLmaxY) -- ++(0,-\dtl@ticklength);
             \else
             \draw (\dtl@thistick,\DTLmaxY) -- ++(0,\dtl@ticklength);
             \fi
           \fi
         }%
       \fi
      \ifx\dtl@xlabel\relax
      \else
         \dtladd{\dtl@x}{\number\baselineskip}{\dtl@offset@y}%
         \dtldiv{\dtl@x}{\dtl@x}{\dtl@scale@y}%
         \dtldiv{\dtl@x}{\dtl@x}{65536}%
         \dtladd{\dtl@ticlabeloffset}{\dtl@ticlabeloffset}{\dtl@x}%
         \dtlmul{\dtl@x}{\dtl@dx}{0.5}%
         \draw (\DTLminX,\DTLminY) ++(\dtl@x,-\dtl@ticlabeloffset)
            node[anchor=north] {\dtl@xlabel};
      \fi
      \ifDTLxminortics
         \dtlsub{\dtl@ticklength}{\number\DTLminorticklength}{-\dtl@offset@y}%
         \dtldiv{\dtl@ticklength}{\dtl@ticklength}{\dtl@scale@y}%
         \dtldiv{\dtl@ticklength}{\dtl@ticklength}{65536}%
         \@for\dtl@thistick:=\dtl@xminorticlist\do{%
           \ifDTLxticsin
             \draw (\dtl@thistick,\DTLminY) -- ++(0,\dtl@ticklength);
             \draw (\dtl@thistick,\DTLminY)
                 ++ (0,-\dtl@ticlabeloffset) node[anchor=north] {\dtl@thislabel};
           \else
             \draw (\dtl@thistick,\DTLminY) -- ++(0,-\dtl@ticklength)
                 ++ (0,-\dtl@ticlabeloffset) node[anchor=north] {\dtl@thislabel};
           \fi
           \ifDTLbox
             \ifDTLxticsin
               \draw (\dtl@thistick,\DTLmaxY) -- ++(0,-\dtl@ticklength);
             \else
             \draw (\dtl@thistick,\DTLmaxY) -- ++(0,\dtl@ticklength);
             \fi
           \fi
        }%
      \fi
      \ifDTLytics
         \dtlsub{\dtl@ticklength}{\number\DTLticklength}{-\dtl@offset@x}%
         \dtldiv{\dtl@ticklength}{\dtl@ticklength}{\dtl@scale@x}%
         \dtldiv{\dtl@ticklength}{\dtl@ticklength}{65536}%
         \dtladd{\dtl@ticlabeloffset}{\number\DTLticklabeloffset}{0}%
         \dtlsub{\dtl@ticlabeloffset}{\number\DTLticklabeloffset}{-\dtl@offset@x}%
         \dtldiv{\dtl@ticlabeloffset}{\dtl@ticlabeloffset}{\dtl@scale@x}%
         \dtldiv{\dtl@ticlabeloffset}{\dtl@ticlabeloffset}{65536}%
         \@for\dtl@thistick:=\dtl@yticlist\do{%
           \let\dtl@thisticklabel\dtl@thistick
           \ifx\dtl@yticlabels\relax
             \dtlround{\dtl@thislabel}{\dtl@thistick}
                     {\c@DTLplotroundXvar}%
           \else
             \dtl@chopfirst\dtl@yticlabels\dtl@thislabel\dtl@rest
             \let\dtl@yticlabels=\dtl@rest
           \fi
           \ifDTLyticsin
             \draw (\DTLminX,\dtl@thistick) -- ++(\dtl@ticklength,0);
             \draw (\DTLminX,\dtl@thistick)
                 ++ (-\dtl@ticlabeloffset,0) node[anchor=east] {\dtl@thislabel};
           \else
             \draw (\DTLminX,\dtl@thistick) -- ++(-\dtl@ticklength,0)
                 ++ (-\dtl@ticlabeloffset,0) node[anchor=east] {\dtl@thislabel};
           \fi
           \ifDTLbox
             \ifDTLyticsin
               \draw (\DTLmaxX,\dtl@thistick) -- ++(-\dtl@ticklength,0);
             \else
             \draw (\DTLmaxX,\dtl@thistick) -- ++(\dtl@ticklength,0);
             \fi
           \fi
         }%
      \fi
      \ifx\dtl@ylabel\relax
      \else
         \setlength{\dtl@tmplength}{\baselineskip}%
         \addtolength{\dtl@tmplength}{\dtl@yticlabelwidth}%
         \addtolength{\dtl@tmplength}{\DTLticklabeloffset}%
         \dtlsub{\dtl@ticlabeloffset}{\number\dtl@tmplength}{-\dtl@offset@x}%
         \dtldiv{\dtl@ticlabeloffset}{\dtl@ticlabeloffset}{\dtl@scale@x}%
         \dtldiv{\dtl@ticlabeloffset}{\dtl@ticlabeloffset}{65536}%
         \dtlmul{\dtl@y}{\dtl@dy}{0.5}%
         \draw (\DTLminX,\DTLminY) ++(-\dtl@ticlabeloffset,\dtl@y)
            node[rotate=90,anchor=south] {\dtl@ylabel};
      \fi
      \ifDTLyminortics
         \dtlsub{\dtl@ticklength}{\number\DTLminorticklength}{-\dtl@offset@x}%
         \dtldiv{\dtl@ticklength}{\dtl@ticklength}{\dtl@scale@x}%
         \dtldiv{\dtl@ticklength}{\dtl@ticklength}{65536}%
         \@for\dtl@thistick:=\dtl@yminorticlist\do{%
           \ifDTLyticsin
             \draw (\DTLminX,\dtl@thistick) -- ++(\dtl@ticklength,0);
           \else
             \draw (\DTLminX,\dtl@thistick) -- ++(-\dtl@ticklength,0);
           \fi
           \ifDTLbox
             \ifDTLyticsin
               \draw (\DTLmaxX,\dtl@thistick) -- ++(-\dtl@ticklength,0);
             \else
             \draw (\DTLmaxX,\dtl@thistick) -- ++(\dtl@ticklength,0);
             \fi
           \fi
        }%
      \fi
   \end{scope}
        \@for\dtl@thisdb:=#2\do{%
          \ifx\dtl@plotmarkcolorlist\@empty
            \let\dtl@plotmarkcolorlist=\DTLplotmarkcolors
          \fi
          \dtl@chopfirst\dtl@plotmarkcolorlist\dtl@thisplotmarkcolor
             \dtl@remainder
          \let\dtl@plotmarkcolorlist=\dtl@remainder
          \ifDTLshowmarkers
            \ifx\dtl@plotmarklist\@empty
               \let\dtl@plotmarklist=\DTLplotmarks
            \fi
            \dtl@chopfirst\dtl@plotmarklist\dtl@thisplotmark
               \dtl@remainder
            \let\dtl@plotmarklist=\dtl@remainder
            \ifx\dtl@thisplotmark\relax
              \let\dtl@mark=\relax
            \else
              \expandafter\toks@\expandafter{\dtl@thisplotmark}%
              \ifx\dtl@thisplotmarkcolor\@empty
                \edef\dtl@mark{\the\toks@}%
              \else
                \edef\dtl@mark{%
                    \noexpand\color{\dtl@thisplotmarkcolor}%
                  \the\toks@}%
              \fi
            \fi
          \else
            \let\dtl@mark=\relax
          \fi
          \ifx\dtl@plotlinecolorlist\@empty
            \let\dtl@plotlinecolorlist=\DTLplotlinecolors
          \fi
          \dtl@chopfirst\dtl@plotlinecolorlist\dtl@thisplotlinecolor
             \dtl@remainder
          \let\dtl@plotlinecolorlist=\dtl@remainder
          \ifDTLshowlines
            \ifx\dtl@plotlinelist\@empty
               \let\dtl@plotlinelist=\DTLplotlines
            \fi
            \dtl@chopfirst\dtl@plotlinelist\dtl@thisplotline
               \dtl@remainder
            \let\dtl@plotlinelist=\dtl@remainder
            \expandafter\ifx\dtl@thisplotline\relax
            \let\dtl@linestyle=\relax
          \else
            \expandafter\toks@\expandafter{\dtl@thisplotline}%
            \ifx\dtl@thisplotlinecolor\@empty
              \edef\dtl@linestyle{\the\toks@}%
            \else
              \edef\dtl@linestyle{%
                  \noexpand\color{\dtl@thisplotlinecolor}%
                \the\toks@}%
            \fi
          \fi
        \else
          \let\dtl@linestyle=\relax
        \fi
        \ifnum\dtl@legendsetting>0\relax
          \dtl@chopfirst\dtl@legendlabels\dtl@thislabel\dtl@rest
          \let\dtl@legendlabels=\dtl@rest
          \expandafter\toks@\expandafter{\dtl@mark}%
          \expandafter\@dtl@toks\expandafter{\dtl@linestyle}%
          \edef\dtl@addtolegend{\noexpand\DTLaddtoplotlegend
            {\the\toks@}{\the\@dtl@toks}{\dtl@thislabel}}%
          \dtl@addtolegend
        \fi
        \def\dtl@stream{\pgfplotstreamstart}%
        \@sDTLforeach[#1]{\dtl@thisdb}{\dtl@x=\dtl@xkey,%
            \dtl@y=\dtl@ykey}{%
          \DTLconverttodecimal{\dtl@x}{\dtl@decx}%
          \DTLconverttodecimal{\dtl@y}{\dtl@decy}%
          \ifthenelse{%
            \DTLisclosedbetween{\dtl@x}{\DTLminX}{\DTLmaxX}%
            \and
            \DTLisclosedbetween{\dtl@y}{\DTLminY}{\DTLmaxY}%
            }%
            {%
              \expandafter\toks@\expandafter{\dtl@stream}%
              \dtlmul{\dtl@decx}{\dtl@decx}{\dtl@scale@x}%
              \dtladd{\dtl@decx}{\dtl@decx}{\dtl@offset@x}%
              \dtlround{\dtl@decx}{\dtl@decx}{1}%
              \dtlmul{\dtl@decy}{\dtl@decy}{\dtl@scale@y}%
              \dtladd{\dtl@decy}{\dtl@decy}{\dtl@offset@y}%
              \dtlround{\dtl@decy}{\dtl@decy}{1}%
              \edef\dtl@stream{\the\toks@
                \noexpand\pgfplotstreampoint
                 {\noexpand\pgfpointxy{\dtl@decx}{\dtl@decy}}}%
          }{}%
        }%
        \expandafter\toks@\expandafter{\dtl@stream}%
        \edef\dtl@stream{\the\toks@\noexpand\pgfplotstreamend}%
        \ifx\dtl@linestyle\relax
        \else
          \begin{scope}
          \dtl@linestyle
          \pgfplothandlerlineto
          \dtl@stream
          \pgfusepath{stroke}
          \end{scope}
        \fi
        \ifx\dtl@mark\relax
        \else
          \begin{scope}
          \pgfplothandlermark{\dtl@mark}%
          \dtl@stream
          \pgfusepath{stroke}
          \end{scope}
        \fi
        }%
        \ifcase\dtl@legendsetting
      % none
        \or % north
         \dtlmul{\dtl@decx}{\dtl@dx}{0.5}%
         \dtladd{\dtl@decx}{\DTLminX}{\dtl@decx}%
         \dtlmul{\dtl@decx}{\dtl@decx}{\dtl@scale@x}%
         \dtladd{\dtl@decx}{\dtl@decx}{\dtl@offset@x}%
         \dtlmul{\dtl@decy}{\DTLmaxY}{\dtl@scale@y}%
         \dtladd{\dtl@decy}{\dtl@decy}{\dtl@offset@y}%
         \draw (\dtl@decx,\dtl@decy) ++(0,-\DTLlegendyoffset)
            node[anchor=north]
            {\DTLformatlegend
              {\begin{tabular}{cl}\dtl@legend\end{tabular}}%
            };
        \or % north east
         \dtlmul{\dtl@decx}{\DTLmaxX}{\dtl@scale@x}%
         \dtladd{\dtl@decx}{\dtl@decx}{\dtl@offset@x}%
         \dtlmul{\dtl@decy}{\DTLmaxY}{\dtl@scale@y}%
         \dtladd{\dtl@decy}{\dtl@decy}{\dtl@offset@y}%
         \draw (\dtl@decx,\dtl@decy) ++(-\DTLlegendxoffset,-\DTLlegendyoffset)
            node[anchor=north east]
            {\DTLformatlegend
              {\begin{tabular}{cl}\dtl@legend\end{tabular}}%
            };
        \or % east
         \dtlmul{\dtl@decy}{\dtl@dy}{0.5}%
         \dtladd{\dtl@decy}{\DTLminY}{\dtl@decy}%
         \dtlmul{\dtl@decy}{\dtl@decy}{\dtl@scale@y}%
         \dtladd{\dtl@decy}{\dtl@decy}{\dtl@offset@y}%
         \dtlmul{\dtl@decx}{\DTLmaxX}{\dtl@scale@x}%
         \dtladd{\dtl@decx}{\dtl@decx}{\dtl@offset@x}%
         \draw (\dtl@decx,\dtl@decy) ++(-\DTLlegendxoffset,0)
            node[anchor=east]
            {\DTLformatlegend
              {\begin{tabular}{cl}\dtl@legend\end{tabular}}%
            };
        \or % south east
         \dtlmul{\dtl@decx}{\DTLmaxX}{\dtl@scale@x}%
         \dtladd{\dtl@decx}{\dtl@decx}{\dtl@offset@x}%
         \dtlmul{\dtl@decy}{\DTLminY}{\dtl@scale@y}%
         \dtladd{\dtl@decy}{\dtl@decy}{\dtl@offset@y}%
         \draw (\dtl@decx,\dtl@decy) ++(-\DTLlegendxoffset,\DTLlegendyoffset)
            node[anchor=south east]
            {\DTLformatlegend
              {\begin{tabular}{cl}\dtl@legend\end{tabular}}%
            };
        \or % south
         \dtlmul{\dtl@decx}{\dtl@dx}{0.5}%
         \dtladd{\dtl@decx}{\DTLminX}{\dtl@decx}%
         \dtlmul{\dtl@decx}{\dtl@decx}{\dtl@scale@x}%
         \dtladd{\dtl@decx}{\dtl@decx}{\dtl@offset@x}%
         \dtlmul{\dtl@decy}{\DTLminY}{\dtl@scale@y}%
         \dtladd{\dtl@decy}{\dtl@decy}{\dtl@offset@y}%
         \draw (\dtl@decx,\dtl@decy) ++(0,\DTLlegendyoffset)
            node[anchor=south]
            {\DTLformatlegend
              {\begin{tabular}{cl}\dtl@legend\end{tabular}}%
            };
        \or % south west
         \dtlmul{\dtl@decx}{\DTLminX}{\dtl@scale@x}%
         \dtladd{\dtl@decx}{\dtl@decx}{\dtl@offset@x}%
         \dtlmul{\dtl@decy}{\DTLminY}{\dtl@scale@y}%
         \dtladd{\dtl@decy}{\dtl@decy}{\dtl@offset@y}%
         \draw (\dtl@decx,\dtl@decy) ++(\DTLlegendxoffset,\DTLlegendyoffset)
            node[anchor=south west]
            {\DTLformatlegend
              {\begin{tabular}{cl}\dtl@legend\end{tabular}}%
            };
        \or % west
         \dtlmul{\dtl@decy}{\dtl@dy}{0.5}%
         \dtladd{\dtl@decy}{\DTLminY}{\dtl@decy}%
         \dtlmul{\dtl@decy}{\dtl@decy}{\dtl@scale@y}%
         \dtladd{\dtl@decy}{\dtl@decy}{\dtl@offset@y}%
         \dtlmul{\dtl@decx}{\DTLminX}{\dtl@scale@x}%
         \dtladd{\dtl@decx}{\dtl@decx}{\dtl@offset@x}%
         \draw (\dtl@decx,\dtl@decy) ++(\DTLlegendxoffset,0)
            node[anchor=west]
            {\DTLformatlegend
              {\begin{tabular}{cl}\dtl@legend\end{tabular}}%
            };
        \or % north west
         \dtlmul{\dtl@decx}{\DTLminX}{\dtl@scale@x}%
         \dtladd{\dtl@decx}{\dtl@decx}{\dtl@offset@x}%
         \dtlmul{\dtl@decy}{\DTLmaxY}{\dtl@scale@y}%
         \dtladd{\dtl@decy}{\dtl@decy}{\dtl@offset@y}%
         \draw (\dtl@decx,\dtl@decy) ++(\DTLlegendxoffset,-\DTLlegendyoffset)
            node[anchor=north west]
            {\DTLformatlegend
              {\begin{tabular}{cl}\dtl@legend\end{tabular}}%
            };
        \fi
       \pgftransformcm{\dtl@scale@x}{0}{0}{\dtl@scale@y}%
         {\pgfpoint{\dtl@offset@x pt}{\dtl@offset@y pt}}%
       \let\dtlplothandlermark\@dtlplothandlermark
        \DTLplotatendtikz
       \end{tikzpicture}
    \fi
  \fi
\egroup
}
\def\dtl@getbounds#1,#2,#3,#4\@nil{%
\def\DTLminX{#1}%
\def\DTLminY{#2}%
\def\DTLmaxX{#3}%
\def\DTLmaxY{#4}%
\dtlifnumgt{\DTLminX}{\DTLmaxX}
{%
 \PackageError{dataplot}{Min X > Max X in bounds #1,#2,#3,#4}{%
 The bounds must be specified as minX,minY,maxX,maxY}%
}{}%
\dtlifnumgt{\DTLminY}{\DTLmaxY}
{%
 \PackageError{dataplot}{Min Y > Max Y in bounds #1,#2,#3,#4}{%
 The bounds must be specified as minX,minY,maxX,maxY}%
}{}%
}
\newcommand*{\dtl@constructticklist}[4]{%
  \DTLifFPopenbetween{0}{#1}{#2}%
  {%
    \dtlsub{\@dtl@width}{0}{#1}%
    \dtldiv{\@dtl@neggap}{\@dtl@width}{10}%
    \dtlifnumlt{\@dtl@neggap}{#3}%
    {%
      \edef\@dtl@neggap{#3}%
    }%
    {}%
    \dtldiv{\@dtl@posgap}{#2}{10}%
    \dtlifnumlt{\@dtl@posgap}{#3}%
    {%
      \edef\@dtl@posgap{#3}%
    }%
    {}%
    \dtlmax{\@dtl@gap}{\@dtl@neggap}{\@dtl@posgap}%
    \dtlifnumgt{\@dtl@gap}{\@dtl@width}%
    {}%
    {%
      \dtl@constructticklistwithgapz{#1}{#2}{#4}{\@dtl@gap}%
    }%
  }%
  {%
    \dtlsub{\@dtl@width}{#2}{#1}%
    \dtldiv{\@dtl@gap}{\@dtl@width}{10}%
    \dtlifnumlt{\@dtl@gap}{#3}%
    {%
      \dtlifnumgt{#3}{\@dtl@width}%
      {%
         \def#4{#1,#2}%
      }%
      {%
        \dtl@constructticklistwithgap{#1}{#2}{#4}{#3}%
      }
    }%
    {%
      \dtl@constructticklistwithgap{#1}{#2}{#4}{\@dtl@gap}%
    }%
  }%
}
\newcommand*{\dtl@constructticklistwithgap}[4]{%
\edef\@dtl@thistick{#1}%
\edef#3{#1}%
\dtladd{\@dtl@thistick}{\@dtl@thistick}{#4}%
\whiledo{\DTLisFPopenbetween{\@dtl@thistick}{#1}{#2}}{%
  \expandafter\toks@\expandafter{\@dtl@thistick}%
  \edef#3{#3,\the\toks@}%
  \dtladd{\@dtl@thistick}{\@dtl@thistick}{#4}%
}%
\expandafter\toks@\expandafter{#2}%
\edef#3{#3,\the\toks@}%
}
\newcommand*{\dtl@constructticklistwithgapz}[4]{%
  \edef\@dtl@thistick{0}%
  \edef#3{0}%
  \dtladd{\@dtl@thistick}{\@dtl@thistick}{#4}%
  \whiledo{\DTLisFPopenbetween{\@dtl@thistick}{0}{#2}}%
  {%
    \expandafter\toks@\expandafter{\@dtl@thistick}%
    \edef#3{#3,\the\toks@}%
    \dtladd{\@dtl@thistick}{\@dtl@thistick}{#4}%
  }%
  \expandafter\toks@\expandafter{#2}%
  \edef#3{#3,\the\toks@}%
  \dtlifnumeq{#1}{0}%
  {}%
  {%
    \edef\@dtl@thistick{0}%
    \dtlsub{\@dtl@thistick}{\@dtl@thistick}{#4}%
    \whiledo{\DTLisFPopenbetween{\@dtl@thistick}{#1}{0}}%
    {%
      \expandafter\toks@\expandafter{\@dtl@thistick}%
      \edef#3{\the\toks@,#3}%
      \dtlsub{\@dtl@thistick}{\@dtl@thistick}{#4}%
    }%
    \expandafter\toks@\expandafter{#1}%
    \edef#3{\the\toks@,#3}%
  }%
}
\newcommand*{\dtl@constructminorticklist}[4]{%
  \dtlsub{\@dtl@width}{#2}{#1}%
  \dtlmul{\@dtl@width}{\@dtl@width}{#3}%
  \dtldiv{\@dtl@gap}{\@dtl@width}{10}%
  \setlength\dtl@tmplength{\@dtl@gap sp}%
  \ifdim\dtl@tmplength<\DTLminminortickgap
    \dtldiv{\@dtl@gap}{\@dtl@width}{4}%
    \setlength\dtl@tmplength{\@dtl@gap sp}%
    \ifdim\dtl@tmplength<\DTLminminortickgap
      \dtldiv{\@dtl@gap}{\@dtl@width}{2}%
      \setlength\dtl@tmplength{\@dtl@gap sp}%
      \ifdim\dtl@tmplength<\DTLminminortickgap
        \let\@dtl@gap=\@dtl@width
      \fi
    \fi
  \fi
  \dtldiv{\@dtl@gap}{\@dtl@gap}{#3}%
  \dtl@constructticklistwithgapex{#1}{#2}{\dtl@tmp}{\@dtl@gap}%
  \ifx#4\@empty
    \let#4=\dtl@tmp
  \else
    \expandafter\toks@\expandafter{#4}%
    \edef#4{#4,\dtl@tmp}%
  \fi
}
\newcommand*{\dtl@constructticklistwithgapex}[4]{%
\edef\@dtl@thistick{#1}%
\let#3=\@empty
\dtladd{\@dtl@thistick}{\@dtl@thistick}{#4}%
\whiledo{\DTLisFPopenbetween{\@dtl@thistick}{#1}{#2}}{%
  \expandafter\toks@\expandafter{\@dtl@thistick}%
  \ifx#3\@empty
    \edef#3{\the\toks@}%
  \else
    \edef#3{#3,\the\toks@}%
  \fi
  \dtladd{\@dtl@thistick}{\@dtl@thistick}{#4}%
}%
}
\newcommand*{\DTLaddtoplotlegend}[3]{%
\def\dtl@legendline{}%
\ifx\relax#2\relax
\else
  \toks@{#2%
  \pgfpathmoveto{\pgfpoint{-10pt}{0pt}}%
  \pgfpathlineto{\pgfpoint{10pt}{0pt}}%
  \pgfusepath{stroke}}%
  \edef\dtl@legendline{\the\toks@}%
\fi
\ifx\relax#1\relax
\else
  \toks@{#1}%
  \expandafter\@dtl@toks\expandafter{\dtl@legendline}%
  \edef\dtl@legendline{\the\@dtl@toks\the\toks@}%
\fi
\expandafter\toks@\expandafter{\dtl@legendline}%
\ifx\dtl@legend\@empty
  \xdef\dtl@legend{\noexpand\tikz\the\toks@; \noexpand& #3}%
\else
  \expandafter\@dtl@toks\expandafter{\dtl@legend}%
  \xdef\dtl@legend{\the\@dtl@toks\noexpand\\%
    \noexpand\tikz\the\toks@; \noexpand& #3}%
\fi
}
\endinput
%%
%% End of file `dataplot-2019-09-27.sty'.
