Debian Codegraph @

texmf-dist/tex/generic/pgfplots/pgfplots.paths.code.tex

raw
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-2012 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 %
27
28 \newif\ifpgfplots@path@replace@ellipse
29
30 \def\pgfplots@install@path@replacements{%
31 \ifpgfplots@path@replace@ellipse
32 \let\tikz@do@circle=\pgfplots@path@@tikz@do@circle
33 \let\tikz@do@ellipse=\pgfplots@path@@tikz@do@ellipse
34 \expandafter\def\expandafter\pgfinterruptpicture\expandafter{\pgfinterruptpicture
35 \let\tikz@do@circle=\pgfplots@path@@tikz@do@circle@orig
36 \let\tikz@do@ellipse=\pgfplots@path@@tikz@do@ellipse@orig
37 }%
38 \fi
39 }%
40
41 \let\pgfplots@path@@tikz@do@circle@orig=\tikz@do@circle
42 \let\pgfplots@path@@tikz@do@ellipse@orig=\tikz@do@ellipse
43
44 % This is a replacement for \tikz@do@circle which replaces the "xy"
45 % coordinate system by one which is compatible with pgfplots.
46 \def\pgfplots@path@@tikz@do@circle#1{%
47 \begingroup
48 \ifpgfplots@usefpu
49 \pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
50 \fi
51 \pgfmathparse{#1}%
52 \let\tikz@ellipse@x=\pgfmathresult%
53 \ifpgfmathunitsdeclared
54 \pgfpathellipse{\pgfpointorigin}%
55 {\pgfqpoint{\tikz@ellipse@x pt}{0pt}}%
56 {\pgfpoint{0pt}{\tikz@ellipse@x pt}}%
57 \else
58 \pgfpathellipse{\pgfpointorigin}%
59 {\pgfplotspointaxisdirectionxy{\tikz@ellipse@x}{0}}%
60 {\pgfplotspointaxisdirectionxy{0}{\tikz@ellipse@x}}%
61 \fi
62 \endgroup
63 }
64
65 \def\pgfplots@path@@tikz@do@ellipse#1#2{%
66 \begingroup
67 \ifpgfplots@usefpu
68 \pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
69 \fi
70 \pgfmathparse{#1}%
71 \let\tikz@ellipse@x=\pgfmathresult%
72 \ifpgfmathunitsdeclared%
73 \pgfmathparse{#2}%
74 \let\tikz@ellipse@y=\pgfmathresult%
75 \ifpgfmathunitsdeclared%
76 \pgfpathellipse{\pgfpointorigin}{%
77 \pgfqpoint{\tikz@ellipse@x pt}{0pt}}{\pgfpoint{0pt}{\tikz@ellipse@y pt}}%
78 \else%
79 \PackageError{tikz}{You cannot mix dimensions and dimensionless values in an ellipse}{}%
80 \fi%
81 \else%
82 \pgfmathparse{#2}%
83 \let\tikz@ellipse@y=\pgfmathresult%
84 \ifpgfmathunitsdeclared%
85 \PackageError{tikz}{You cannot mix dimensions and dimensionless values in an ellipse}{}%
86 \else%
87 \pgfpathellipse{\pgfpointorigin}
88 {\pgfplotspointaxisdirectionxy{\tikz@ellipse@x}{0}}
89 {\pgfplotspointaxisdirectionxy{0}{\tikz@ellipse@y}}%
90 \fi%
91 \fi%
92 \endgroup
93 }
94
95 % Older versions of TikZ did not define \tikz@do@ellipse but only
96 % \tikz@do@circle which took the place of \tikz@do@ellipse, i.e. the same code
97 % was used for both paths. In that case, we override the new circle code with
98 % the ellipse code to retain the behaviour of using the same code on both
99 % paths.
100 \ifdefined\tikz@do@ellipse\else
101 \let\pgfplots@path@@tikz@do@circle=\pgfplots@path@@tikz@do@ellipse
102 \fi