diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-dv-main.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-dv-main.tex | 169 |
1 files changed, 137 insertions, 32 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-dv-main.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-dv-main.tex index a2743a9fb57..1efb972e439 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-dv-main.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-dv-main.tex @@ -111,7 +111,7 @@ since the default format is the one used for the data following the represents a data point. \medskip -\textbf{Number accuracy.} +\textbf{Number accuracy.}\label{section-dv-expressions} Data visualizations typically demand a much higher accuracy and range of values than \TeX\ provides: \TeX\ numbers are limited to 13 bits for the integer part and 16 bits for the fractional part. Because of @@ -202,7 +202,7 @@ predefined styles take care of this for you: \begin{codeexample}[] \begin{tikzpicture} \datavisualization [ - scientific clean axes, + scientific axes=clean, x axis={length=3cm, ticks=few}, all axes={grid}, visualize as smooth line @@ -232,7 +232,7 @@ visualizers or pie chart visualizers. \begin{codeexample}[] \begin{tikzpicture} \datavisualization [ - scientific clean axes, + scientific axes=clean, x axis={length=3cm, ticks=few}, visualize as smooth line ] @@ -245,7 +245,7 @@ visualizers or pie chart visualizers. \begin{codeexample}[] \begin{tikzpicture} \datavisualization [ - scientific clean axes, + scientific axes=clean, x axis={length=3cm, ticks=few}, visualize as scatter ] @@ -291,24 +291,24 @@ coloring and the dashing is varied. \begin{codeexample}[] \begin{tikzpicture}[baseline] - \datavisualization [ scientific clean axes, + \datavisualization [ scientific axes=clean, y axis=grid, visualize as smooth line/.list={sin,cos,tan}, - visualizer style sheet=strong colors, - visualizer style sheet=vary dashing, + style sheet=strong colors, + style sheet=vary dashing, sin={label in legend={text=$\sin x$}}, cos={label in legend={text=$\cos x$}}, tan={label in legend={text=$\tan x$}}, data/format=function ] - data [sin] { + data [set=sin] { var x : interval [-0.5*pi:4]; func y = sin(\value x r); } - data [cos] { + data [set=cos] { var x : interval [-0.5*pi:4]; func y = cos(\value x r); } - data [tan] { + data [set=tan] { var x : interval [-0.3*pi:.3*pi]; func y = tan(\value x r); }; @@ -384,17 +384,17 @@ visualizations. The \meta{options} are executed with the prefix |/pgf/data|. The following options are always available: - \begin{key}{/pgf/data/source=\meta{filename} (initially \normalfont empty)} + \begin{key}{/pgf/data/read from file=\meta{filename} (initially \normalfont empty)} If you set the |source| attribute to a non-empty \meta{filename}, the data will be read from this file. In this case, no \meta{inline data} may be present, not even empty curly braces should be provided. \begin{codeexample}[code only] \datavisualization ... - data [source=file1.csv] - data [source=file2.csv]; + data [read from file=file1.csv] + data [read from file=file2.csv]; \end{codeexample} - The other way round, if |source| is empty, the data must directly + The other way round, if |read from file| is empty, the data must directly follow as \meta{inline data}. \begin{codeexample}[code only] \datavisualization ... @@ -434,12 +434,12 @@ visualizations. command: \begin{codeexample}[code only] \datavisualization... - data [/data point/experiment=7, source=experiment007.csv] - data [/data point/experiment=23, source=experiment023.csv]; + data [/data point/experiment=7, read from file=experiment007.csv] + data [/data point/experiment=23, read from file=experiment023.csv]; \end{codeexample} - \begin{codeexample}[] -\begin{tikzpicture} +\begin{codeexample}[] +\tikz \datavisualization [school book axes, visualize as line] data [/data point/x=1] { y @@ -451,7 +451,6 @@ visualizations. 2 0.5 }; -\end{tikzpicture} \end{codeexample} \medskip @@ -490,6 +489,86 @@ visualizations. \end{datavisualizationoperation} +\begin{datavisualizationoperation}{data point}{\opt{\oarg{options}}} + This command is used to specify data a single data point. The + \meta{options} are simply executed with the path |/data point| and + then a data point is created. This means that inside the + \meta{options} you just specify the values of all attributes in + key-value syntax. +\begin{codeexample}[] +\tikz \datavisualization [school book axes, visualize as line] + data point [x=1, y=1] data point [x=1, y=2] + data point [x=2, y=2] data point [x=2, y=0.5]; +\end{codeexample} +\end{datavisualizationoperation} + +\begin{key}{/tikz/data visualization/data point=\meta{options}} + This key is the ``key version'' of the previous command. The + difference is that this key can be used internally inside styles. +\begin{codeexample}[] +\tikzdatavisualizationset{ + horizontal/.style={ + data point={x=#1, y=1}, data point={x=#1, y=2}}, +} +\tikz \datavisualization +[ school book axes, visualize as line, + horizontal=1, + horizontal=2 ]; +\end{codeexample} +\end{key} + +\begin{datavisualizationoperation}{data group}{\opt{\oarg{options}}\marg{name}\opt{|+=|\marg{data specifications}}} + You can store a whole \meta{data specification} in a \emph{data + group}. This allows you to reuse data in multiple places without + having to write the data to an external file. + + The syntax of this command comes in the following three variants: + \begin{itemize} + \item |data group| \opt{\oarg{options}} \marg{name} |=| \marg{data specifications} + \item |data group| \opt{\oarg{options}} \marg{name} |+=| \marg{data specifications} + \item |data group| \opt{\oarg{options}} \marg{name} + \end{itemize} + In the first case, a new data group called \meta{name} is created (an + existing data group of the same name will be erased) and the following + \meta{data specifications} is stored in this data group. The data group + will not be fed to the rendering pipeline, but it is parsed at this + point as if it were. The defined data group is defined globally, so + you can used it in subsequent visualizations. The \meta{options} are + saved with the parsed \meta{data specifications}. + + In the second case, an already existing data group is extended by + adding the \meta{data specifications} to it. + + In the third case (detected by noting that the \meta{name} is + neither followed by an equal sign nor a plus sign), the contents of + the previously defined data group \meta{name} is inserted. The + \meta{options} are also executed. + + Let is now first create a data group. Note that nothing is drawn since + the ``dummy'' data visualization is empty and used only for the + definition of the data group. +\begin{codeexample}[] +\tikz \datavisualization data group {points} = { + data { + x, y + 0, 1 + 1, 2 + 2, 2 + 5, 1 + 2, 0 + 1, 1 + } +}; +\end{codeexample} + + We can now use this data in different plots: +\begin{codeexample}[] +\tikz \datavisualization [school book axes, visualize as line] data group {points}; +\qquad +\tikz \datavisualization [scientific axes=clean, visualize as line] data group {points}; +\end{codeexample} +\end{datavisualizationoperation} + \begin{datavisualizationoperation}{scope}{\opt{\oarg{options}}\marg{data specification}} @@ -501,14 +580,14 @@ visualizations. \datavisualization... scope [/data point/experiment=7] { - data [source=experiment007-part1.csv] - data [source=experiment007-part2.csv] - data [source=experiment007-part3.csv] + data [read from file=experiment007-part1.csv] + data [read from file=experiment007-part2.csv] + data [read from file=experiment007-part3.csv] } scope [/data point/experiment=23, format=foo] { - data [source=experiment023-part1.foo] - data [source=experiment023-part2.foo] + data [read from file=experiment023-part1.foo] + data [read from file=experiment023-part2.foo] }; \end{codeexample} \end{datavisualizationoperation} @@ -535,7 +614,7 @@ visualizations. func y = sin(\value x r); } info { - \draw [red] (visualization cs: x={(.5*pi)}, y=1) circle (1pt) + \draw [red] (visualization cs: x={(.5*pi)}, y=1) circle [radius=1pt] node [above,font=\footnotesize] {extremal point}; }; \end{tikzpicture} @@ -556,14 +635,40 @@ visualizations. \end{coordinatesystem} \end{datavisualizationoperation} -In order to put information \emph{behind} the data visualization, -you should usually use the |background| library and the background -layer. However, it is also possible to execute code at other points -during the data visualization process. Since this is potentially -more disruptive, special keys documented in -Section~\ref{section-dv-user-code} must be used. +\begin{datavisualizationoperation}{info'}{\opt{\oarg{options}}\marg{code}} + This command works like |info|, only the \meta{code} will be + executed just before the visualization is done. This allows you to + draw things \emph{behind} the visualization. + +\begin{codeexample}[] +\begin{tikzpicture}[baseline] + \datavisualization [ school book axes, visualize as line ] + data [format=function] { + var x : interval [-0.1*pi:2]; + func y = sin(\value x r); + } + info' { + \fill [red] (visualization cs: x={(.5*pi)}, y=1) circle [radius=2mm]; + }; +\end{tikzpicture} +\end{codeexample} +\end{datavisualizationoperation} + +\label{section-dv-bounding-box} +\begin{predefinednode}{data visualization bounding box} + This rectangle node stores a bounding box of the data visualization + that is currently being constructed. This node can be useful inside + |info| commands or when labels need to be added. +\end{predefinednode} +\begin{predefinednode}{data bounding box} + This rectangle node is similar to |data visualization bounding box|, + but it keeps track only of the actual data. The spaces needed for + grid lines, ticks, axis labels, tick labels, and other all other + information that is not part of the actual data is not part of this + box. +\end{predefinednode} \subsection{Advanced: Executing User Code During a Data Visualization} \label{section-dv-user-code} @@ -606,7 +711,7 @@ pipeline as you would normally do. In the following it is assumed that you are familiar with the concepts of Section~\ref{section-dv-backend}. \begin{key}{/tikz/data visualization/new object=\meta{options}} - This key servers two purposes: + This key serves two purposes: \begin{enumerate} \item This method makes it easy to create a new object as part of the |