summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex92
1 files changed, 81 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex
index 7bbaa4b24bb..afd5f3509b4 100644
--- a/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex
@@ -1,10 +1,13 @@
-\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.3 2005/07/06 15:58:57 tantau Exp $
-
-% Copyright 2005 by Till Tantau <tantau@cs.tu-berlin.de>.
+% Copyright 2006 by Till Tantau
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
%
-% This program can be redistributed and/or modified under the terms
-% of the GNU Public License, version 2.
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.7 2006/10/11 15:22:26 tantau Exp $
\newif\ifpgf@plot@started
@@ -23,7 +26,7 @@
\def\pgfplothandlercurveto{%
\def\pgf@plotstreamstart{%
\global\let\pgf@plotstreampoint=\pgf@plot@curveto@handler@initial%
- \global\let\pgf@plotstreamspecial=\@gobble%
+ \global\let\pgf@plotstreamspecial=\pgf@gobble%
\global\let\pgf@plotstreamend=\pgf@plot@curveto@handler@finish%
\global\pgf@plot@startedfalse%
}%
@@ -113,7 +116,7 @@
\def\pgfplothandlerclosedcurve{%
\def\pgf@plotstreamstart{%
\global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@initial%
- \global\let\pgf@plotstreamspecial=\@gobble%
+ \global\let\pgf@plotstreamspecial=\pgf@gobble%
\global\let\pgf@plotstreamend=\pgf@plot@closedcurve@handler@finish%
}%
}
@@ -276,7 +279,7 @@
\def\pgfplothandlerxcomb{%
\def\pgf@plotstreamstart{%
\global\let\pgf@plotstreampoint=\pgf@plot@xcomb@handler%
- \global\let\pgf@plotstreamspecial=\@gobble%
+ \global\let\pgf@plotstreamspecial=\pgf@gobble%
\global\let\pgf@plotstreamend=\relax%
}%
}
@@ -302,7 +305,7 @@
\def\pgfplothandlerycomb{%
\def\pgf@plotstreamstart{%
\global\let\pgf@plotstreampoint=\pgf@plot@ycomb@handler%
- \global\let\pgf@plotstreamspecial=\@gobble%
+ \global\let\pgf@plotstreamspecial=\pgf@gobble%
\global\let\pgf@plotstreamend=\relax%
}%
}
@@ -331,7 +334,7 @@
\def\pgfplothandlerpolarcomb{%
\def\pgf@plotstreamstart{%
\global\let\pgf@plotstreampoint=\pgf@plot@polarcomb@handler%
- \global\let\pgf@plotstreamspecial=\@gobble%
+ \global\let\pgf@plotstreamspecial=\pgf@gobble%
\global\let\pgf@plotstreamend=\relax%
}%
}
@@ -359,19 +362,86 @@
% \pgfplotxyfile{mytable}
\def\pgfplothandlermark#1{%
+ \pgf@plothandlermark{%
+ \ifnum\pgf@plot@mark@count<\pgf@plot@mark@repeat\relax%
+ \else%
+ \global\pgf@plot@mark@count=0\relax%
+ #1%
+ \fi%
+ }%
+}
+
+\newcount\pgf@plot@mark@count
+\def\pgf@plot@mark@phase{0}
+
+\def\pgf@plothandlermark#1{%
\def\pgf@plot@mark{#1}%
\def\pgf@plotstreamstart{%
+ \global\pgf@plot@mark@count=\pgf@plot@mark@repeat\relax%
+ \global\advance\pgf@plot@mark@count by-\pgf@plot@mark@phase\relax%
\global\let\pgf@plotstreampoint=\pgf@plot@mark@handler%
- \global\let\pgf@plotstreamspecial=\@gobble%
+ \global\let\pgf@plotstreamspecial=\pgf@gobble%
\global\let\pgf@plotstreamend=\relax%
}%
}
\def\pgf@plot@mark@handler#1{%
+ \global\advance\pgf@plot@mark@count by1\relax%
{\pgftransformshift{#1}\pgf@plot@mark}%
}
+% Set the repeat count for marks. For example, if 3 is given as a
+% value, only every third point will get a mark.
+%
+% #1 = repeat count
+%
+% Example:
+%
+% \pgfsetplotmarkrepeat{2}
+
+\def\pgfsetplotmarkrepeat#1{\def\pgf@plot@mark@repeat{#1}}
+\pgfsetplotmarkrepeat{1}
+
+
+% Set the phase for marks. For example, if 3 is the repeat and 3 is
+% the phase, already the first point will be marked.
+%
+% #1 = the index of the first point that should be marked.
+%
+% Example:
+%
+% \pgfsetplotmarkphase{3}
+
+\def\pgfsetplotmarkphase#1{\def\pgf@plot@mark@phase{#1}}
+\pgfsetplotmarkphase{1}
+
+
+
+% This handler draws a given mark at those points whose number is
+% given in the (pgffor-like) list.
+%
+% #1 = some code to be executed at each point (with the coordinate
+% system translated to that point).
+% Typically, this code will be \pgfuseplotmark{whatever}.
+% #2 = list of positions like "1,2,4,...,9,10"
+%
+% Example:
+%
+% \pgfplothandlermarklisted{\pgfuseplotmark{*}}{1,2,4,...,9}
+% \pgfplotxyfile{mytable}
+
+\def\pgfplothandlermarklisted#1#2{%
+ \let\pgf@plot@mark@list=\pgf@empty%
+ \edef\pgf@marshal{\noexpand\foreach\noexpand\pgf@temp in{#2}}
+ \pgf@marshal{\xdef\pgf@plot@mark@list{\pgf@plot@mark@list(\pgf@temp)}}%
+ \pgf@plothandlermark{%
+ \edef\pgf@marshal{\noexpand\in@{(\the\pgf@plot@mark@count)}{\pgf@plot@mark@list}}%
+ \pgf@marshal%
+ \ifin@#1\fi}%
+}
+
+
% Define a new plot mark for use with \pgfplotmark.
%
% #1 = a plot mark mnemonic