%-------------------------------------------- % % 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 2010 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 . % %-------------------------------------------- % 1. OVERVIEW % % Plot handlers are extended versions of the plot handlers of PGF with % backwards compatibility. % % To remind ourselfes: PGF plot handlers work like this % \pgfplotstreamstart % \pgfplotstreampoint{...} % \pgfplotstreampoint{...} % \pgfplotstreampoint{...} % \pgfplotstreampoint{...} % \pgfplotstreamend % % and that's it. % % PGFPlots plot handlers also contain these three macros. The tasks % are (of course) the same. In addition, they support a set of further % macros for every plot handler: % % \pgfplotsplothandlersurveystart % \pgfplotsplothandlersurveypoint % \pgfplotsplothandlersurveyend % % and serialization methods % \pgfplotsplothandlerserializepointto % \pgfplotsplothandlerdeserializepointfrom % \pgfplotsplothandlerserializestateto % \pgfplotsplothandlerdeserializepointfrom % % in addition, there are utility macros % \pgfplotsplothandlersurveydifflen#1#2 % \pgfplotsplothandlersurveypointattime#1#2#3 % % The idea is as follows: % During \addplot, PGFPLots performs a survey phase. Survey means: % nothing will be drawn, only stats will be collected. In this phase, % the \pgfplotsplothandlersurvey* methods will be invoked; followed by % a serialization. % % Then, when every plot has been surveyed, PGFPlots calls % \pgfplotsplothandlerdeserializestatefrom{} % \pgfplotstreamstart % foreach { % \pgfplotsplothandlerdeserializepointfrom{} % apply data transformations % handle plot marks % \pgfplotstreampoint{\pgfplotsqpointxy{}{ % Furthermore, it remembers the <\macro> such that it can be % deserialized later. % Then, the survey phase ends. The main point of interest is the % \pgfplotsplothandlersurveypoint routine, especially its % communication with the axis. It is described below. % % POSTCONDITION: % - the state of the axis is now aware of the new plot (limits, % stacking, ...). % - The plot's survey state is stored using its serialized % representation. % % THE VISUALIZATION PHASE: % FIXME % % 2.1 The API of an axis % % As described above, the coordinate input routine fires a lot of % \pgfplots@coord@stream@coord commands, which, in turn, invoke % \pgfplotsplothandlersurveypoint. Somehow this should update the % axis' state to reflect each point. But the 'data point' is a rather % abstract thing. Usually, it will contain at least (x,y) (or maybe z) % coordinates. But it may be more complex. % % So, the coordinate input routine provides whatever the user has % chosen. Let's assume, we are using \addplot table. Then, we can % access every cell in the current row (using \thisrow{} for % example). The plot handler knows how to extract its information from % this state. In general, the following steps are taken: % - the plot handler assembles coordinates. % - every assembled coordinate should be reported to the axis by % defining \pgfplots@current@point@[xyz] to its coordinates and % calling % \pgfplotsaxisparsecoordinate{} % This will apply coordinate filters, parse the single coordinates % and apply high level transformations and any logarithms. % It is some sort of advanced coordinate parser which works only for % (x,y) or for (x,y,z). % It yields (x,y,z). But the axis might need to change its % components! Thus, you also need to call % \pgfplotsaxispreparecoordinate{}. % This will, for example, apply the "stack plots" feature or the % 'data cs' feature. % % If necessary, the plot handler calls % \pgfplotsaxisparsecoordinate{} and % \pgfplotsaxispreparecoordinate{} multiple times, once for each % encountered coordinate. % % It might occasionally be too much to call % \pgfplotsaxispreparecoordinate. % % It might happen that a coordinate filter discards a coordinate. % This is returned in the \ifpgfplotsaxisparsecoordinateok boolean % and has to be checked by the plot handler. % % - the plot handler knows which of the coordinates contribute to the % final plot. It invokes % \ifpgfplotsaxisparsecoordinateok % \pgfplotsaxisupdatelimitsforcoordinate{}{}{} % \fi % for each of these coordinates. This has to be done for final % coordinates only, i.e. after \pgfplotsaxispreparecoordinate. % % - eventually, the plot handler is satisfied and considers a data % point as "readily surveyed". It is allowed if this does *not* % happen inside of \pgfplotsplothandlersurveypoint, but it must % happen before \pgfplotsplothandlersurveyend is finished. % % The plot handler invokes \pgfplotsaxisdatapointsurveyed. % This tells the axis that it can perform its own surveying tasks % (see below) and furthermore, that it can serialize the data point. % Consequently, it will invoke % \pgfplotsplothandlerserializepointto{<\macro>} % and it will remember that \macro internally. This serialization is % employed to place plot marks and to apply z buffering techniques % (that's why it is done by the axis and not by the plot handler on % its own). % % The axis does its own surveying task, initiated by % \pgfplotsaxisdatapointsurveyed (which is, turn, invoked by the % plot handler). This command handles the |point meta| feature, that % is: it queries the |point meta| input source and updates the meta % limits. Furthermore, the error bar feature is processed at this % point (using the final data point's (x,y,z) coordinates as basis). % The |xtick=data| feature is also prepared at this stage. % % - Later, the coordinate input routine invokes % \pgfplots@coord@stream@end indicating the end-of-input. This will % finalize the survey phase. % % A simple example looks like this: % \pgfplotsplothandlersurveystart: does nothing in the simple example. % \pgfplotsplothandlersurveypoint: % parses the input format somehow to get (x,y,z) in raw, symbolic format % calls \pgfplotsaxisparsecoordinate % calls \pgfplotsaxispreparecoordinate % calls \ifpgfplotsaxisparsecoordinateok \pgfplotsaxisupdatelimitsforcoordinate{}{}{} % which allows to change the current plot style from within API % functions. It sets and remembers them for the % visualization phase. % % \pgfplotsaxisupdatelimitsforpointmeta{}, % provided there is a point meta input handler (which is numeric). % Otherwise, the command is equal to \relax. % % % 3. Details about the VISUALIZATION phase % % The visualization phase consists of % % \pgfplotstreamstart % foreach serialized coordinate { % pgfplots calls \pgfplotsplothandlerdeserializestatefrom{} % if coordinate is empty ("unbounded") % pgfplots call \pgfplotsplothandlervisualizejump % else % pgfplots calls \pgfplotsaxisvisphasetransformcoordinate % pgfplots calls \pgfplotsaxisvisphasepreparedatapoint % pgfplots calls either \pgfplotsqpointxyz or \pgfplotsqpointxy % fi % \pgfplotstreampoint % } % \pgfplotstreamend % % User defined plot handlers might need to invoke % \pgfplotsaxisvisphasetransformcoordinate on their own. % % During the visualization phase, the following macros can be used: % % - \pgfplotsaxisvisphasetransformpointmeta to set up point meta. % Use this only if there *is* point meta, see % \pgfplotsaxisifhaspointmeta{}{}. % % - \pgfplotsaxisvisphasegetpoint % does not take arguments. It takes the current point as input and % sets \pgf@x, \pgf@y to the final result. % % 4. API Functions of pgfplots to work with the visualization phases % % \pgfplotsifissurveyphase{}{} % \pgfplotsifisvisualizationphase{}{} % % \pgfplotsaxisfilteredcoordsaway % This macro expands to '1' if all points have been surveyed % successfully. It expands to '0' if at least one point has been % filtered away (for whatever reasons). This does not apply to % jumps. % \pgfplotsaxisplothasjumps % This macro expands to '1' if the current plot has jumps and '0' % if not.During the visualization phase, a jump is usually indicated % by an empty coordinate. % \pgfplotsaxisplothasunboundedpointmeta % This macro expands to '1' if the current plot has a point with % unbounded point meta and '0' % if not. Currently used by some plot handlers as synomym for % "visualize a jump" \def\pgfplotssurveyphaseinputclass{direct} \def\pgfplotsplothandlers@tikz@with@snap@to@nearest{% \pgfplothandlerdiscard,% \pgfplothandlermark,% \pgfplothandlermarklisted,% \pgfplothandlerxbar,% \pgfplothandlerybar,% \pgfplothandlerxbarinterval,% \pgfplothandlerybarinterval% }% \def\pgfplotsplothandlers@tikz@std{% \pgfplothandlerdiscard,% \pgfplothandlermark,% \pgfplothandlermarklisted,% \pgfplothandlerxbar,% \pgfplothandlerybar,% \pgfplothandlerxbarinterval,% \pgfplothandlerybarinterval,% \pgfplothandlerlineto,% \pgfplothandlercurveto,% \pgfplothandlerconstantlineto,% \pgfplothandlerconstantlinetomarkright,% \pgfplothandlerconstantlinetomarkmid,% \pgfplothandlerpolarcomb,% \pgfplothandlerjumpmarkmid,% \pgfplothandlerjumpmarkleft,% \pgfplothandlerjumpmarkright% }% % Defines \pgfplotsretval to be the csname for the BACKUP of plot % handler #1. % % For example: % \pgfplotsplothandlers@get@tikz@backup@name{\pgfplothandlerlineto} % will return \pgfplotsretval={\\pgfplothandlerlineto@tikz} % (up to \escapechar) \def\pgfplotsplothandlers@get@tikz@backup@name#1{% \begingroup %\escapechar=-1 % drop the leading backslash \expandafter\gdef\expandafter\pgfplotsretval\expandafter{\csname \string#1@tikz\endcsname}% \pgfmath@smuggleone\pgfplotsretval \endgroup }% % Takes the CURRENT \tikz@plot@handler and checks if it is an UNPATCHED tikz plot % handler. If so, it replaced it with the correct patched version. % % The motivation is that uf \tikz@plot@handler has been set outside of % an axis, it will not reflect the most recent changes (which are only % applied within an axis). \def\pgfplotsplothandlers@init@map@to@patched@versions{% % iterate through all tikz plot handlers... \expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplotsplothandlers@tikz@std}% \as\pgfplots@loc@TMPa{% % ... get the name of the backup (see \pgfplotsplothandlers@init) \expandafter\pgfplotsplothandlers@get@tikz@backup@name\pgfplots@loc@TMPa \expandafter\ifx\pgfplotsretval\tikz@plot@handler % AH! \tikz@plot@handler is the same as some backup name! % Replace it: \expandafter\let\expandafter\tikz@plot@handler\pgfplots@loc@TMPa \fi }% }% \def\pgfplotsplothandlers@init{% \def\pgfplotsplothandlers@init@##1{% \pgfplotsutil@add@to@macro##1{% \let\pgfplotsplothandlersurveydifflen=\pgfplotsplothandlersurveydifflen@snaptonearest \let\pgfplotsplothandlersurveypointattime=\pgfplotsplothandlersurveypointattime@snaptonearest }% }% \def\pgfplotsplothandlers@init@@##1{% % create backup: % % if ##1 = \pgfplothandlerlineto, this defines % \pgfplothandlerlineto@tikz as backup. \pgfplotsplothandlers@get@tikz@backup@name{##1}% \expandafter\let\pgfplotsretval=##1% % % % assign more suitable names: \pgfplotsutil@add@to@macro##1{% \begingroup \escapechar=-1 % drop the leading backslash \edef\pgfplotsplothandlername{\string##1}% \pgfmath@smuggleone\pgfplotsplothandlername \endgroup % \def\pgfplotsplothandlerLUAfactory{function(axis, pointmetainputhandler) return pgfplots.GenericPlothandler.new("\pgfplotsplothandlername", axis,pointmetainputhandler) end}% \def\pgfplotsplothandlerLUAvisualizerfactory{pgfplots.defaultPlotVisualizerFactory}% }% }% % Patch all TikZ plot handlers: % this here also creates backups \expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplotsplothandlers@tikz@std}% \as\pgfplots@loc@TMPa{% \expandafter\pgfplotsplothandlers@init@@\expandafter{\pgfplots@loc@TMPa}% }% % % Patch only selected ones: \expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplotsplothandlers@tikz@with@snap@to@nearest}% \as\pgfplots@loc@TMPa{% \expandafter\pgfplotsplothandlers@init@\expandafter{\pgfplots@loc@TMPa}% }% % \if1\b@pgfplots@compat@bar@width@units \else \def\pgfplotbarwidth{\pgfplots@bar@width@not@in@context}% \def\pgfplotbarshift{\pgfplots@bar@shift@not@in@context}% \pgfplotsutil@add@to@macro\pgfplothandlerxbar{% \def\pgfplotbarwidth{\pgfplots@xbar@width}% \def\pgfplotbarshift{\pgfplots@xbar@shift}% }% \pgfplotsutil@add@to@macro\pgfplothandlerybar{% \def\pgfplotbarwidth{\pgfplots@ybar@width}% \def\pgfplotbarshift{\pgfplots@ybar@shift}% }% \fi % \pgfplotsplothandlers@init@map@to@patched@versions % % % \pgfkeys{% % /pgf/at begin bar/.add={}{% % \if1\b@has@pgfplots@colordinate@style % \expandafter\pgfplots@bar@extra % \fi % },% % }% % }% \def\pgfplots@bar@extra#1\pgfkeysvalueof#2{% \expandafter\tikz\expandafter[\pgfplots@current@point@coordinatestyle] \pgfextra{#1};% }% \def\pgfplots@xbar@width{pgfplotsxbarwidth} \def\pgfplots@ybar@width{pgfplotsybarwidth} \def\pgfplots@xbar@shift{pgfplotsxbarshift} \def\pgfplots@ybar@shift{pgfplotsybarshift} \def\pgfplots@bar@width@not@in@context{pgfplotsbarwidthgeneric} \def\pgfplots@bar@shift@not@in@context{pgfplotsbarshiftgeneric} \pgfplotsmathdeclarepseudoconstant{pgfplotsxbarwidth}{\pgfplots@bar@mathparse@{y}{bar width}}% \pgfplotsmathdeclarepseudoconstant{pgfplotsybarwidth}{\pgfplots@bar@mathparse@{x}{bar width}}% \pgfplotsmathdeclarepseudoconstant{pgfplotsxbarshift}{\pgfplots@bar@mathparse@{y}{bar shift}}% \pgfplotsmathdeclarepseudoconstant{pgfplotsybarshift}{\pgfplots@bar@mathparse@{x}{bar shift}}% \pgfplotsmathdeclarepseudoconstant{pgfplotsbarwidthgeneric}{\pgfplots@bar@mathparse@{N}{bar width}}% \pgfplotsmathdeclarepseudoconstant{pgfplotsbarshiftgeneric}{\pgfplots@bar@mathparse@{N}{bar shift}}% \def\pgfplots@bar@mathparse@#1#2{% \pgfmathparse{\pgfkeysvalueof{/pgf/#2}}% \ifpgfmathunitsdeclared \else \edef\pgfplots@bar@direction@choice@{#1}% \if N\pgfplots@bar@direction@choice@% \if a\pgfplots@bar@direction@choice \else \if x\pgfplots@bar@direction@choice \def\pgfplots@bar@direction@choice@{y}% \else \if y\pgfplots@bar@direction@choice \def\pgfplots@bar@direction@choice@{x}% \else \pgfplotsthrow{invalid argument}{\pgfplots@bar@direction@choice@}{Sorry, the value of 'bar direction' is invalid}\pgfeov% \fi \fi \fi \fi \if N\pgfplots@bar@direction@choice@% \pgfplots@bar@mathparse@error{#1}{#2}% \else \let\pgfplots@loc@TMPa=\pgfmathresult \csname pgfplotstransformdirection\pgfplots@bar@direction@choice@\endcsname{\pgfplots@loc@TMPa}% \let\pgfplots@loc@TMPa=\pgfmathresult \if\pgfplots@bar@direction@choice@ x% \pgfqpointxy@orig{\pgfplots@loc@TMPa}{0}% \edef\pgfmathresult{\pgf@sys@tonumber\pgf@x}% \else \pgfqpointxy@orig{0}{\pgfplots@loc@TMPa}% \edef\pgfmathresult{\pgf@sys@tonumber\pgf@y}% \fi %\edef\pgfplots@loc@TMPa{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% %\expandafter\pgfmathveclen@\pgfplots@loc@TMPa \fi \fi }% \def\pgfplots@bar@mathparse@error#1#2{% \pgfplotsthrow{invalid argument}{\pgfplots@bar@direction@choice@}{Sorry, the value '#2=\pgfkeysvalueof{/pgf/#2}' is given in terms of a unit -- but I do not know which axis! Next steps: either (a) set one of 'xbar' or 'ybar' before evaluating the value of '#2' or (b) define 'bar direction=x or y'}\pgfeov% }% % Resets the plot handler routines. % % This is necessary before installing a new plot handler! \def\pgfplotsresetplothandler{% \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@default \let\pgfplotsplothandlerLUAfactory=\pgfplotsplothandlerLUAfactory@default \let\pgfplotsplothandlerLUAvisualizerfactory=\pgfplotsplothandlerLUAvisualizerfactory@default \let\pgfplotsplothandlername=\pgfplotsplothandlername@default \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@default \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@default \let\pgfplotsplothandlerpointtokeys=\pgfplotsplothandlerpointtokeys@default \let\pgfplotsplothandlerserializepointto=\pgfplotsplothandlerserializepointto@default \let\pgfplotsplothandlerdeserializepointfrom=\pgfplotsplothandlerdeserializepointfrom@default \let\pgfplotsplothandlerserializestateto=\pgfplotsplothandlerserializestateto@default \let\pgfplotsplothandlerdeserializestatefrom=\pgfplotsplothandlerdeserializestatefrom@default \let\pgfplotsplothandlervisualizejump=\pgfplotsplothandlervisualizejump@default \let\pgfplotsplothandlernotifyscanlinecomplete=\relax \let\pgfplotsplothandlersurveydifflen=\pgfplotsplothandlersurveydifflen@default \let\pgfplotsplothandlersurveypointattime=\pgfplotsplothandlersurveypointattime@default \let\pgfplotsplothandlertransformslopedattime=\pgfplotsplothandlertransformslopedattime@default \let\pgfplotsplothandlerifcurrentpointcanbefirstlast=\pgfplotsplothandlerifcurrentpointcanbefirstlast@default % \let\pgfplotsplothandlersurveybeforesetpointmeta=\pgfplotsplothandlersurveybeforesetpointmeta@default \let\pgfplotsplothandlersurveyaftersetpointmeta=\pgfplotsplothandlersurveyaftersetpointmeta@default }% \def\pgfplotsplothandlersurveybeforesetpointmeta@default{} \def\pgfplotsplothandlersurveyaftersetpointmeta@default{} % \pgfplotsplothandlersurveystart \def\pgfplotsplothandlersurveystart@default{}% % \pgfplotsplothandlername \def\pgfplotsplothandlername@default{% [tikz@plot@handler: \meaning\pgf@plotstreamstart]% }% % This should expand to a LUA function which takes the axis and the point % meta handler. % Use empty if there is none. \def\pgfplotsplothandlerLUAfactory@default{}% % This should expand to a LUA function which takes an instance of % Plothandler and which should return a PlotVisualizer. % Use empty if there is none. % % @see LUA: pgfplots.PlotVisualizer \def\pgfplotsplothandlerLUAvisualizerfactory@default{}% % \pgfplotsplothandlerifcurrentpointcanbefirstlast : can be used to % check if the current point of a plot handler can be the global first % or last segment. % It will execute #1 if that is the case and #2 if not. \def\pgfplotsplothandlerifcurrentpointcanbefirstlast@default#1#2{#1}% % \pgfplotsplothandlersurveyend % Called at the end of each survey phase. \def\pgfplotsplothandlersurveyend@default{} % A callback which will be called as soon as a scanline is complete. % % The callback can differ from plot handler to plot handler; its % purpose is to update data structures. % % Implementational note for those who _call_ the callback: the % The callback will be triggered by the 'empty line' handling, see % \pgfplotsscanlinelengthinitzero. However, a coordinate generator can % safely invoke it directly. It must not be invoked twice for the same % scanline. % % FIXME: only 'empty line=scanline' currently calls this callback! \let\pgfplotsplothandlernotifyscanlinecomplete=\relax% % \pgfplotsplothandlersurveypoint is called for each encountered data % point. % % The data point as such is available using the current state of any % macros which are assigned during the survey phase (during \addplot). % This includes any table macros etc. % PGFPlots stores the x,y and z coordinates into \pgfplots@current@point@[xyz]. % The point meta coordinate is in \pgfplots@current@point@meta. % % Note that since any currently assigned macro can be used here, the % new DV engine of PGF is also valid (and will be supported % eventually). This DV engine stores data point entries in keys, % namely those in the key path /data point. See the pgf manual. \def\pgfplotsplothandlersurveypoint@default{% \ifpgfplots@LUA@backend@supported \pgfplots@LUA@survey@point \else \pgfplotsplothandlersurveypoint@default@ \fi }% \def\pgfplotsplothandlersurveypoint@default@{% % reset it. NOTE: this migh be done multiple times. But better one % too much than one too few... \def\pgfplots@set@perpointmeta@done{0}% % \pgfplotsplothandlersurveypoint@default@noreset@of@pointmeta }% \def\pgfplotsplothandlersurveypoint@default@noreset@of@pointmeta{% \pgfplotsaxisparsecoordinate \pgfplotsaxispreparecoordinate \ifpgfplotsaxisparsecoordinateok \pgfplotsaxisupdatelimitsforcoordinate\pgfplots@current@point@x\pgfplots@current@point@y\pgfplots@current@point@z \fi \pgfplotsaxisdatapointsurveyed }% % \pgfplotsplothandlerserializepointto{<\macro>} % should save a complete data point to <\macro> such that it can be % de-serialized later. % % #1: a macro name. Will be filled with (expandable) data. % The format can be arbitrary, but you should be able to extra it. % % @PRECONDITION % this macro will be invoked in a context where the current data % point has been processed completely, including any preparations. % The required data which should be saved depends on the plot % handler. Usually, all plot handlers require % \pgfplots@current@point@[xyz] and \pgfplots@current@point@meta. % This macro should only assign keys which have been defined or % validated by any of the plot handler relevant methods (including % the de-serialization or survey methods). \def\pgfplotsplothandlerserializepointto@default#1{% % Store normalized point for list: % We need % xi,yi,zi; % where zi may be empty. % % Note that per-point meta information is stored in % \pgfplotsaxisserializedatapoint . \edef#1{\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z}% }% % \pgfplotsplothandlerdeserializepointfrom{<\macro>} % the counterpart for \pgfplotsplothandlerserializepointto. % It restores the state as it was before the serialization. % % #1: the serialized information. \def\pgfplotsplothandlerdeserializepointfrom@default#1{% \expandafter\pgfplotsplothandlerdeserializepointfrom@default@#1\relax }% % \pgfplotsplothandlerpointtokeys{} % % Takes the current point and copies its values to a set of keys. % % For example, if the current point has the three coordinates x=1, % y=2, z=3, % \pgfplotsplothandlerpointtokeys{/data point/first/} % will define the keys % /data point/first/x/.initial=1 % /data point/first/y/.initial=2 % /data point/first/z/.initial=3 % \def\pgfplotsplothandlerpointtokeys@default#1{% \pgfkeyslet{#1/x}\pgfplots@current@point@x \pgfkeyslet{#1/y}\pgfplots@current@point@y \pgfkeyslet{#1/z}\pgfplots@current@point@z }% \def\pgfplotsplothandlerdeserializepointfrom@default@#1,#2,#3\relax{% \def\pgfplots@current@point@x{#1}% \def\pgfplots@current@point@y{#2}% \def\pgfplots@current@point@z{#3}% }% % \pgfplotsplothandlerserializestateto{<\macro>} % should save the state of the current plot handler such that it can % be de-serialized later. % % The state does usually NOT contain a coordinate stream, this is % accomplished by \pgfplotsplothandlerserializepointto. % % #1: a macro name. Can be filled with anything, including % non-expandable macro invocations. \def\pgfplotsplothandlerserializestateto@default#1{% \def#1{}% }% % \def\pgfplotsplothandlerdeserializestatefrom@default#1{% #1% }% \def\pgfplotsplothandlervisualizejump@default{% \pgfplotstreamend \pgfplotstreamstart }% % \pgfplotsplothandlersurveypointattime#1#2#3 % % sets the current environment to a point which is between points #2 % and #3, using the fraction #1. % % #1 a fraction (a number between 0 and 1) in the format of % \pgfplotscoordmath{default} % #2 a serialized point denoting the start % #3 a serialized point denoting the end % % In other words: #1 = 0.0 should result in #2 and #1 = 1.0 should % result in #3. % % POSTCONDITION: the current point will be set to the point % in-between. The current point is set in terms of logical coordinates % (i.e. \pgfplots@current@point@x and its variants) \def\pgfplotsplothandlersurveypointattime@default#1#2#3{% \begingroup \pgfplotsplothandlerdeserializepointfrom{#2}% \let\pgfplots@last@x=\pgfplots@current@point@x \let\pgfplots@last@y=\pgfplots@current@point@y \let\pgfplots@last@z=\pgfplots@current@point@z \pgfplotsplothandlerdeserializepointfrom{#3}% % \def\pgfplots@loc@TMPa##1{% \pgfplotscoordmath{##1}{op}{subtract}{{\csname pgfplots@current@point@##1\endcsname}{\csname pgfplots@last@##1\endcsname}}% \let\pgfplots@diff=\pgfmathresult \pgfplotscoordmath{##1}{parsenumber}{#1}% \pgfplotscoordmath{##1}{op}{multiply}{{\pgfmathresult}{\pgfplots@diff}}% \pgfplotscoordmath{##1}{op}{add}{{\csname pgfplots@last@##1\endcsname}{\pgfmathresult}}% \expandafter\let\csname pgfplots@current@point@##1\endcsname=\pgfmathresult }% \pgfplots@loc@TMPa x% \pgfplots@loc@TMPa y% \ifpgfplots@curplot@threedim \pgfplots@loc@TMPa z% \fi \xdef\pgfplots@glob@TMPb{% \noexpand\def\noexpand\pgfplots@current@point@x{\pgfplots@current@point@x}% \noexpand\def\noexpand\pgfplots@current@point@y{\pgfplots@current@point@y}% \noexpand\def\noexpand\pgfplots@current@point@z{\pgfplots@current@point@z}% }% \endgroup \pgfplots@glob@TMPb }% % \pgfplotsplothandlersurveydifflen#1#2 % % computes the length between two points which are given in logical % coordinates. % #1 a serialized point % #2 a serialized point % % The return value is assigned to \pgfmathresult in % \pgfplotscoordmath{default} format. \def\pgfplotsplothandlersurveydifflen@default#1#2{% \begingroup \pgfplotsplothandlerdeserializepointfrom{#1}% \let\pgfplots@last@x=\pgfplots@current@point@x \let\pgfplots@last@y=\pgfplots@current@point@y \let\pgfplots@last@z=\pgfplots@current@point@z \pgfplotsplothandlerdeserializepointfrom{#2}% \pgfplotscoordmathparsemacro{default}\pgfplots@last@x \pgfplotscoordmathparsemacro{default}\pgfplots@last@y \pgfplotscoordmathparsemacro{default}\pgfplots@current@point@x \pgfplotscoordmathparsemacro{default}\pgfplots@current@point@y \ifpgfplots@curplot@threedim \pgfplotscoordmathparsemacro{default}\pgfplots@last@z \pgfplotscoordmathparsemacro{default}\pgfplots@current@point@z \fi \pgfplotscoordmath{default}{op}{subtract}{{\pgfplots@current@point@x}{\pgfplots@last@x}}% \pgfplotscoordmath{default}{op}{multiply}{{\pgfmathresult}{\pgfmathresult}}% \let\pgfplots@diff@x=\pgfmathresult \pgfplotscoordmath{default}{op}{subtract}{{\pgfplots@current@point@y}{\pgfplots@last@y}}% \pgfplotscoordmath{default}{op}{multiply}{{\pgfmathresult}{\pgfmathresult}}% \let\pgfplots@diff@y=\pgfmathresult \pgfplotscoordmath{default}{op}{add}{{\pgfplots@diff@x}{\pgfplots@diff@y}}% \let\pgfplots@len=\pgfmathresult \ifpgfplots@curplot@threedim \pgfplotscoordmath{default}{op}{subtract}{{\pgfplots@current@point@z}{\pgfplots@last@z}}% \pgfplotscoordmath{default}{op}{multiply}{{\pgfmathresult}{\pgfmathresult}}% \let\pgfplots@diff@z=\pgfmathresult \pgfplotscoordmath{default}{op}{add}{{\pgfplots@len}{\pgfplots@diff@z}}% \let\pgfplots@len=\pgfmathresult \fi \pgfplotscoordmath{default}{op}{sqrt}{{\pgfplots@len}}% \pgfmath@smuggleone\pgfmathresult \endgroup }% % \pgfplotsplothandlertransformslopedattime{