summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-dv-axes.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-dv-axes.tex')
-rw-r--r--Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-dv-axes.tex287
1 files changed, 196 insertions, 91 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-dv-axes.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-dv-axes.tex
index a0e46cbaf9b..0d8314079a3 100644
--- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-dv-axes.tex
+++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-dv-axes.tex
@@ -179,7 +179,7 @@ axis):
Here is a real-life example. The |scientific axes| create two axes, called
|x axis| and |y axis|, respectively.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization [scientific axes,
x axis={attribute=people, length=2.5cm, ticks=few},
y axis={attribute=year},
@@ -228,7 +228,7 @@ interval:
contain |0| -- even if the actual data points are all positive or all
negative.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [scientific axes, all axes={length=3cm},
visualize as line]
data [format=function] {
@@ -237,7 +237,7 @@ interval:
};
\end{codeexample}
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [scientific axes, all axes={length=3cm},
visualize as line,
x axis={include value=20},
@@ -288,7 +288,7 @@ next key is used to specify what should happen with the observed values.
in order to map dates between 1900 and 2000 to the dimension interval
$[0\mathrm{cm},5\mathrm{cm}]$.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization
[scientific axes,
x axis={attribute=people, length=2.5cm, ticks=few},
@@ -417,7 +417,7 @@ some axis={function=\pgfdvmathln{\pgfvalue}{\pgfvalue}}
%
This specifies that the function $f$ is the logarithm function.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization
[scientific axes,
x axis={ticks={major={at={1,10,100,1000}}},
@@ -431,7 +431,7 @@ some axis={function=\pgfdvmathln{\pgfvalue}{\pgfvalue}}
%
Another possibility might be to use the square-root function, instead:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization
[scientific axes,
x axis={ticks=few,
@@ -486,7 +486,10 @@ documented in the following.
All told, to turn an axis into a logarithmic axis, you just need to add
this option to the axis.
%
-\begin{codeexample}[width=8cm]
+\begin{codeexample}[
+ width=8cm,
+ preamble={\usetikzlibrary{datavisualization.formats.functions}},
+]
\tikz \datavisualization [scientific axes,
x axis={logarithmic},
y axis={logarithmic},
@@ -500,7 +503,7 @@ documented in the following.
Note that this will work with any axis, including, say, the degrees on a
polar axis:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.polar}}]
\tikz \datavisualization
[new polar axes,
angle axis={logarithmic, scaling=1 at 0 and 90 at 90},
@@ -511,7 +514,7 @@ documented in the following.
};
\end{codeexample}
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.polar}}]
\tikz \datavisualization
[new polar axes,
angle axis={degrees},
@@ -532,7 +535,7 @@ documented in the following.
that the range of all values of the axis's attribute will be mapped to an
interval of exact length \meta{dimension}.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization [scientific axes,
x axis={length=3cm},
y axis={length=2cm},
@@ -547,7 +550,7 @@ documented in the following.
};
\end{codeexample}
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization [scientific axes,
x axis={length=3cm},
y axis={length=4cm},
@@ -570,7 +573,7 @@ documented in the following.
is particularly useful when you wish to ensure that the same scaling is
used across multiple axes or pictures.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization [scientific axes,
all axes={ticks=few, unit length=1mm},
visualize as line]
@@ -582,6 +585,7 @@ documented in the following.
13, 20
};
\end{codeexample}
+ %
The optional |per |\meta{number}| units| allows you to apply more drastic
scaling. Suppose that you want to plot a graph where one billion
corresponds to one centimeter. Then the unit length would be need to be set
@@ -589,7 +593,7 @@ documented in the following.
dimension. In this case, you can write
|unit length=1cm per 1000000000 units|:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization
[scientific axes,
x axis={unit length=1mm per 1000000000 units, ticks=few},
@@ -612,7 +616,7 @@ documented in the following.
to get a length of \meta{dimension}. Again, this key is useful for ensuring
that the same scaling is used across multiple axes or pictures.
%
-\begin{codeexample}[width=8cm]
+\begin{codeexample}[width=8cm,preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization
[scientific axes,
y axis={logarithmic, power unit length=1mm, grid},
@@ -648,7 +652,7 @@ set the attribute using the following key:
say |node style| to configure the styling of a node, see
Section~\ref{section-dv-style}.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [
scientific axes,
x axis = {label, length=2.5cm},
@@ -704,7 +708,7 @@ of an axis system, see Section~\ref{section-dv-axis-systems}.
point that is at distance |1pt| from the origin and that points into
the direction of the axis.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\begin{tikzpicture}
\draw [help lines] (0,0) grid (3,2);
@@ -792,7 +796,7 @@ x axes={time $t$ (ms)}, y axis={distance $d$ (mm)}
Here is an example that employs most of the above features:
%
-\begin{codeexample}[width=8.5cm]
+\begin{codeexample}[width=8.5cm,preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization [
scientific axes=clean,
x axis={attribute=time, ticks={tick unit=ms},
@@ -820,7 +824,10 @@ data {
This key installs a two-dimensional coordinate system based on the
attributes |/data point/x| and |/data point/y|.
%
-\begin{codeexample}[width=7cm]
+\begin{codeexample}[
+ width=7cm,
+ preamble={\usetikzlibrary{datavisualization.formats.functions}},
+]
\begin{tikzpicture}
\datavisualization [scientific axes,
visualize as smooth line]
@@ -850,7 +857,7 @@ data {
on the two axis. If you wish the units on both axes to be equal, consider
directly specifying the unit length ``by hand'':
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}
\datavisualization [visualize as smooth line,
scientific axes,
@@ -902,7 +909,10 @@ scientific axis system is rendered.
This causes the ticks to be drawn `` on the outside'' of the frame so that
they interfere as little as possible with the data. It is the default.
%
-\begin{codeexample}[width=7cm]
+\begin{codeexample}[
+ width=7cm,
+ preamble={\usetikzlibrary{datavisualization.formats.functions}},
+]
\begin{tikzpicture}
\datavisualization [scientific axes=outer ticks,
visualize as smooth line]
@@ -919,7 +929,10 @@ scientific axis system is rendered.
This axis system works like |scientific axes|, only the ticks are on the
``inside'' of the frame.
%
-\begin{codeexample}[width=7cm]
+\begin{codeexample}[
+ width=7cm,
+ preamble={\usetikzlibrary{datavisualization.formats.functions}},
+]
\begin{tikzpicture}
\datavisualization [scientific axes=inner ticks,
visualize as smooth line]
@@ -934,7 +947,7 @@ scientific axis system is rendered.
interfere with marks if they are near to the border as can be seen in the
following example:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\begin{tikzpicture}
\datavisualization [scientific axes={inner ticks, width=3.2cm},
style sheet=cross marks,
@@ -963,7 +976,10 @@ scientific axis system is rendered.
this axis system especially useful for scatter plots, but also for most
other scientific plots.
%
-\begin{codeexample}[width=7.5cm]
+\begin{codeexample}[
+ width=7.5cm,
+ preamble={\usetikzlibrary{datavisualization.formats.functions}},
+]
\tikz \datavisualization [
scientific axes=clean,
visualize as smooth line]
@@ -986,7 +1002,10 @@ specified. They are discussed in the following.
$y$-axis is rotated by $90^\circ$ and placed left of the center of the
$y$-axis.
%
-\begin{codeexample}[width=8cm]
+\begin{codeexample}[
+ width=8cm,
+ preamble={\usetikzlibrary{datavisualization.formats.functions}},
+]
\tikz \datavisualization
[scientific axes={clean, standard labels},
visualize as smooth line,
@@ -1005,7 +1024,10 @@ data [format=function] {
Works like |scientific axes standard labels|, only the label of the
$y$-axis is not rotated.
%
-\begin{codeexample}[width=8cm]
+\begin{codeexample}[
+ width=8cm,
+ preamble={\usetikzlibrary{datavisualization.formats.functions}},
+]
\tikz \datavisualization [
scientific axes={clean, upright labels},
visualize as smooth line,
@@ -1027,7 +1049,10 @@ data [format=function] {
Places the labels at the end of the $x$- and the $y$-axis, similar to the
axis labels of a school book axis system.
%
-\begin{codeexample}[width=8cm]
+\begin{codeexample}[
+ width=8cm,
+ preamble={\usetikzlibrary{datavisualization.formats.functions}},
+]
\tikz \datavisualization [
scientific axes={clean, end labels},
visualize as smooth line,
@@ -1059,7 +1084,7 @@ data [format=function] {
Finally, if the data is ``far removed'' from the origin, this axis system
will also ``look bad''.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}
\datavisualization [school book axes, visualize as smooth line]
data [format=function] {
@@ -1080,7 +1105,7 @@ data [format=function] {
the same time, the stepping of the ticks will also be set to
\meta{value}.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}
\datavisualization [school book axes={unit=10},
visualize as smooth line,
@@ -1103,7 +1128,7 @@ data [format=function] {
Currently, this is the only supported placement strategy for the school
book axis system.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}
\datavisualization [school book axes={standard labels},
visualize as smooth line,
@@ -1135,7 +1160,7 @@ grid lines are drawn, and labels are placed at the correct positions.
This axis system creates two axes called |x axis| and |y axis| that point
right and up, respectively. By default, one unit is mapped to one cm.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}
\datavisualization [xy Cartesian, visualize as smooth line]
data [format=function] {
@@ -1251,7 +1276,7 @@ shown are explained.
|/tikz/data visualization/|. When the |ticks| key is used multiple times
for an axis, the \meta{options} accumulate.
%
-\begin{codeexample}[width=6cm]
+\begin{codeexample}[width=6cm,preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization [
scientific axes, visualize as line,
x axis={ticks={step=24, minor steps between steps=3},
@@ -1292,7 +1317,7 @@ shown are explained.
|grid| key. This is useful when you want to specify some special points
explicitly where you wish a tick to be shown and also a grid line.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[scientific axes,
visualize as smooth line,
@@ -1340,7 +1365,7 @@ like |step| or |about|.
Here is an example of the different stepping chosen when one varies the tick
placement strategy:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}
\datavisualization [scientific axes, visualize as smooth line]
data [format=function] {
@@ -1380,7 +1405,7 @@ only. So, you would write things like |x axis={ticks={step=2}}|, but
Basically, all ticks are placed at all multiples of \meta{value} that lie
in the attribute range interval.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [
school book axes, visualize as smooth line,
y axis={ticks={step=1.25}},
@@ -1400,7 +1425,7 @@ only. So, you would write things like |x axis={ticks={step=2}}|, but
between two minor steps is exactly a tenth of the size of a major step. See
also Section~\ref{section-dv-strategies} for further details.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}
\datavisualization [school book axes, visualize as smooth line,
x axis={ticks={minor steps between steps=3}},
@@ -1666,7 +1691,7 @@ Four keys are used to configure the different kinds:
option) and also any special styling. The different possible options are
described later in this section.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[ school book axes, visualize as smooth line,
x axis={ticks={major={at={1, 1.5, 2}}}}]
@@ -1681,7 +1706,7 @@ Four keys are used to configure the different kinds:
\begin{key}{/tikz/data visualization/minor=\meta{options}}
Like |major|, only for minor ticks/grid lines.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[ school book axes, visualize as smooth line,
x axis={grid={minor={at={1, 1.5, 2}}}}]
@@ -1704,7 +1729,7 @@ Four keys are used to configure the different kinds:
tick at the same position), but it can be useful to configure, say, the
size of all kinds of ticks:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[ school book axes, visualize as smooth line,
x axis={ticks={minor steps between steps, common={low=0}}} ]
@@ -1728,7 +1753,7 @@ keys to specify where ticks or grid lines should be shown:
ticks or grid lines on the axis will be placed exactly at the values in
\meta{list}. Here is an example:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[ school book axes, visualize as smooth line,
x axis={ticks={major={at={-1,0.5,(pi/2)}}}}]
@@ -1778,7 +1803,7 @@ some axis = {ticks = {major = {at = {...}}}}
accumulate. However, when |at| is used after an |also at| key, the |at| key
completely resets the positions where ticks or grid lines are shown.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[ school book axes, visualize as smooth line,
x axis={grid, ticks and grid={major={also at={0.5}}}}]
@@ -1850,7 +1875,7 @@ Two keys are used to ``communicate'' with the \tikzname\ layer:
executed whenever the data visualization engine calls the \tikzname\ layer
to draw something (this placed will be indicated in the following).
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[scientific axes,
all axes={ticks={style=blue}, length=3cm},
@@ -1878,11 +1903,11 @@ Similar to |style| (and |styling|) there also exist the |node style| (and
in addition to the usual |style|.
\begin{key}{/tikz/data visualization/node style=\meta{\tikzname\ options}}
- This key works like |style|, only it has an effect only on nodes that are
+ This key works like |style|, but it has an effect only on nodes that are
created during a data visualization. This includes tick labels and axis
labels:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[scientific axes,
all axes={ticks={node style=red}, length=3cm},
@@ -1936,7 +1961,7 @@ Let us now have a look at these keys in detail:
obscuring the more important data with the far less important grid lines.
However, you can change this style to ``get the grid lines to the front'':
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[scientific axes,
all axes={
@@ -1969,11 +1994,12 @@ low=min, high=max
visualized, which is usually the desired behaviour (the |low| and |high|
keys are explained in Section~\ref{section-dv-visualize-ticks}. You can
append the |style| key to this style to configure the overall appearance of
- grid lines. In the following example we cause all grid lines to be dashed
- (which is not a good idea in general since it creates a distracting
- background pattern).
+ grid lines. It should be noted that settings to |style| inside |every grid|
+ will take precedence over ones in |every major grid| and |every minor grid|.
+ In the following example we cause all grid lines to be dashed (which is not
+ a good idea in general since it creates a distracting background pattern).
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[scientific axes,
all axes={length=3cm, grid},
@@ -1998,7 +2024,7 @@ style = {help lines, thin, black!25}
%
In the following example, we use thin major blue grid lines:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[scientific axes,
all axes={
@@ -2150,7 +2176,10 @@ may be helpful:
This key causes the \meta{options} to be executed for any tick mark(s) at
\meta{value} in addition to any options given already for this position:
%
-\begin{codeexample}[width=7cm]
+\begin{codeexample}[
+ width=7cm,
+ preamble={\usetikzlibrary{datavisualization.formats.functions}},
+]
\tikz \datavisualization [
scientific axes,
visualize as smooth line,
@@ -2202,7 +2231,7 @@ same happens as in the second case, but the text that is shown as tick label is
\meta{text} rather than the automatically generated tick label. This automatic
generation of tick labels is explained in the following.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[scientific axes=clean,
x axis={length=2.5cm, ticks={major at={
@@ -2246,7 +2275,7 @@ Let us have a look at these keys in detail:
\begin{key}{/tikz/data visualization/tick prefix=\meta{text} (initially \normalfont empty)}
The \meta{text} will be put in front of every typeset tick:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[scientific axes, all axes={ticks=few, length=2.5cm},
x axis={ticks={tick prefix=$\langle$, tick suffix=$]$}},
@@ -2267,7 +2296,7 @@ Let us have a look at these keys in detail:
\begin{key}{/tikz/data visualization/tick unit=\meta{roman math text}}
A shorthand for |tick suffix={$\,\rm|\meta{roman math text}|$}|:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization
[scientific axes, all axes={length=3cm},
x axis={ticks={tick unit=s}},
@@ -2292,7 +2321,7 @@ Let us have a look at these keys in detail:
mechanism is used. Here is a (not quite finished) example that shows how,
say, numbers could be printed in terms of multiples of $\pi$:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\def\mytypesetter#1{%
\pgfmathparse{#1/pi}%
\pgfmathprintnumber{\pgfmathresult}$\pi$%
@@ -2317,7 +2346,7 @@ Let us have a look at these keys in detail:
Sometimes, the text of tick labels are so long or so numerous that the text of
adjacent tick labels overlap (or have too little padding):
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [scientific axes,
all axes={length=2.5cm},
visualize as smooth line]
@@ -2332,7 +2361,7 @@ There are two ways to address this problem:
\begin{itemize}
\item One can rotate the labels on horizontal axes:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [scientific axes,
all axes={length=2.5cm},
x axis={ticks={node style={rotate=90, anchor=east}}},
@@ -2348,7 +2377,7 @@ There are two ways to address this problem:
\item One can specify different shifts of the nodes for the different
ticks, whereby the ticks text no longer overlap.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [scientific axes,
all axes={length=2.5cm},
x axis={ticks={major at={0,4000,8000,
@@ -2367,7 +2396,7 @@ There are two ways to address this problem:
automatically. Instead, the |stack| option can be used, which is much
easier to use and gives better results:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [scientific axes,
all axes={length=2.5cm}, x axis={ticks=stack},
visualize as smooth line]
@@ -2414,7 +2443,7 @@ ticks={major at={1,2,3,4}, major at={0,-1,-2}, minor at={9,8,7}}
\meta{distance} is added to the |low| value, see also
Section~\ref{section-dv-visualize-ticks}.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [scientific axes,
all axes={length=2.5cm},
x axis={ticks={tick text low even padding=-1em}},
@@ -2456,7 +2485,7 @@ The following keys work similarly:
\begin{key}{/tikz/data visualization/stack=\meta{dimension} (default 1em)}
Shorthand for |tick text even padding=|\meta{dimension}.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [scientific axes,
all axes={length=2.5cm},
x axis={ticks={stack=1.5em}},
@@ -2473,7 +2502,8 @@ The following keys work similarly:
Shorthand for |tick text odd padding=|\meta{dimension}. The difference to
|stack| is that the set of value that are ``lowered'' is exactly exchanged
with the set of value ``lowered'' by |stack|.
-\begin{codeexample}[]
+ %
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [scientific axes,
all axes={length=2.5cm},
x axis={ticks=stack'},
@@ -2490,7 +2520,10 @@ Note that the above keys have an effect on all tick labels of an axis, also on
special ticks that you may have added using the |also at| key. When using the
|stack| key, you should specify a |tick text padding| explicitly for such keys:
%
-\begin{codeexample}[width=7cm]
+\begin{codeexample}[
+ width=7cm,
+ preamble={\usetikzlibrary{datavisualization.formats.functions}},
+]
\tikz \datavisualization
[scientific axes,
x axis={ticks={stack, many, major also at=
@@ -2527,7 +2560,7 @@ special ticks that you may have added using the |also at| key. When using the
partition the interval between two mayor ticks into ten equally sized minor
intervals.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\begin{tikzpicture}
\datavisualization
[scientific axes={inner ticks, width=3cm},
@@ -2558,7 +2591,7 @@ special ticks that you may have added using the |also at| key. When using the
The minor steps are added in the same way as for |linear steps|. In
particular, they interpolate \emph{linearly} between mayor steps.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\begin{tikzpicture}
\datavisualization
[scientific axes,
@@ -2607,7 +2640,7 @@ special ticks that you may have added using the |also at| key. When using the
allows you to access the minimum and the maximum value stored in the
|scaling mapper| of that axis.
%
-\begin{codeexample}[width=7cm]
+\begin{codeexample}[width=7cm,preamble={\usetikzlibrary{datavisualization}}]
\def\silly{
\tikzdatavisualizationset{major={at={
2,3,5,7,11,13}}}
@@ -2630,7 +2663,7 @@ special ticks that you may have added using the |also at| key. When using the
\subsection{Advanced: Creating New Axis Systems}
-The data visualization library comes with a number of predefined axis systems,
+The |datavisualization| library comes with a number of predefined axis systems,
like |scientific axes=clean|, but it is also possible and to define new axis
systems. Doing so involves the following steps:
%
@@ -2709,7 +2742,7 @@ We now already have enough to try our system, although we will not yet see any
axes or ticks, but we will see the correct scaling of the attributes. Let us
first define a data group:
%
-\begin{codeexample}[]
+\begin{codeexample}[setup code]
\tikz \datavisualization data group {people and money} = {
data [set=people 1] {
time, people
@@ -2742,6 +2775,7 @@ first define a data group:
};
\end{codeexample}
+\begin{codeexample}[setup code,hidden]
\tikzdatavisualizationset{
our system/.style={
new Cartesian axis=x axis,
@@ -2755,7 +2789,9 @@ first define a data group:
right axis={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/height}}
}
}
-\begin{codeexample}[]
+\end{codeexample}
+%
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization [
our system,
x axis={attribute=time, length=4cm},
@@ -2809,7 +2845,7 @@ left axis={ visualize axis={ x axis={ goto=min } }
attribute has attained along this axis.
\item |max|: Like |min|.
\item |padded min|: This will also set the \meta{attribute}
- monitored by the axis to the same value as |min|.
+ monitored by the axis to the same value as |min|.
Additionally, however, the subkey
|/data point/|\meta{attribute}|/offset| is set to the current
padding for the minimum, see the description of |padding min|
@@ -2821,10 +2857,10 @@ left axis={ visualize axis={ x axis={ goto=min } }
\end{key}
The |right axis| would be visualized the same way, only at |goto=max|. The
- $x$-axis actually need to be visualized \emph{twice}: Once at the bottom
+ $x$-axis actually needs to be visualized \emph{twice}: Once at the bottom
and once at the top. Thus, we need to call |visualize axis| twice for this
axis:
-%
+ %
\tikzdatavisualizationset{
our system/.style={
new Cartesian axis=x axis,
@@ -2838,7 +2874,21 @@ left axis={ visualize axis={ x axis={ goto=min } }
right axis={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/height}}
}
}
-\begin{codeexample}[]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{datavisualization}},
+ pre={\tikzdatavisualizationset{
+ our system/.style={
+ new Cartesian axis=x axis,
+ new Cartesian axis=left axis,
+ new Cartesian axis=right axis,
+ x axis={attribute=x},
+ left axis={unit vector={(0cm,1pt)}},
+ right axis={unit vector={(0cm,1pt)}},
+ x axis ={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/width}},
+ left axis ={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/height}},
+ right axis={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/height}}
+ }
+}}]
\tikzset{
data visualization/our system/.append style={
left axis= {visualize axis={x axis= {goto=min}}},
@@ -2878,7 +2928,21 @@ left axis={ visualize axis={ x axis={ goto=min } }
corresponding to the fractional positions in the reasonable interval
are not computed.
%
-\begin{codeexample}[]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{datavisualization}},
+ pre={\tikzdatavisualizationset{
+ our system/.style={
+ new Cartesian axis=x axis,
+ new Cartesian axis=left axis,
+ new Cartesian axis=right axis,
+ x axis={attribute=x},
+ left axis={unit vector={(0cm,1pt)}},
+ right axis={unit vector={(0cm,1pt)}},
+ x axis ={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/width}},
+ left axis ={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/height}},
+ right axis={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/height}}
+ }
+}}]
\tikzset{
data visualization/our system/.append style={
x axis= {visualize axis={left axis={goto pos=0.25}},
@@ -2963,9 +3027,24 @@ left axis={ visualize axis={ x axis={ goto=min } }
Recall that the |styling| key is set using the |style| key, see
Section~\ref{section-dv-style}.
%
+% TODOsp: codeexamples: What is this empty `\tikzset` good for?
\tikzset{
}
-\begin{codeexample}[]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{datavisualization}},
+ pre={\tikzdatavisualizationset{
+ our system/.style={
+ new Cartesian axis=x axis,
+ new Cartesian axis=left axis,
+ new Cartesian axis=right axis,
+ x axis={attribute=x},
+ left axis={unit vector={(0cm,1pt)}},
+ right axis={unit vector={(0cm,1pt)}},
+ x axis ={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/width}},
+ left axis ={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/height}},
+ right axis={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/height}}
+ }
+}}]
\tikzset{
data visualization/our system/.append style={
every axis/.style={style=black!50}, % make this the default
@@ -3013,7 +3092,10 @@ left axis={ visualize axis={ x axis={ goto=min } }
(because it starts at a smaller value). The standard axis systems set
the padding to some default and take its value into account:
%
-\begin{codeexample}[width=8cm]
+\begin{codeexample}[
+ width=8cm,
+ preamble={\usetikzlibrary{datavisualization.formats.functions}},
+]
\begin{tikzpicture}
\datavisualization [scientific axes=clean,
x axis={padding min=-1cm},
@@ -3028,7 +3110,30 @@ left axis={ visualize axis={ x axis={ goto=min } }
Using padded and using the |padded| key, we can visualize our axis ``a
little removed from the actual data'':
%
-\begin{codeexample}[]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{datavisualization}},
+ pre={\tikzdatavisualizationset{
+ our system/.style={
+ new Cartesian axis=x axis,
+ new Cartesian axis=left axis,
+ new Cartesian axis=right axis,
+ x axis={attribute=x},
+ left axis={unit vector={(0cm,1pt)}},
+ right axis={unit vector={(0cm,1pt)}},
+ x axis ={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/width}},
+ left axis ={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/height}},
+ right axis={length=\pgfkeysvalueof{/tikz/data visualization/scientific axes/height}}
+ }
+}%
+\tikzset{
+ data visualization/our system/.append style={
+ every axis/.style={style=black!50}, % make this the default
+ left axis= {visualize axis={x axis= {goto=min}, style=red!75}},
+ right axis={visualize axis={x axis= {goto=max}, style=blue!75}},
+ x axis= {visualize axis={left axis={goto=min}},
+ visualize axis={left axis={goto=max}}},
+ }
+}}]
\tikzset{
data visualization/our system/.append style={
all axes= {padding=.5em},
@@ -3128,7 +3233,7 @@ axis system to specify how grid lines are drawn.
The |low| and |high| keys are the same as the ones used in the
|visualize axis| key.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization [
xyz Cartesian cabinet,
all axes={visualize axis={low=0, style=->}},
@@ -3142,7 +3247,7 @@ axis system to specify how grid lines are drawn.
};
\end{codeexample}
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization [
xyz Cartesian cabinet,
all axes={visualize axis={low=0, style=->}, grid=many},
@@ -3183,7 +3288,7 @@ axis system to specify how grid lines are drawn.
lines -- are rather unlikely setting -- or when the styling should deviate
from the usual settings.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization [
xy Cartesian,
all axes={visualize axis={low=0, style=->},
@@ -3207,7 +3312,7 @@ axis is either of the other two axis (they point in the same direction and they
have the same range). For the other two axes, we visualize one grid
independently of the other, using different colors.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikzset{
data visualization/our system/.append style={
x axis= {visualize grid={direction axis=left axis}},
@@ -3242,7 +3347,7 @@ independently of the other, using different colors.
at different places for the same axis. Consider for instance the
|scientific axes|:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [scientific axes, all axes={length=3cm},
x axis={ticks={stack}},
visualize as smooth line]
@@ -3282,7 +3387,7 @@ independently of the other, using different colors.
bottom and at the top. This corresponds to once setting the
|left axis| to its minimal value and once to its maximal value:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikzset{
data visualization/our system/.append style={
x axis={visualize ticks={direction axis=left axis, left axis={goto=min}},
@@ -3335,7 +3440,7 @@ independently of the other, using different colors.
ticks the |low| value is |0pt|, while in the lower one the |high|
value is |0pt|:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikzset{
data visualization/our system/.append style={
x axis={
@@ -3375,7 +3480,7 @@ independently of the other, using different colors.
Pass this option to |visualize ticks| when you want tick label nodes to
be placed at the |low| position of each tick mark.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikzset{
data visualization/our system/.append style={
x axis={
@@ -3403,7 +3508,7 @@ independently of the other, using different colors.
\begin{key}{/tikz/data visualization/no tick text}
Shorthand for |tick text at low=false, tick text at high=false|.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz \datavisualization [scientific axes, all axes={length=3cm},
x axis={ticks={
major also at={6.5 as [no tick text]}}},
@@ -3457,7 +3562,7 @@ of the |visualize label| key, which is configured by the axis system.
determine this position. Concerning the other axes, we want it to be placed
at the minimum position of the |left axis| with a lot of padding.
%
-\begin{codeexample}[width=7cm]
+\begin{codeexample}[width=7cm,preamble={\usetikzlibrary{datavisualization}}]
\tikzdatavisualizationset{
our system/.append style={
x axis={visualize label={
@@ -3487,7 +3592,7 @@ of the |visualize label| key, which is configured by the axis system.
be at the ``origin'', which is, however, the position computed by the
|goto| keys for the axes:
%
-\begin{codeexample}[width=7cm]
+\begin{codeexample}[width=7cm,preamble={\usetikzlibrary{datavisualization}}]
\tikzdatavisualizationset{
our system/.append style={
x axis={visualize label={
@@ -3572,7 +3677,9 @@ how it is used:
}}
\end{codeexample}
-\tikzdatavisualizationset{
+\begin{codeexample}[
+ preamble={\usetikzlibrary{datavisualization}},
+ pre={\tikzdatavisualizationset{
our system/.style={
% The axes
new Cartesian axis=x axis,
@@ -3620,9 +3727,7 @@ how it is used:
right axis={goto pos=.5}, node style={
at={(0,0 -| data visualization bounding box.east)}, rotate=-90, anchor=south, blue!80!black}}},
}
-}
-
-\begin{codeexample}[]
+}}]
\tikz \datavisualization [
our system,
x axis={attribute=time, label=Year,