summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-plot-handlers.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-plot-handlers.tex')
-rw-r--r--Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-plot-handlers.tex266
1 files changed, 266 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-plot-handlers.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-plot-handlers.tex
index efe70ab6975..fd58176b7a2 100644
--- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-plot-handlers.tex
+++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-plot-handlers.tex
@@ -97,6 +97,76 @@
\end{codeexample}
\end{command}
+\subsection{Constant Plot Handlers}
+There are three plot handlers which produce piecewise constant interpolations between successive points.
+
+\begin{command}{\pgfplothandlerconstantlineto}
+ This handler works like the line-to plot handler, only it will
+ produce a connected, piecewise constant path to connect the points.
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \draw[gray] (0,0) node {x} (1,1) node {y} (2,.5) node {z};
+ \pgfplothandlerconstantlineto
+ \pgfplotstreamstart
+ \pgfplotstreampoint{\pgfpoint{0cm}{0cm}}
+ \pgfplotstreampoint{\pgfpoint{1cm}{1cm}}
+ \pgfplotstreampoint{\pgfpoint{2cm}{0.5cm}}
+ \pgfplotstreamend
+ \pgfusepath{stroke}
+\end{tikzpicture}
+\end{codeexample}
+\end{command}
+
+\begin{command}{\pgfplothandlerconstantlinetomarkright}
+A variant of |\pgfplothandlerconstantlineto| which places its mark on
+the right line ends.
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \draw[gray] (0,0) node {x} (1,1) node {y} (2,.5) node {z};
+ \pgfplothandlerconstantlinetomarkright
+ \pgfplotstreamstart
+ \pgfplotstreampoint{\pgfpoint{0cm}{0cm}}
+ \pgfplotstreampoint{\pgfpoint{1cm}{1cm}}
+ \pgfplotstreampoint{\pgfpoint{2cm}{0.5cm}}
+ \pgfplotstreamend
+ \pgfusepath{stroke}
+\end{tikzpicture}
+\end{codeexample}
+\end{command}
+
+\begin{command}{\pgfplothandlerjumpmarkleft}
+ This handler works like the line-to plot handler, only it will
+ produce a non-connected, piecewise constant path to connect the points. If there are any plot marks, they will be placed on the left open pieces.
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \draw[gray] (0,0) node {x} (1,1) node {y} (2,.5) node {z};
+ \pgfplothandlerjumpmarkleft
+ \pgfplotstreamstart
+ \pgfplotstreampoint{\pgfpoint{0cm}{0cm}}
+ \pgfplotstreampoint{\pgfpoint{1cm}{1cm}}
+ \pgfplotstreampoint{\pgfpoint{2cm}{0.5cm}}
+ \pgfplotstreamend
+ \pgfusepath{stroke}
+\end{tikzpicture}
+\end{codeexample}
+\end{command}
+
+\begin{command}{\pgfplothandlerjumpmarkright}
+ This handler works like the line-to plot handler, only it will
+ produce a non-connected, piecewise constant path to connect the points. If there are any plot marks, they will be placed on the right open pieces.
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \draw[gray] (0,0) node {x} (1,1) node {y} (2,.5) node {z};
+ \pgfplothandlerjumpmarkright
+ \pgfplotstreamstart
+ \pgfplotstreampoint{\pgfpoint{0cm}{0cm}}
+ \pgfplotstreampoint{\pgfpoint{1cm}{1cm}}
+ \pgfplotstreampoint{\pgfpoint{2cm}{0.5cm}}
+ \pgfplotstreamend
+ \pgfusepath{stroke}
+\end{tikzpicture}
+\end{codeexample}
+\end{command}
\subsection{Comb Plot Handlers}
@@ -162,6 +232,202 @@ that the plots they produce look like ``combs'' (more or less).
\end{codeexample}
\end{command}
+\pgfname\ bar or comb plots usually draw something from zero to the
+current plot's coordinate. The ``zero'' offset can be changed using an
+input stream which returns the desired offset successively for each
+processed coordinate.
+
+There are two such streams, which can be configured independently.
+The first one returns ``zeros'' for coordinate~$x$, the second one
+returns ``zeros'' for coordinate~$y$. They are used as follows.
+
+\begin{codeexample}[code only]
+\pgfplotxzerolevelstreamstart
+\pgfplotxzerolevelstreamnext % assigns \pgf@x
+\pgfplotxzerolevelstreamnext
+\pgfplotxzerolevelstreamnext
+\pgfplotxzerolevelstreamend
+\end{codeexample}
+%
+\begin{codeexample}[code only]
+\pgfplotyzerolevelstreamstart
+\pgfplotyzerolevelstreamnext % assigns \pgf@x
+\pgfplotyzerolevelstreamend
+\end{codeexample}
+Different zero level streams can be implemented by overwriting these macros.
+
+\begin{command}{\pgfplotxzerolevelstreamconstant\marg{dimension}}
+ This zero level stream always returns \marg{dimension} instead of
+ $x=0$pt.
+
+ It is used for |xcomb| and |xbar|.
+\end{command}
+
+\begin{command}{\pgfplotyzerolevelstreamconstant\marg{dimension}}
+ This zero level stream always returns \marg{dimension} instead of
+ $y=0$pt.
+
+ It is used for |ycomb| and |ybar|.
+\end{command}
+
+\subsection{Bar Plot Handlers}
+\label{section-plotlib-bar-handlers}
+
+While comb plot handlers produce a line-to operation to generate
+combs, bar plot handlers employ rectangular shapes, allowing filled
+bars (or pattern bars).
+
+\begin{command}{\pgfplothandlerybar}
+ This handler converts each point in the plot stream into a rectangle
+ from the $x$-axis to the point's coordinate. The rectangle is placed
+ centered at the $x$-axis.
+
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \draw[gray] (0,0) node {x} (1,1) node {y} (2,.5) node {z};
+ \pgfplothandlerybar
+ \pgfplotstreamstart
+ \pgfplotstreampoint{\pgfpoint{0cm}{0cm}}
+ \pgfplotstreampoint{\pgfpoint{1cm}{1cm}}
+ \pgfplotstreampoint{\pgfpoint{2cm}{0.5cm}}
+ \pgfplotstreamend
+ \pgfusepath{stroke}
+\end{tikzpicture}
+\end{codeexample}
+\end{command}
+
+\begin{command}{\pgfplothandlerxbar}
+ This handler converts each point in the plot stream into a rectangle
+ from the $y$-axis to the point's coordinate. The rectangle is placed
+ centered at the $y$-axis.
+
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \draw[gray] (0,0) node {x} (1,1) node {y} (2,.5) node {z};
+ \pgfplothandlerxbar
+ \pgfplotstreamstart
+ \pgfplotstreampoint{\pgfpoint{0cm}{0cm}}
+ \pgfplotstreampoint{\pgfpoint{1cm}{1cm}}
+ \pgfplotstreampoint{\pgfpoint{2cm}{0.5cm}}
+ \pgfplotstreamend
+ \pgfusepath{stroke}
+\end{tikzpicture}
+\end{codeexample}
+\end{command}
+
+\label{key-bar-width}%
+\begin{key}{/pgf/bar width=\marg{dimension} (initially 10pt)}
+ \keyalias{tikz}
+ Sets the width of |\pgfplothandlerxbar| and |\pgfplothandlerybar| to
+ \marg{dimension}. The argument \marg{dimension} will be evaluated
+ using the math parser.
+\end{key}
+
+\label{key-bar-shift}%
+\begin{key}{/pgf/bar shift=\marg{dimension} (initially 0pt)}
+ \keyalias{tikz}
+ Sets a shift used by |\pgfplothandlerxbar| and |\pgfplothandlerybar|
+ to \marg{dimension}. It has the same effect as |xshift|, but it
+ applies only to those bar plots. The argument \marg{dimension} will
+ be evaluated using the math parser.
+\end{key}
+
+\begin{command}{\pgfplotbarwidth}
+ Expands to the value of |/pgf/bar width|.
+\end{command}
+
+
+\begin{command}{\pgfplothandlerybarinterval}
+ This handler is a variant of |\pgfplothandlerybar| which works with
+ intervals instead of points.
+
+ Bars are drawn between successive input coordinates and the width is
+ determined relatively to the interval length.
+
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \draw[gray] (0,2) node {$x_1$} (1,1) node {$x_2$} (2,.5) node {$x_3$} (4,0.7) node {$x_4$};
+ \pgfplothandlerybarinterval
+ \pgfplotstreamstart
+ \pgfplotstreampoint{\pgfpoint{0cm}{2cm}}
+ \pgfplotstreampoint{\pgfpoint{1cm}{1cm}}
+ \pgfplotstreampoint{\pgfpoint{2cm}{0.5cm}}
+ \pgfplotstreampoint{\pgfpoint{4cm}{0.7cm}}
+ \pgfplotstreamend
+ \pgfusepath{stroke}
+\end{tikzpicture}
+\end{codeexample}
+
+In more detail, if $(x_i,y_i)$ and $(x_{i+1},y_{i+1})$ denote
+successive input coordinates, the bar will be placed above the
+interval $[x_i,x_{i+1}]$, centered at \[ x_i + \text{\meta{bar
+ interval shift}} \cdot (x_{i+1} - x_i) \] with width \[
+\text{\meta{bar interval width}} \cdot (x_{i+1} - x_i). \] Here,
+\meta{bar interval shift} and \meta{bar interval width} denote the
+current values of the associated options.
+
+If you have $N+1$ input points, you will get $N$ bars (one for each
+interval). The $y$~value of the last point will be ignored.
+\end{command}
+
+\begin{command}{\pgfplothandlerxbarinterval}
+ As |\pgfplothandlerybarinterval|, this handler provides bar plots
+ with relative bar sizes and offsets, one bar for each
+ $y$~coordinate interval.
+\end{command}
+
+\label{key-bar-interval-shift}%
+\begin{key}{/pgf/bar interval shift=\marg{shift} (initially 0.5)}
+ \keyalias{tikz}
+ Sets the \emph{relative} shift of |\pgfplothandlerxbarinterval| and
+ |\pgfplothandlerybarinterval| to \marg{shift}. As
+ |/pgf/bar interval width|, the argument is relative to the interval
+ length of the input coordinates.
+
+ The argument \marg{scale} will be evaluated using the math parser.
+\end{key}
+
+\label{key-bar-interval-width}%
+\begin{key}{/pgf/bar interval width=\marg{scale} (initially 1)}
+ \keyalias{tikz}
+ Sets the \emph{relative} width of |\pgfplothandlerxbarinterval| and
+ |\pgfplothandlerybarinterval| to \marg{scale}. The argument is
+ relative to $(x_{i+1} - x_i)$ for $y$~bar plots and relative to
+ $(y_{i+1}-y_i)$ for $x$~bar plots.
+
+ The argument \marg{scale} will be evaluated using the math parser.
+\begin{codeexample}[]
+\begin{tikzpicture}[bar interval width=0.5]
+ \draw[gray]
+ (0,3) -- (0,-0.1)
+ (1,3) -- (1,-0.1)
+ (2,3) -- (2,-0.1)
+ (4,3) -- (4,-0.1);
+ \pgfplothandlerybarinterval
+ \begin{scope}[bar interval shift=0.25,fill=blue]
+ \pgfplotstreamstart
+ \pgfplotstreampoint{\pgfpoint{0cm}{2cm}}
+ \pgfplotstreampoint{\pgfpoint{1cm}{1cm}}
+ \pgfplotstreampoint{\pgfpoint{2cm}{0.5cm}}
+ \pgfplotstreampoint{\pgfpoint{4cm}{0.7cm}}
+ \pgfplotstreamend
+ \pgfusepath{fill}
+ \end{scope}
+ \begin{scope}[bar interval shift=0.75,fill=red]
+ \pgfplotstreamstart
+ \pgfplotstreampoint{\pgfpoint{0cm}{3cm}}
+ \pgfplotstreampoint{\pgfpoint{1cm}{0.2cm}}
+ \pgfplotstreampoint{\pgfpoint{2cm}{0.7cm}}
+ \pgfplotstreampoint{\pgfpoint{4cm}{0.2cm}}
+ \pgfplotstreamend
+ \pgfusepath{fill}
+ \end{scope}
+\end{tikzpicture}
+\end{codeexample}
+ Please note that bars are always centered, so we have to use shifts
+ $0.25$ and $0.75$ instead of $0$ and $0.5$.
+\end{key}
+
\subsection{Mark Plot Handler}
\label{section-plot-marks}