%%
%% This is file `dataplot.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% datatool.dtx  (with options: `dataplot.sty,package')
%% 
%%  datatool.dtx
%%  Copyright 2013 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 of (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-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
%% 
%% \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}[2013/01/15 v2.13 (NLCT)]
\RequirePackage{xkeyval}
\RequirePackage{tikz}
\RequirePackage{datatool}
\usetikzlibrary{plotmarks}
\usetikzlibrary{plothandlers}
\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*{\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}]{{%
\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
    \FPsub{\dtl@dx}{\DTLmaxX}{\DTLminX}%
    \FPdiv{\dtl@unit@x}{\number\@dtl@tmpcount}{\dtl@dx}%
    \@dtl@tmpcount=\DTLplotheight
    \FPsub{\dtl@dy}{\DTLmaxY}{\DTLminY}%
    \FPdiv{\dtl@unit@y}{\number\@dtl@tmpcount}{\dtl@dy}%
   \ifDTLxtics
     \ifx\dtl@xticlist\relax
       \ifx\dtl@xticgap\relax
         \dtl@constructticklist\DTLminX\DTLmaxX
           \dtl@unit@x\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@unit@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
       \dtl@constructticklist\DTLminY\DTLmaxY
         \dtl@unit@y\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@unit@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{%
           \FPround{\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
     \begin{tikzpicture}
     \pgfsetxvec{\pgfpoint{\dtl@unit@x sp}{0pt}}%
     \pgfsetyvec{\pgfpoint{0pt}{\dtl@unit@y sp}}%
 \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
        \addtolength\dtl@xticlabelheight{\DTLticklabeloffset}%
        \@for\dtl@thistick:=\dtl@xticlist\do{%
          \pgfpathmoveto{\pgfpointxy{\dtl@thistick}{\DTLminY}}
          \ifDTLxticsin
            \pgfpathlineto{
                \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLminY}}
                            {\pgfpoint{0pt}{\DTLticklength}}}
          \else
            \pgfpathlineto{
              \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLminY}}
                          {\pgfpoint{0pt}{-\DTLticklength}}}
          \fi
          \ifDTLbox
            \pgfpathmoveto{\pgfpointxy{\dtl@thistick}{\DTLmaxY}}
            \ifDTLxticsin
              \pgfpathlineto{
                  \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLmaxY}}
                              {\pgfpoint{0pt}{-\DTLticklength}}}
            \else
              \pgfpathlineto{
                \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLmaxY}}
                            {\pgfpoint{0pt}{\DTLticklength}}}
            \fi
          \fi
          \pgfusepath{stroke}%
          \ifx\dtl@xticlabels\relax
             \FPround{\dtl@thislabel}{\dtl@thistick}
                     {\c@DTLplotroundXvar}%
          \else
             \dtl@chopfirst\dtl@xticlabels\dtl@thislabel\dtl@rest
             \let\dtl@xticlabels=\dtl@rest
          \fi
          \pgftext[base,center,at={\pgfpointadd
                      {\pgfpointxy{\dtl@thistick}{\DTLminY}}
                      {\pgfpoint{0pt}{-\dtl@xticlabelheight}}}]
                  {\dtl@thislabel}
        }%
      \fi
     \ifx\dtl@xlabel\relax
     \else
       \addtolength{\dtl@xticlabelheight}{\baselineskip}%
       \setlength{\dtl@tmplength}{0.5\DTLplotwidth}
       \pgftext[base,center,at={\pgfpointadd
           {\pgfpointxy{\DTLminX}{\DTLminY}}%
           {\pgfpoint{\dtl@tmplength}{-\dtl@xticlabelheight}}}]{%
          \dtl@xlabel}
     \fi
     \ifDTLxminortics
        \@for\dtl@thistick:=\dtl@xminorticlist\do{%
          \pgfpathmoveto{\pgfpointxy{\dtl@thistick}{\DTLminY}}
          \ifDTLxticsin
            \pgfpathlineto{
                \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLminY}}
                            {\pgfpoint{0pt}{\DTLminorticklength}}}
          \else
            \pgfpathlineto{
              \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLminY}}
                          {\pgfpoint{0pt}{-\DTLminorticklength}}}
          \fi
          \ifDTLbox
            \pgfpathmoveto{\pgfpointxy{\dtl@thistick}{\DTLmaxY}}
            \ifDTLxticsin
              \pgfpathlineto{
                  \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLmaxY}}
                              {\pgfpoint{0pt}{-\DTLminorticklength}}}
            \else
              \pgfpathlineto{
                \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLmaxY}}
                            {\pgfpoint{0pt}{\DTLminorticklength}}}
            \fi
          \fi
        }%
     \fi
      \ifDTLytics
        \@for\dtl@thistick:=\dtl@yticlist\do{%
          \pgfpathmoveto{\pgfpointxy{\DTLminX}{\dtl@thistick}}
          \ifDTLyticsin
            \pgfpathlineto{
                \pgfpointadd{\pgfpointxy{\DTLminX}{\dtl@thistick}}
                            {\pgfpoint{\DTLticklength}{0pt}}}
          \else
            \pgfpathlineto{
              \pgfpointadd{\pgfpointxy{\DTLminX}{\dtl@thistick}}
                          {\pgfpoint{-\DTLticklength}{0pt}}}
          \fi
          \ifDTLbox
            \pgfpathmoveto{\pgfpointxy{\DTLmaxX}{\dtl@thistick}}
            \ifDTLyticsin
              \pgfpathlineto{
                  \pgfpointadd{\pgfpointxy{\DTLmaxX}{\dtl@thistick}}
                              {\pgfpoint{-\DTLticklength}{0pt}}}
            \else
              \pgfpathlineto{
                  \pgfpointadd{\pgfpointxy{\DTLmaxX}{\dtl@thistick}}
                              {\pgfpoint{\DTLticklength}{0pt}}}
            \fi
          \fi
          \pgfusepath{stroke}
          \ifx\dtl@yticlabels\relax
             \FPround{\dtl@thislabel}{\dtl@thistick}
                     {\c@DTLplotroundYvar}%
          \else
             \dtl@chopfirst\dtl@yticlabels\dtl@thislabel\dtl@rest
             \let\dtl@yticlabels=\dtl@rest
          \fi
          \pgftext[right,at={\pgfpointadd
                      {\pgfpointxy{\DTLminX}{\dtl@thistick}}
                      {\pgfpoint{-\DTLticklabeloffset}{0pt}}}]
            {\dtl@thislabel}
        }%
      \fi
     \ifx\dtl@ylabel\relax
     \else
       \addtolength{\dtl@yticlabelwidth}{\baselineskip}%
       \setlength{\dtl@tmplength}{0.5\DTLplotheight}
       \pgftext[bottom,center,at={\pgfpointadd
           {\pgfpointxy{\DTLminX}{\DTLminY}}%
           {\pgfpoint{-\dtl@yticlabelwidth}{\dtl@tmplength}}},
           rotate=90]{%
          \dtl@ylabel}
     \fi
     \ifDTLyminortics
        \@for\dtl@thistick:=\dtl@yminorticlist\do{%
          \pgfpathmoveto{\pgfpointxy{\DTLminX}{\dtl@thistick}}
          \ifDTLyticsin
            \pgfpathlineto{
                \pgfpointadd{\pgfpointxy{\DTLminX}{\dtl@thistick}}
                            {\pgfpoint{\DTLminorticklength}{0pt}}}
          \else
            \pgfpathlineto{
              \pgfpointadd{\pgfpointxy{\DTLminX}{\dtl@thistick}}
                          {\pgfpoint{-\DTLminorticklength}{0pt}}}
          \fi
          \ifDTLbox
            \pgfpathmoveto{\pgfpointxy{\DTLmaxX}{\dtl@thistick}}
            \ifDTLyticsin
              \pgfpathlineto{
                  \pgfpointadd{\pgfpointxy{\DTLmaxX}{\dtl@thistick}}
                              {\pgfpoint{-\DTLminorticklength}{0pt}}}
            \else
              \pgfpathlineto{
                  \pgfpointadd{\pgfpointxy{\DTLmaxX}{\dtl@thistick}}
                              {\pgfpoint{\DTLminorticklength}{0pt}}}
            \fi
          \fi
          \pgfusepath{stroke}
        }%
     \fi
      \@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}%
            \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
        \pgftext[top,center,at={\pgfpointadd
                 {\pgfpointxy{\DTLminX}{\DTLmaxY}}
                 {\pgfpoint{0.5\DTLplotwidth}{-\DTLlegendyoffset}}}]
                {\DTLformatlegend
                  {\begin{tabular}{cl}\dtl@legend\end{tabular}}}
      \or % north east
        \pgftext[top,right,at={\pgfpointadd
                 {\pgfpointxy{\DTLmaxX}{\DTLmaxY}}
                 {\pgfpoint{-\DTLlegendxoffset}{-\DTLlegendyoffset}}}]
                {\DTLformatlegend
                  {\begin{tabular}{cl}\dtl@legend\end{tabular}}}
      \or % east
        \pgftext[center,right,at={\pgfpointadd
                 {\pgfpointxy{\DTLmaxX}{\DTLminY}}
                 {\pgfpoint{-\DTLlegendxoffset}{0.5\DTLplotheight}}}]
                {\DTLformatlegend
                  {\begin{tabular}{cl}\dtl@legend\end{tabular}}}
      \or % south east
        \pgftext[bottom,right,at={\pgfpointadd
                 {\pgfpointxy{\DTLmaxX}{\DTLminY}}
                 {\pgfpoint{-\DTLlegendxoffset}{\DTLlegendyoffset}}}]
                {\DTLformatlegend
                   {\begin{tabular}{cl}\dtl@legend\end{tabular}}}
      \or % south
        \pgftext[center,bottom,at={\pgfpointadd
                 {\pgfpointxy{\DTLminX}{\DTLminY}}
                 {\pgfpoint{0.5\DTLplotwidth}{\DTLlegendyoffset}}}]
                {\DTLformatlegend
                   {\begin{tabular}{cl}\dtl@legend\end{tabular}}}
      \or % south west
        \pgftext[bottom,left,at={\pgfpointadd
                 {\pgfpointxy{\DTLminX}{\DTLminY}}
                 {\pgfpoint{\DTLlegendxoffset}{\DTLlegendyoffset}}}]
                {\DTLformatlegend
                   {\begin{tabular}{cl}\dtl@legend\end{tabular}}}
      \or % west
        \pgftext[center,left,at={\pgfpointadd
                 {\pgfpointxy{\DTLminX}{\DTLminY}}
                 {\pgfpoint{\DTLlegendxoffset}{0.5\DTLplotheight}}}]
                {\DTLformatlegend
                   {\begin{tabular}{cl}\dtl@legend\end{tabular}}}
      \or % north west
        \pgftext[top,left,at={\pgfpointadd
                 {\pgfpointxy{\DTLminX}{\DTLmaxY}}
                 {\pgfpoint{\DTLlegendxoffset}{-\DTLlegendyoffset}}}]
                {\DTLformatlegend
                   {\begin{tabular}{cl}\dtl@legend\end{tabular}}}
      \fi
      \DTLplotatendtikz
      \end{tikzpicture}
    \fi
  \fi
