From 1d11e46a7579f881de8027eed0eecfb5aaf8691a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 8 May 2021 21:05:43 +0000 Subject: pgfplots (8may21) git-svn-id: svn://tug.org/texlive/trunk@59132 c570f23f-e606-0410-a88d-b1316a301751 --- .../libs/tikzlibrarypgfplots.contourlua.code.tex | 91 ++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.contourlua.code.tex (limited to 'Master/texmf-dist/tex/generic/pgfplots/libs') diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.contourlua.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.contourlua.code.tex new file mode 100644 index 00000000000..f7821013eb5 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.contourlua.code.tex @@ -0,0 +1,91 @@ +%-------------------------------------------- +% +% Package pgfplots +% +% Provides a user-friendly interface to create function plots (normal +% plots, semi-logplots and double-logplots). +% +% It is based on Till Tantau's PGF package. +% +% Copyright 2007-2021 by Christian Feuersänger. +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see . + + +\ifpgfplots@LUA@supported + \pgfplotsutil@directlua{require("prepcontour");} + \pgfplotsset{ + contour lua/.style={ + contour external={% + % we decided to NOT precompute contour/levels: + % @before cmd=\pgfplotscontourpopulateallkeys, + scanline marks=required, + script type=lua, + % + % this library consumes FOUR coordinates... + script input format=x y z meta, + % ... and it also generates FOUR. Always read the last one + % as it is never subject to rounding issues within the + % same contour line: + output point meta=explicit, + % + script={ + copylines = 0; + nblocks = \if 0\ordering \pgfkeysvalueof{/pgfplots/mesh/rows}\else \pgfkeysvalueof{/pgfplots/mesh/cols}\fi; + nlines = \if 0\ordering \pgfkeysvalueof{/pgfplots/mesh/cols}\else \pgfkeysvalueof{/pgfplots/mesh/rows}\fi; + if copylines == nil or nblocks == nil or nlines == nil then + io.stderr:write("failed to parse arguments"); + os.exit(2); + end; + yvaries = \if 0\ordering 'x'\else 'y'\fi; + yvaries = (yvaries == 'y'); + infile = io.open(\"\infile\", \"r\"); + outfile = io.open(\"\outfile\", \"w\"); + mesh = PrepcMesh.new(yvaries, nblocks, nlines, copylines, infile, outfile); + \ifpgfplotsplothandlercontour@corners + corners = true; + \else + corners = false; + \fi + \ifx\thecontourlevels\pgfutil@empty + mesh:autocontour(\thecontournumber, \pgfplotsmetamin, \pgfplotsmetamax, corners); + \else + levels = {\thecontourlevels}; + for n = 1, \#levels do + level = tonumber(levels[n]); + if level then + mesh:contour(level, corners); + end; + end; + \fi + io.close(infile); + mesh:printcontours(); + io.close(outfile); + },% + #1,% + }, + } + } +\else + % do not throw the exception at load time ... this library is + % included as default + \pgfplotsset{ + contour lua/.code={ + \pgfplots@error{Library 'contour lua' requires you to run in LUA mode (i.e. lualatex instead of pdflatex)}% + } + } +\fi + + + -- cgit v1.2.3