| 1 |
%-------------------------------------------- |
| 2 |
% |
| 3 |
% Package pgfplots |
| 4 |
% |
| 5 |
% Provides a user-friendly interface to create function plots (normal |
| 6 |
% plots, semi-logplots and double-logplots). |
| 7 |
% |
| 8 |
% It is based on Till Tantau's PGF package. |
| 9 |
% |
| 10 |
% Copyright 2007-2021 by Christian Feuersänger. |
| 11 |
% |
| 12 |
% This program is free software: you can redistribute it and/or modify |
| 13 |
% it under the terms of the GNU General Public License as published by |
| 14 |
% the Free Software Foundation, either version 3 of the License, or |
| 15 |
% (at your option) any later version. |
| 16 |
% |
| 17 |
% This program is distributed in the hope that it will be useful, |
| 18 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
% GNU General Public License for more details. |
| 21 |
% |
| 22 |
% You should have received a copy of the GNU General Public License |
| 23 |
% along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 24 |
|
| 25 |
|
| 26 |
\ifpgfplots@LUA@supported |
| 27 |
\pgfplotsutil@directlua{require("prepcontour");} |
| 28 |
\pgfplotsset{ |
| 29 |
contour lua/.style={ |
| 30 |
contour external={% |
| 31 |
% we decided to NOT precompute contour/levels: |
| 32 |
% @before cmd=\pgfplotscontourpopulateallkeys, |
| 33 |
scanline marks=required, |
| 34 |
script type=lua, |
| 35 |
% |
| 36 |
% this library consumes FOUR coordinates... |
| 37 |
script input format=x y z meta, |
| 38 |
% ... and it also generates FOUR. Always read the last one |
| 39 |
% as it is never subject to rounding issues within the |
| 40 |
% same contour line: |
| 41 |
output point meta=explicit, |
| 42 |
% |
| 43 |
script={ |
| 44 |
copylines = 0; |
| 45 |
nblocks = \if 0\ordering \pgfkeysvalueof{/pgfplots/mesh/rows}\else \pgfkeysvalueof{/pgfplots/mesh/cols}\fi; |
| 46 |
nlines = \if 0\ordering \pgfkeysvalueof{/pgfplots/mesh/cols}\else \pgfkeysvalueof{/pgfplots/mesh/rows}\fi; |
| 47 |
if copylines == nil or nblocks == nil or nlines == nil then |
| 48 |
io.stderr:write("failed to parse arguments"); |
| 49 |
os.exit(2); |
| 50 |
end; |
| 51 |
yvaries = \if 0\ordering 'x'\else 'y'\fi; |
| 52 |
yvaries = (yvaries == 'y'); |
| 53 |
infile = io.open(\"\infile\", \"r\"); |
| 54 |
outfile = io.open(\"\outfile\", \"w\"); |
| 55 |
mesh = PrepcMesh.new(yvaries, nblocks, nlines, copylines, infile, outfile); |
| 56 |
\ifpgfplotsplothandlercontour@corners |
| 57 |
corners = true; |
| 58 |
\else |
| 59 |
corners = false; |
| 60 |
\fi |
| 61 |
\ifx\thecontourlevels\pgfutil@empty |
| 62 |
mesh:autocontour(\thecontournumber, \pgfplotsmetamin, \pgfplotsmetamax, corners); |
| 63 |
\else |
| 64 |
levels = {\thecontourlevels}; |
| 65 |
for n = 1, \#levels do |
| 66 |
level = tonumber(levels[n]); |
| 67 |
if level then |
| 68 |
mesh:contour(level, corners); |
| 69 |
end; |
| 70 |
end; |
| 71 |
\fi |
| 72 |
io.close(infile); |
| 73 |
mesh:printcontours(); |
| 74 |
io.close(outfile); |
| 75 |
},% |
| 76 |
#1,% |
| 77 |
}, |
| 78 |
} |
| 79 |
} |
| 80 |
\else |
| 81 |
% do not throw the exception at load time ... this library is |
| 82 |
% included as default |
| 83 |
\pgfplotsset{ |
| 84 |
contour lua/.code={ |
| 85 |
\pgfplots@error{Library 'contour lua' requires you to run in LUA mode (i.e. lualatex instead of pdflatex)}% |
| 86 |
} |
| 87 |
} |
| 88 |
\fi |
| 89 |
|
| 90 |
|
| 91 |
|