\fi
}}
\def\dtl@getbounds#1,#2,#3,#4\@nil{%
\def\DTLminX{#1}%
\def\DTLminY{#2}%
\def\DTLmaxX{#3}%
\def\DTLmaxY{#4}%
\FPifgt{\DTLminX}{\DTLmaxX}
 \PackageError{dataplot}{Min X > Max X in bounds #1,#2,#3,#4}{%
 The bounds must be specified as minX,minY,maxX,maxY}%
\fi
\FPifgt{\DTLminY}{\DTLmaxY}
 \PackageError{dataplot}{Min Y > Max Y in bounds #1,#2,#3,#4}{%
 The bounds must be specified as minX,minY,maxX,maxY}%
\fi
}
\newcommand*{\dtl@constructticklist}[4]{%
\DTLifFPopenbetween{0}{#1}{#2}{%
  \FPsub{\@dtl@width}{0}{#1}%
  \FPmul{\@dtl@width}{\@dtl@width}{#3}%
  \FPdiv{\@dtl@neggap}{\@dtl@width}{10}%
  \setlength\dtl@tmplength{\@dtl@neggap sp}%
  \ifdim\dtl@tmplength<\DTLmintickgap
    \FPdiv{\@dtl@neggap}{\@dtl@width}{4}%
    \setlength\dtl@tmplength{\@dtl@neggap sp}%
    \ifdim\dtl@tmplength<\DTLmintickgap
      \FPdiv{\@dtl@neggap}{\@dtl@width}{2}%
      \setlength\dtl@tmplength{\@dtl@neggap sp}%
      \ifdim\dtl@tmplength<\DTLmintickgap
        \let\@dtl@neggap=\@dtl@width
      \fi
    \fi
  \fi
  \FPmul{\@dtl@width}{#2}{#3}%
  \FPdiv{\@dtl@posgap}{\@dtl@width}{10}%
  \setlength\dtl@tmplength{\@dtl@posgap sp}%
  \ifdim\dtl@tmplength<\DTLmintickgap
    \FPdiv{\@dtl@posgap}{\@dtl@width}{4}%
    \setlength\dtl@tmplength{\@dtl@posgap sp}%
    \ifdim\dtl@tmplength<\DTLmintickgap
      \FPdiv{\@dtl@posgap}{\@dtl@width}{2}%
      \setlength\dtl@tmplength{\@dtl@posgap sp}%
      \ifdim\dtl@tmplength<\DTLmintickgap
        \let\@dtl@posgap=\@dtl@width
      \fi
    \fi
  \fi
  \FPmax{\@dtl@gap}{\@dtl@neggap}{\@dtl@posgap}%
  \FPdiv{\@dtl@gap}{\@dtl@gap}{#3}%
  \dtl@constructticklistwithgapz{#1}{#2}{#4}{\@dtl@gap}%
}{%
  \FPsub{\@dtl@width}{#2}{#1}%
  \FPmul{\@dtl@width}{\@dtl@width}{#3}%
  \FPdiv{\@dtl@gap}{\@dtl@width}{10}%
  \setlength\dtl@tmplength{\@dtl@gap sp}%
  \ifdim\dtl@tmplength<\DTLmintickgap
    \FPdiv{\@dtl@gap}{\@dtl@width}{4}%
    \setlength\dtl@tmplength{\@dtl@gap sp}%
    \ifdim\dtl@tmplength<\DTLmintickgap
      \FPdiv{\@dtl@gap}{\@dtl@width}{2}%
      \setlength\dtl@tmplength{\@dtl@gap sp}%
      \ifdim\dtl@tmplength<\DTLmintickgap
        \let\@dtl@gap=\@dtl@width
      \fi
    \fi
  \fi
  \FPdiv{\@dtl@gap}{\@dtl@gap}{#3}%
  \dtl@constructticklistwithgap{#1}{#2}{#4}{\@dtl@gap}%
}%
}
\newcommand*{\dtl@constructticklistwithgap}[4]{%
\edef\@dtl@thistick{#1}%
\edef#3{#1}%
\FPadd{\@dtl@thistick}{\@dtl@thistick}{#4}%
\whiledo{\DTLisFPopenbetween{\@dtl@thistick}{#1}{#2}}{%
  \expandafter\toks@\expandafter{\@dtl@thistick}%
  \edef#3{#3,\the\toks@}%
  \FPadd{\@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}%
\FPadd{\@dtl@thistick}{\@dtl@thistick}{#4}%
\whiledo{\DTLisFPopenbetween{\@dtl@thistick}{0}{#2}}{%
  \expandafter\toks@\expandafter{\@dtl@thistick}%
  \edef#3{#3,\the\toks@}%
  \FPadd{\@dtl@thistick}{\@dtl@thistick}{#4}%
}%
\expandafter\toks@\expandafter{#2}%
\edef#3{#3,\the\toks@}%
\FPifeq{#1}{0}%
\else
\edef\@dtl@thistick{0}%
  \FPsub{\@dtl@thistick}{\@dtl@thistick}{#4}%
  \whiledo{\DTLisFPopenbetween{\@dtl@thistick}{#1}{0}}{%
    \expandafter\toks@\expandafter{\@dtl@thistick}%
    \edef#3{\the\toks@,#3}%
    \FPsub{\@dtl@thistick}{\@dtl@thistick}{#4}%
  }%
  \expandafter\toks@\expandafter{#1}%
  \edef#3{\the\toks@,#3}%
\fi
}
\newcommand*{\dtl@constructminorticklist}[4]{%
  \FPsub{\@dtl@width}{#2}{#1}%
  \FPmul{\@dtl@width}{\@dtl@width}{#3}%
  \FPdiv{\@dtl@gap}{\@dtl@width}{10}%
  \setlength\dtl@tmplength{\@dtl@gap sp}%
  \ifdim\dtl@tmplength<\DTLminminortickgap
    \FPdiv{\@dtl@gap}{\@dtl@width}{4}%
    \setlength\dtl@tmplength{\@dtl@gap sp}%
    \ifdim\dtl@tmplength<\DTLminminortickgap
      \FPdiv{\@dtl@gap}{\@dtl@width}{2}%
      \setlength\dtl@tmplength{\@dtl@gap sp}%
      \ifdim\dtl@tmplength<\DTLminminortickgap
        \let\@dtl@gap=\@dtl@width
      \fi
    \fi
  \fi
  \FPdiv{\@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
\FPadd{\@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
  \FPadd{\@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
  \edef\dtl@legend{\noexpand\tikz\the\toks@; \noexpand& #3}%
\else
  \expandafter\@dtl@toks\expandafter{\dtl@legend}%
  \edef\dtl@legend{\the\@dtl@toks\noexpand\\%
    \noexpand\tikz\the\toks@; \noexpand& #3}%
\fi
}
\endinput
%%
%% End of file `dataplot.sty'.
