%%
%% This is file `makeplot.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% makeplot.dtx  (with options: `makeplot')
%%  Copyright 2004--2008  by Jose Emilio Vila Forcen (jemilio@gmail.com)
%% 
%%  All rights reserved.
%% 
%%  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 the
%%  license is in
%% 
%%      http://www.latex-project.org/lppl.txt
%% 
%%  and version 1.3 or later is part of all distributions of LaTeX
%%  version 2003/12/01 or later.
%% 
%%  This work has the LPPL maintenance status "maintained".
%%  The Current Maintainer of this work is Jose Emilio Vila Forcen (jemilio@gmail.com).
%% 

%% \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{makeplot}[2009/08/26 %
                           v1.0.7 %
                           Plots utility from Jose-Emilio Vila-Forcen]%
\RequirePackage[nomessages]{fp}%
\RequirePackage{pst-plot}%
\RequirePackage{pstricks-add}%
\RequirePackage{xkeyval}%
\newif\ifMP@color%
\MP@colorfalse%
\DeclareOption{color}{%
  \MP@colortrue%
  \typeout{ ------}%
  \typeout{ ------   makePlot package working in color}%
  \typeout{ ------}}%
\newif\ifMP@drawmargins%
\MP@drawmarginsfalse%
\DeclareOption{drawmargins}{%
  \MP@drawmarginstrue%
  \typeout{ ------}%
  \typeout{ ------   makePlot package drawing the margins}%
  \typeout{ ------}}%
\newif\ifMP@big%
\MP@bigfalse%
\DeclareOption{big}{%
\MP@bigtrue
  \typeout{ ------}%
  \typeout{ ------   makePlot package in big size}%
  \typeout{ ------}}%
\DeclareOption*{%
  \PackageWarning{startPlot}{%
    Unknown option '\CurrentOption'}}%
\ProcessOptions\relax%
\newcommand{\MPbg}{%
 \def\styleoflineA{%
  \psset{linestyle=solid, dash=1pt 0pt 0pt 0pt, dotsep=0pt,%
     linecolor=black}}%
 \def\styleoflineB{%
  \psset{linestyle=dashed, dash=5pt 5pt 0pt 0pt, dotsep=0pt,%
     linecolor=black}}%
 \def\styleoflineC{%
  \psset{linestyle=dotted, dash=3pt 2pt 0pt 0pt, dotsep=1pt,%
     linecolor=black}}%
 \def\styleoflineD{%
  \psset{linestyle=dashed, dash=4pt 1.5pt 1pt 1.5pt, dotsep=3pt,%
     linecolor=black}}%
 \def\styleoflineE{%
  \psset{linestyle=dotted, dash=1pt 4pt 0pt 0pt, dotsep=3pt,%
     linecolor=black}}%
 \def\styleoflineF{%
  \psset{linestyle=dashed, dash=6pt 1.5pt 3pt 1.5pt, dotsep=3pt,%
     linecolor=black}}%
 \def\styleoflineG{%
  \psset{linestyle=dashed, dash=2pt 6pt 0pt 0pt, dotsep=0pt,%
     linecolor=black}}}%
\definecolor{colorLineA}{rgb}{0,0,1}%
\definecolor{colorLineB}{rgb}{1,0,0}%
\definecolor{colorLineC}{rgb}{0,1,0}%
\definecolor{colorLineD}{rgb}{0,1,1}%
\definecolor{colorLineE}{rgb}{1,0,1}%
\definecolor{colorLineF}{rgb}{1,1,0}%
\definecolor{colorLineG}{rgb}{0.5,0.5,0.5}%
\newcommand{\MPcolor}{%
 \def\styleoflineA{\psset{linestyle=solid, linecolor=colorLineA}}%
 \def\styleoflineB{\psset{linestyle=solid, linecolor=colorLineB}}%
 \def\styleoflineC{\psset{linestyle=solid, linecolor=colorLineC}}%
 \def\styleoflineD{\psset{linestyle=solid, linecolor=colorLineD}}%
 \def\styleoflineE{\psset{linestyle=solid, linecolor=colorLineE}}%
 \def\styleoflineF{\psset{linestyle=solid, linecolor=colorLineF}}%
 \def\styleoflineG{\psset{linestyle=solid, linecolor=colorLineG}}}%
\ifMP@color%
 \MPcolor%
\else%
 \MPbg%
\fi%
\makeatletter%
\def\fontaxeY{\normalsize}%
\def\fontaxeX{\normalsize}%
\def\fonttitleY{\normalsize}%
\def\fonttitleX{\normalsize}%
\def\fontlegend{\footnotesize}%
\define@key[psset]{makeplot}{Dx}[1]%
   {\def\gridDxmakeplot{#1}}%
\define@key[psset]{makeplot}{Dy}[1]%
   {\def\gridDymakeplot{#1}}%
\define@key[psset]{makeplot}{width}[50]%
   {\def\widthPlotmakeplot{#1}}%
\define@key[psset]{makeplot}{heightFactor}[1]%
   {\def\heightPlotFactormakeplot{#1}}%
\define@key[psset]{makeplot}{startX}[0]%
   {\def\xamakeplot{#1}}%
\define@key[psset]{makeplot}{startY}[0]%
   {\def\yamakeplot{#1}}%
\define@key[psset]{makeplot}{endX}[1]%
   {\def\xzmakeplot{#1}}%
\define@key[psset]{makeplot}{endY}[1]%
   {\FPmul\yzmakeplot{#1}{1.0001}}%
\define@key[psset]{makeplot}{factorBoundaryX}%
   {\FPdiv\factorBOUNDARYxmakeplot{#1}{1.5}}%
\define@key[psset]{makeplot}{factorBoundaryY}%
   {\FPdiv\factorBOUNDARYymakeplot{#1}{1.5}}%
\define@key[psset]{makeplot}{captionY}%
   {\FPdiv\factorXmakeplot{#1}{8}}%
\define@key[psset]{makeplot}{captionX}%
   {\FPdiv\factorYmakeplot{#1}{11}}%
\define@choicekey[psset]{makeplot}{changeEndXpos}[\var\nr]{no,yes}%
   {\def\endXamakeplot{\nr}}%
\define@key[psset]{makeplot}{changeEndXsize}%
   {\def\endXbmakeplot{#1}}%
\define@choicekey[psset]{makeplot}{tickyplot}[\val\nr]{all,x,y,none}%
   {\def\tickymakeplot{\nr}} %
\define@choicekey[psset]{makeplot}{drawmargins}[\vall\nrr]{yes,no}%
   {\def\drawmarginsmakeplot{\nrr}} %
\define@key[psset]{makeplot}{orgX}%
   {\def\orgXmakeplot{#1}} %
\define@key[psset]{makeplot}{orgY}%
   {\def\orgYmakeplot{#1}} %
\pst@addfams{makeplot}%
\psset{Dx=1, Dy=1,
width=50, heightFactor=1, startX=0, endX=1, startY=0, endY=1,
showorigin=true, axesstyle=frame, ticks=all, labels=all,
factorBoundaryX=1, factorBoundaryY=1, captionY=100, captionX=100,
xsubticks=0, subticksize=1, subtickcolor=black}%
\ifMP@big%
 \psset{tickwidth=0.5pt, subtickwidth=0.5pt, linewidth=1pt}%
\else%
 \psset{tickwidth=0.2pt, subtickwidth=0.2pt, linewidth=0.5pt}%
\fi%
\psset{tickyplot=all}%
\psset{changeEndXsize=0, changeEndXpos=no}%
\ifMP@drawmargins%
 \psset{drawmargins=yes}%
\else%
 \psset{drawmargins=no}%
\fi%
\psset{orgX=314, orgY=314}%
\newenvironment{makeplot}[3][]%
  {\makeplot[#1]{#2}{#3}}%
  {\end{pspicture}}%
\def\defaultOptionsMakeplot{}%
\def\makeplot{\@ifnextchar[\@makeplot{\@makeplot[]}}%
\def\@makeplot[#1]#2#3{%
  % Use the default options command and process
  % the options of the command line
  \defaultOptionsMakeplot%
  \psset{#1}%
  % Calculate the dimensions of the plot
  \def\gridDx{\gridDxmakeplot}%
  \def\gridDy{\gridDymakeplot}%
  \def\widthPlot{\widthPlotmakeplot}%
  \def\heightPlotFactor{\heightPlotFactormakeplot}%
  \def\xa{\xamakeplot}%
  \def\ya{\yamakeplot}%
  \def\xz{\xzmakeplot}%
  \def\yz{\yzmakeplot}%
  \def\factorBOUNDARYx{\factorBOUNDARYxmakeplot}%
  \def\factorBOUNDARYy{\factorBOUNDARYymakeplot}%
  \def\factorX{\factorXmakeplot}%
  \def\factorY{\factorYmakeplot}%
  \def\endXa{\endXamakeplot}%
  \def\endXb{\endXbmakeplot}%
  \def\ticky{\tickymakeplot}%
  \def\drawmargins{\drawmarginsmakeplot}%
  \def\orgX{\orgXmakeplot}%
  \def\orgY{\orgYmakeplot}%
  %
  % Use the fonts established
  \def\pshlabel{\fontaxeX}%
  \def\psvlabel{\fontaxeY}%
  \def\pshlabel{\fontaxeX}%
  \def\psvlabel{\fontaxeY}%
  %
  % Calculate the proper units for the plot
  \FPadd\xDiff\xz{-\xa}%
  \FPdiv\unitX\widthPlot\xDiff%
  \FPadd\yDiff\yz{-\ya}%
  \FPmul\ff\widthPlot\heightPlotFactor%
  \FPdiv\unitY\ff\yDiff%
  \psset{xunit=\unitX mm,yunit=\unitY mm}%
  %
  \FPadd\yinc\yz{-\ya}%
  \FPdiv\ymid\yinc{2}%
  \FPadd\ymid\ymid\ya%
  \FPadd\xinc\xz{-\xa}%
  \FPdiv\xmid\xinc{2}%
  \FPadd\xmid\xmid\xa%
  \FPadd\xzz\xz{0}%
  %
  % Related to the position of the legends
  \FPdiv\factorX\factorX\unitX%
  \FPadd\xaa\xa{-\factorX}%
  \FPdiv\factorY\factorY\unitY%
  \FPadd\yaa\ya{-\factorY}%
  %
  % Related to the size of the plot
  \FPdiv\factorBOUNDARYx\factorBOUNDARYx\unitX%
  \FPadd\xaaa\xaa{-\factorBOUNDARYx}%
  \FPdiv\factorBOUNDARYy\factorBOUNDARYy\unitY%
  \FPadd\yaaa\yaa{-\factorBOUNDARYy}%
  %
  % Change of the size of the plot
  % if it is asked in the options,
  % like putting the legend at the right
  \ifnum \endXb>0
    \FPdiv\w{\endXb}\unitX%
    \ifnum \endXa=0
      \def\endXa{\xz}%
    \fi%
    \FPadd\ww{\endXa}{-\xz}%
    \def\sep{0.5}%
    \FPdiv\www\sep\unitX%
    \FPadd\xzz\xz\w%
    \FPadd\xzz\xzz\ww%
    \FPadd\xzz\xzz\www %
  \fi%
  %
  % Starting the pspicture environment
  \begin{pspicture}(\xaaa,\yaaa)(\xzz,\yz)%
  %
  % Draw a box with the margins if requested
  \ifnum \drawmargins=0
    \psframe(\xaaa,\yaaa)(\xzz,\yz)%
  \fi%
  %
  \FPadd\tickHerex{\yz}{-\ya}%
  \FPmul\tickHerex\tickHerex\unitY%
  \FPadd\tickHerey{\xz}{-\xa}%
  \FPmul\tickHerey\tickHerey\unitX%
  %
  % To change the origin of the plot
  % not working yet
  \def\xaOrigin{\xa}%
  \def\yaOrigin{\ya}%
  \ifnum \orgX=314
  \else%
    \def\xaOrigin{\orgX}%
  \fi%
  \ifnum \orgY=314
  \else%
    \def\yaOrigin{\orgY}%
  \fi %
  %
  % Put the ticks as given in the options
  \ifnum \ticky=0
    \psaxes[Ox=\xa,Oy=\ya,Dx=\gridDx,Dy=\gridDy, #1,%
        ticksize=-4pt 4pt, subticks=0, subticksize=0,%
        tickwidth=0.5pt, linewidth=0pt,%
        axesstyle=axes, linecolor=white, #1, ticks=all, labels=none]%
        {-}(\xa,\ya)(\xa,\ya)(\xz,\yz)%
  \fi%
  \ifnum \ticky=1
    \psaxes[Ox=\xa,Oy=\ya,Dx=\gridDx,Dy=\gridDy, #1,%
        ticksize=-4pt 4pt, subticks=0, subticksize=0,%
        tickwidth=0.5pt, linewidth=0pt,%
        axesstyle=axes, linecolor=white, #1, ticks=x, labels=none]%
        {-}(\xa,\ya)(\xa,\ya)(\xz,\yz)%
  \fi%
  \ifnum \ticky=2
    \psaxes[Ox=\xa,Oy=\ya,Dx=\gridDx,Dy=\gridDy, #1,%
        ticksize=-4pt 4pt, subticks=0, subticksize=0,%
        tickwidth=0.5pt, linewidth=0pt,%
        axesstyle=axes, linecolor=white, #1, ticks=y, labels=none]%
        {-}(\xa,\ya)(\xa,\ya)(\xz,\yz)%
  \fi%
  \ifnum \ticky=3
  \fi%
  %
  % Put the main axes and the grid
  \FPround\tickHerex{\tickHerex}{10}%
  \FPround\tickHerey{\tickHerey}{10}%
  \psaxes[xticksize=0mm \tickHerex mm, yticksize=0mm \tickHerey mm,%
    Ox=\xa,Oy=\ya,Dx=\gridDx,Dy=\gridDy, #1]%
    {-}(\xaOrigin,\yaOrigin)(\xa,\ya)(\xz,\yz)%
\def\MP@xa{\xaOrigin}%
\def\MP@ya{\yaOrigin}%
\def\MP@xz{\xz}%
\def\MP@yz{\yz}%
  %
  % Write the legend of the plot
  \rput(\xaa,\ymid){\rotateleft{\fonttitleY #2}}%
  \rput(\xmid,\yaa){\fonttitleX #3}%
  \ifMP@big%
   \psset{linewidth=2pt}%
  \else%
   \psset{linewidth=1pt}%
  \fi%
}%
\def\plotFile{\@ifnextchar[\@plotFile{\@plotFile[]}}%
\def\@plotFile[#1]#2{%
  \readdata[#1]{\data}{#2}\listplot[#1]{\data}}%
\def\plotFileA{\@ifnextchar[\@plotFileA{\@plotFileA[]}}%
\def\@plotFileA[#1]#2{%
  \styleoflineA%
  \plotFile[#1]{#2}}%
\def\plotFileB{\@ifnextchar[\@plotFileB{\@plotFileB[]}}%
\def\@plotFileB[#1]#2{%
  \styleoflineB%
  \plotFile[#1]{#2}}%
\def\plotFileC{\@ifnextchar[\@plotFileC{\@plotFileC[]}}%
\def\@plotFileC[#1]#2{%
  \styleoflineC%
  \plotFile[#1]{#2}}%
\def\plotFileD{\@ifnextchar[\@plotFileD{\@plotFileD[]}}%
\def\@plotFileD[#1]#2{%
  \styleoflineD%
  \plotFile[#1]{#2}}%
\def\plotFileE{\@ifnextchar[\@plotFileE{\@plotFileE[]}}%
\def\@plotFileE[#1]#2{%
  \styleoflineE%
  \plotFile[#1]{#2}}%
\def\plotFileF{\@ifnextchar[\@plotFileF{\@plotFileF[]}}%
\def\@plotFileF[#1]#2{%
  \styleoflineF%
  \plotFile[#1]{#2}}%
\def\plotFileG{\@ifnextchar[\@plotFileG{\@plotFileG[]}}%
\def\@plotFileG[#1]#2{%
  \styleoflineG%
  \plotFile[#1]{#2}}%
\def\legend{\@ifnextchar[\@legend{\@legendf[]}}%
\def\@legend[#1]#2#3#4#5#6{%
  \def\xb{#2}%
  \def\x{#3}%
  \FPdiv\x\x\unitX%
  \FPadd\xbb\xb\x%
  \def\x{#4}%
  \FPdiv\x\x\unitX%
  \FPadd\xc\xbb\x%
  %
  \def\y{#5}%
  \psline[#1]{-}(\xb,\y)(\xbb,\y)%
  \rput(\xc,\y){\makebox[0 cm][l]{{\fontlegend #6}}}}%
\def\legendA{\@ifnextchar[\@legendA{\@legendA[]}}%
\def\@legendA[#1]#2#3#4#5{%
  \styleoflineA%
  \legend[#1]{#2}{#3}{#4}{#5}}%
\def\legendB{\@ifnextchar[\@legendB{\@legendB[]}}%
\def\@legendB[#1]#2#3#4#5{%
  \styleoflineB%
  \legend[#1]{#2}{#3}{#4}{#5}}%
\def\legendC{\@ifnextchar[\@legendC{\@legendC[]}}%
\def\@legendC[#1]#2#3#4#5{%
  \styleoflineC%
  \legend[#1]{#2}{#3}{#4}{#5}}%
\def\legendD{\@ifnextchar[\@legendD{\@legendD[]}}%
\def\@legendD[#1]#2#3#4#5{%
  \styleoflineD%
  \legend[#1]{#2}{#3}{#4}{#5}}%
\def\legendE{\@ifnextchar[\@legendE{\@legendE[]}}%
\def\@legendE[#1]#2#3#4#5{%
  \styleoflineE%
  \legend[#1]{#2}{#3}{#4}{#5}}%
\def\legendF{\@ifnextchar[\@legendF{\@legendF[]}}%
\def\@legendF[#1]#2#3#4#5{%
  \styleoflineF%
  \legend[#1]{#2}{#3}{#4}{#5}}%
\def\legendG{\@ifnextchar[\@legendG{\@legendG[]}}%
\def\@legendG[#1]#2#3#4#5{%
  \styleoflineG%
  \legend[#1]{#2}{#3}{#4}{#5}}%
\def\legendAf{\@ifnextchar[\@legendAf{\@legendAf[]}}%
\def\@legendAf[#1]#2{%
  \legendA[#1]{\posx}{\l}{\s}{\posy}{#2}%
  \FPadd\posy\posy{-\dif}}%
\def\legendBf{\@ifnextchar[\@legendBf{\@legendBf[]}}%
\def\@legendBf[#1]#2{%
  \legendB[#1]{\posx}{\l}{\s}{\posy}{#2}%
  \FPadd\posy\posy{-\dif}}%
\def\legendCf{\@ifnextchar[\@legendCf{\@legendCf[]}}%
\def\@legendCf[#1]#2{%
  \legendC[#1]{\posx}{\l}{\s}{\posy}{#2}%
  \FPadd\posy\posy{-\dif}}%
\def\legendDf{\@ifnextchar[\@legendDf{\@legendDf[]}}%
\def\@legendDf[#1]#2{%
  \legendD[#1]{\posx}{\l}{\s}{\posy}{#2}%
  \FPadd\posy\posy{-\dif}}%
\def\legendEf{\@ifnextchar[\@legendEf{\@legendEf[]}}%
\def\@legendEf[#1]#2{%
  \legendE[#1]{\posx}{\l}{\s}{\posy}{#2}%
  \FPadd\posy\posy{-\dif}}%
\def\legendFf{\@ifnextchar[\@legendFf{\@legendFf[]}}%
\def\@legendFf[#1]#2{%
  \legendF[#1]{\posx}{\l}{\s}{\posy}{#2}%
  \FPadd\posy\posy{-\dif}}%
\def\legendGf{\@ifnextchar[\@legendGf{\@legendGf[]}}%
\def\@legendGf[#1]#2{%
  \legendG[#1]{\posx}{\l}{\s}{\posy}{#2}%
  \FPadd\posy\posy{-\dif}}%
\def\legendText{\@ifnextchar[\@legendText{\@legendText[]}}%
\def\@legendText[#1]#2{%
  \rput(\posx,\posy){%
    \makebox[0 cm][l]{%
    \hspace{-0.1cm}{\footnotesize #2}}}%
  \FPadd\posy\posy{-\dif}}%
\define@key[psset]{whiteBG}{fillcolorWhiteBG}{\def\fillcolorWhiteBG{#1}}%
\define@key[psset]{whiteBG}{fillstyleWhiteBG}{\def\fillstyleWhiteBG{#1}}%
\define@key[psset]{whiteBG}{framearcWhiteBG}{\def\framearcWhiteBG{#1}}%
\define@key[psset]{whiteBG}{linewidthWhiteBG}{\def\linewidthWhiteBG{#1}}%
\define@key[psset]{whiteBG}{linestyleWhiteBG}{\def\linestyleWhiteBG{#1}}%
\define@key[psset]{whiteBG}{linecolorWhiteBG}{\def\linecolorWhiteBG{#1}}%
\pst@addfams{whiteBG}%
\psset{fillcolorWhiteBG=white, fillstyleWhiteBG=solid,
   framearcWhiteBG=0.3, linewidthWhiteBG=0.01,
   linestyleWhiteBG=solid, linecolorWhiteBG=black}%
\def\whiteBG{\@ifnextchar[\@whiteBG{\@whiteBG[]}}%
\def\@whiteBG[#1]#2#3#4#5{%
  \psframe[framearc=\framearcWhiteBG, fillcolor=\fillcolorWhiteBG,%
    fillstyle=\fillstyleWhiteBG, linewidth=\linewidthWhiteBG cm,%
    linestyle=\linestyleWhiteBG, linecolor=\linecolorWhiteBG, #1]%
    (#2,#3)(#4,#5)}%
\define@key[psset]{legendXY}{legendSep}{\def\sepYlegendXY{#1}} %
\define@key[psset]{legendXY}{lineLength}{\def\llegendXY{#1}} %
\define@key[psset]{legendXY}{lineTextSep}{\def\slegendXY{#1}} %
\define@key[psset]{legendXY}{borderlineSep}{\FPmul\sepTxlegendXY{#1}{2}} %
\pst@addfams{legendXY}%
\psset{legendSep=4, lineLength=5, lineTextSep=1, borderlineSep=1}%
\def\legendXY{\@ifnextchar[\@legendXY{\@legendXY[]}}%
\def\@legendXY[#1](#2,#3)#4#5{%
  \psset{#1}%
  \def\sepY{\sepYlegendXY}%
  \def\l{\llegendXY}%
  \def\s{\slegendXY}%
  \def\sepTx{\sepTxlegendXY}%
  \def\xaXY{#2}%
  \def\yzXY{#3}%
  \FPdiv\sep\sepY{8}%
  \FPdiv\sepYy\sepY{1.33} %
  \FPdiv\x\sep\unitX% To separate \sep mm the legend from the axe
  \FPdiv\y\sep\unitY% To separate \sep mm the legend from the axe
  \FPadd\leftX\xaXY{\x}%
  \FPadd\highY\yzXY{-\y}%
  \FPdiv\w{#4}\unitX%
  \FPadd\rightX\leftX{\w}%
  \FPdiv\sepTx\sepTx\unitX%
  \FPadd\posx\leftX\sepTx%
  \FPdiv\sepTy\sepYy\unitY%
  \FPadd\posy\highY{-\sepTy}%
  \FPdiv\dif{\sepY}\unitY% Separation of the legends
  \FPadd\n{#5}{-1}%
  \FPmul\lowY\dif\n%
  \FPadd\lowY\lowY\sepTy%
  \FPadd\lowY\posy{-\lowY}%
  \whiteBG[#1]{\leftX}{\lowY}{\rightX}{\highY}}%
\def\legendUL{\@ifnextchar[\@legendUL{\@legendUL[]}}%
\def\@legendUL[#1]#2#3{%
  \FPmul\xUL\MP@xa{1}%
  \FPmul\yUL\MP@yz{1}%
  \legendXY[#1](\xUL,\yUL){#2}{#3}}%
  %
  \def\legendUR{\@ifnextchar[\@legendUR{\@legendUR[]}}%
  \def\@legendUR[#1]#2#3{%
  \FPmul\xUR\MP@xz{1}%
  \FPmul\yUR\MP@yz{1}%
  \def\sep{0.5}%
  \FPdiv\xp\sep\unitX% To separate \sep mm the legend from the axe
  \FPmul\xp\xp{2}%
  \FPadd\xp\xUR{-\xp}%
  \FPdiv\xx{#2}\unitX%
  \FPadd\xp\xp{-\xx}%
  \legendXY[#1](\xp,\yUR){#2}{#3}}%
  %
\def\legendDL{\@ifnextchar[\@legendDL{\@legendDL[]}}%
\def\@legendDL[#1]#2#3{%
  \psset{#1}%
  \def\sepY{\sepYlegendXY}%
  \def\sepTx{\sepTxlegendXY}%
  \FPmul\xzDL\MP@xz{1}%
  \FPmul\xaDL\MP@xa{1}%
  \FPmul\yzDL\MP@yz{1}%
  \FPmul\yaDL\MP@ya{1}%
  \FPdiv\sep\sepY{8}%
  \FPdiv\sep\sepY{8}%
  \FPdiv\sepYy\sepY{1.33} %
  \FPdiv\x\sep\unitX% To separate \sep mm the legend from the axe
  \FPdiv\y\sep\unitY% To separate \sep mm the legend from the axe
  \FPadd\leftX\xaDL{0}%
  \FPdiv\w{#2}\unitX%
  \FPadd\rightX\leftX{\w}%
  \FPdiv\sepTx\sepTx\unitX%
  \FPadd\posx\leftX\sepTx%
  \FPadd\lowY\yaDL{\y}%
  \FPadd\lowY\lowY{\y}%
  \FPdiv\sepTy\sepYy\unitY%
  \FPadd\posy\lowY{\sepTy}%
  \FPdiv\dif\sepY\unitY% Separation of the legends
  \FPadd\n{#3}{-1}%
  \FPmul\highY\dif\n%
  \FPadd\highY\highY\sepTy%
  \FPadd\highY\posy{\highY}%
  \FPadd\posy\highY{-\sepTy}%
  \legendXY[#1](\leftX,\highY){#2}{#3}}%
  %
\def\legendDR{\@ifnextchar[\@legendDR{\@legendDR[]}}%
\def\@legendDR[#1]#2#3{%
  \psset{#1}%
  \def\sepY{\sepYlegendXY}%
  \def\sepTx{\sepTxlegendXY}%
  \FPmul\xzDR\MP@xz{1}%
  \FPmul\xaDR\MP@xa{1}%
  \FPmul\yzDR\MP@yz{1}%
  \FPmul\yaDR\MP@ya{1}%
  \FPdiv\sep\sepY{8}%
  \FPdiv\sepYy\sepY{1.33} %
  \FPdiv\x\sep\unitX% To separate \sep mm the legend from the axe
  \FPdiv\y\sep\unitY% To separate \sep mm the legend from the axe
  \FPadd\rightX\xzDR{-\x}%
  \FPdiv\w{#2}\unitX%
  \FPadd\leftX\rightX{-\w}%
  \FPadd\leftX\leftX{-\x}%
  \FPdiv\sepTx\sepTx\unitX%
  \FPadd\posx\leftX\sepTx%
  \FPadd\lowY\yaDR{\y}%
  \FPadd\lowY\lowY{\y}%
  \FPdiv\sepTy\sepYy\unitY%
  \FPadd\posy\lowY{\sepTy}%
  \FPdiv\dif{\sepY}\unitY% Separation of the legends
  \FPadd\n{#3}{-1}%
  \FPmul\highY\dif\n%
  \FPadd\highY\highY\sepTy%
  \FPadd\highY\posy{\highY}%
  \FPadd\posy\highY{-\sepTy}%
  \legendXY[#1](\leftX,\highY){#2}{#3}}%
\makeatother%
\endinput
%%
%% End of file `makeplot.sty'.
