Skip to content

Commit

Permalink
- continued(/finished) moving setup code,hidden to preamble of th…
Browse files Browse the repository at this point in the history
…e `codeexample`s

- minor stuff
  • Loading branch information
Mo-Gul authored and hmenke committed Aug 27, 2019
1 parent fcb9544 commit 66badb1
Show file tree
Hide file tree
Showing 52 changed files with 3,228 additions and 1,384 deletions.
2 changes: 1 addition & 1 deletion doc/generic/pgf/text-en/pgfmanual-en-base-quick.tex
Expand Up @@ -102,7 +102,7 @@ \subsection{Quick Path Construction Commands}
Adds a radius around the origin of the given \meta{radius}. This command is
orders of magnitude faster than |\pgfcircle{\pgfpointorigin}{|\meta{radius}|}|.
%
\begin{codeexample}[]
\begin{codeexample}[pre={\colorlet{examplefill}{yellow!80!black}}]
\begin{tikzpicture}
\draw[help lines] (0,0) grid (1,1);
\pgfpathqcircle{10pt}
Expand Down
28 changes: 16 additions & 12 deletions doc/generic/pgf/text-en/pgfmanual-en-base-transformations.tex
Expand Up @@ -1119,9 +1119,10 @@ \subsubsection{Nonlinear Transformation Libraries}
|\pgftransformnonlinear| for details.
%
\makeatletter
\begin{codeexample}[preamble={\usepgfmodule{nonlineartransformations}
\usetikzlibrary{curvilinear}
\makeatletter}]
\begin{codeexample}[
preamble={\usepgfmodule{nonlineartransformations}
\usetikzlibrary{curvilinear}},
pre=\makeatletter]
\begin{tikzpicture}
\draw [help lines] (0,0) grid (3,2);
{
Expand All @@ -1138,9 +1139,10 @@ \subsubsection{Nonlinear Transformation Libraries}
\end{tikzpicture}
\end{codeexample}

\begin{codeexample}[preamble={\usepgfmodule{nonlineartransformations}
\usetikzlibrary{curvilinear}
\makeatletter}]
\begin{codeexample}[
preamble={\usepgfmodule{nonlineartransformations}
\usetikzlibrary{curvilinear}},
pre=\makeatletter]
\begin{tikzpicture}
\draw [help lines] (0,0) grid (3,2);
{
Expand Down Expand Up @@ -1177,9 +1179,10 @@ \subsubsection{Nonlinear Transformation Libraries}
lines.
%
\makeatletter
\begin{codeexample}[preamble={\usepgfmodule{nonlineartransformations}
\usetikzlibrary{curvilinear}
\makeatletter}]
\begin{codeexample}[
preamble={\usepgfmodule{nonlineartransformations}
\usetikzlibrary{curvilinear}},
pre=\makeatletter]
\begin{tikzpicture}
\draw [help lines] (0,0) grid (3,2);
{
Expand All @@ -1198,9 +1201,10 @@ \subsubsection{Nonlinear Transformation Libraries}
\end{tikzpicture}
\end{codeexample}

\begin{codeexample}[preamble={\usepgfmodule{nonlineartransformations}
\usetikzlibrary{curvilinear}
\makeatletter}]
\begin{codeexample}[
preamble={\usepgfmodule{nonlineartransformations}
\usetikzlibrary{curvilinear}},
pre=\makeatletter]
\begin{tikzpicture}
\draw [help lines] (0,0) grid (3,2);
{
Expand Down
7 changes: 5 additions & 2 deletions doc/generic/pgf/text-en/pgfmanual-en-dv-axes.tex
Expand Up @@ -503,7 +503,7 @@ \subsubsection{Scaling: Logarithmic Axes}
Note that this will work with any axis, including, say, the degrees on a
polar axis:
%
\begin{codeexample}[preamble=\usetikzlibrary{datavisualization.polar}}]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.polar}}]
\tikz \datavisualization
[new polar axes,
angle axis={logarithmic, scaling=1 at 0 and 90 at 90},
Expand Down Expand Up @@ -1002,7 +1002,10 @@ \subsubsection{Reference: Scientific Axis Systems}
$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,
Expand Down
29 changes: 17 additions & 12 deletions doc/generic/pgf/text-en/pgfmanual-en-dv-formats.tex
Expand Up @@ -18,10 +18,6 @@ \subsection{Overview}
command, but usually data is available in some special (text) format and one
would like to visualize this data. The present section explains how data in
some specific format can be fed to the data visualization system.
%
\begin{codeexample}[setup code,hidden]
\usetikzlibrary{datavisualization.formats.functions}
\end{codeexample}

This section starts with an explanation of the main concepts. Then, the
standard formats are listed in the reference section. It is also possible to
Expand Down Expand Up @@ -124,7 +120,7 @@ \subsection{Reference: Build-In Formats}
that you must surround a comma by curly braces if you which to (re)set
the separator character to a space.
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\begin{tikzpicture}
\datavisualization [school book axes, visualize as line]
data [separator=\space] {
Expand All @@ -148,7 +144,7 @@ \subsection{Reference: Build-In Formats}
is used as the headline and the first line of the data is treated as a
normal line rather than as a headline.
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\begin{tikzpicture}
\datavisualization [school book axes, visualize as line]
data [headline={x, y}] {
Expand All @@ -168,7 +164,7 @@ \subsection{Reference: Build-In Formats}
attribute |/data point/x| to be set to |5| and |/data point/lo| to be set
to |500|.
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\begin{tikzpicture}
\datavisualization [school book axes, visualize as line]
data [format=named] {
Expand All @@ -190,7 +186,10 @@ \subsection{Reference: Build-In Formats}
attribute. In this case, a data point is created for each possible
combination of values in the different lists:
%
\begin{codeexample}[width=7cm]
\begin{codeexample}[
width=7cm,
preamble={\usetikzlibrary{datavisualization}},
]
\tikz \datavisualization
[scientific axes=clean,
visualize as scatter/.list={a,b,c},
Expand All @@ -211,7 +210,7 @@ \subsection{Reference: Build-In Formats}
may not be spread over several lines. However, not each line needs to
produce a data point.
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\begin{tikzpicture}
\datavisualization [school book axes, visualize as line]
data [format=TeX code] {
Expand Down Expand Up @@ -311,7 +310,7 @@ \subsection{Reference: Advanced Formats}
specification. In this case, all of these functions will be evaluated
for each setting of input variables.
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\tikz
\datavisualization [school book axes, visualize as smooth line]
data [format=function] {
Expand All @@ -321,7 +320,10 @@ \subsection{Reference: Advanced Formats}
};
\end{codeexample}
%
\begin{codeexample}[width=6cm]
\begin{codeexample}[
width=6cm,
preamble={\usetikzlibrary{datavisualization.formats.functions}},
]
\tikz \datavisualization [
school book axes,
all axes={unit length=5mm, ticks={step=2}},
Expand All @@ -334,7 +336,10 @@ \subsection{Reference: Advanced Formats}
};
\end{codeexample}
%
\begin{codeexample}[width=7cm]
\begin{codeexample}[
width=7cm,
preamble={\usetikzlibrary{datavisualization.formats.functions}},
]
\tikz \datavisualization [
scientific axes=clean,
y axis={ticks={style={
Expand Down
8 changes: 2 additions & 6 deletions doc/generic/pgf/text-en/pgfmanual-en-dv-introduction.tex
Expand Up @@ -117,11 +117,7 @@ \subsection{Concept: Visualization Pipeline}
|scientific axes|, which selects a certain visualization pipeline that is
appropriate for this kind of plot:
%
\begin{codeexample}[setup code]
\usetikzlibrary{datavisualization.formats.functions}
\end{codeexample}
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}[scale=.7]
\datavisualization [school book axes, visualize as smooth line]
data [format=function] {
Expand All @@ -131,7 +127,7 @@ \subsection{Concept: Visualization Pipeline}
\end{tikzpicture}
\end{codeexample}
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}[scale=.7]
\datavisualization [scientific axes, visualize as smooth line]
data [format=function] {
Expand Down
34 changes: 14 additions & 20 deletions doc/generic/pgf/text-en/pgfmanual-en-dv-main.tex
Expand Up @@ -26,10 +26,6 @@ \subsection{Overview}
additional, more specialized libraries need to be loaded for more advanced
features.
\end{tikzlibrary}
%
\begin{codeexample}[setup code,hidden]
\usetikzlibrary{datavisualization.formats.functions}
\end{codeexample}

In order to visualize, you basically need to do three things:
%
Expand Down Expand Up @@ -79,7 +75,7 @@ \subsection{Concept: Data Points and Data Formats}

Here are two examples, where similar data is given in different formats:
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\begin{tikzpicture}
\datavisualization [school book axes, visualize as smooth line]
data {
Expand All @@ -95,7 +91,7 @@ \subsection{Concept: Data Points and Data Formats}
\end{tikzpicture}
\end{codeexample}

\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}
\datavisualization [school book axes, visualize as smooth line]
data [format=function] {
Expand Down Expand Up @@ -177,7 +173,7 @@ \subsection{Concept: Axes, Ticks, and Grids}
Typically, you will not need to specify axes explicitly. Rather, predefined
styles take care of this for you:
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}
\datavisualization [
scientific axes,
Expand All @@ -191,7 +187,7 @@ \subsection{Concept: Axes, Ticks, and Grids}
\end{tikzpicture}
\end{codeexample}

\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}
\datavisualization [
scientific axes=clean,
Expand Down Expand Up @@ -220,7 +216,7 @@ \subsection{Concept: Visualizers}
the data points. More advanced visualizers include, say, box plot visualizers
or pie chart visualizers.
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}
\datavisualization [
scientific axes=clean,
Expand All @@ -234,7 +230,7 @@ \subsection{Concept: Visualizers}
\end{tikzpicture}
\end{codeexample}
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}
\datavisualization [
scientific axes=clean,
Expand Down Expand Up @@ -279,7 +275,7 @@ \subsection{Concept: Style Sheets and Legends}
below. Two style sheets are used so that \emph{both} the coloring and the
dashing is varied.
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}[baseline]
\datavisualization [ scientific axes=clean,
y axis=grid,
Expand Down Expand Up @@ -422,7 +418,7 @@ \subsection{Usage}
data [/data point/experiment=23, read from file=experiment023.csv];
\end{codeexample}

\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz
\datavisualization [school book axes, visualize as line]
data [/data point/x=1] {
Expand Down Expand Up @@ -479,7 +475,7 @@ \subsection{Usage}
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}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\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];
Expand All @@ -491,7 +487,7 @@ \subsection{Usage}
This key is the ``key version'' of the previous command. The difference is
that this key can be used internally inside styles.
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikzdatavisualizationset{
horizontal/.style={
data point={x=#1, y=1}, data point={x=#1, y=2}},
Expand Down Expand Up @@ -539,9 +535,7 @@ \subsection{Usage}
``dummy'' data visualization is empty and used only for the definition of
the data group.
%
% TODOsp: codeexamples: this is needed as `pre` for the following example
% (thus, `setup code` doesn't work here)
\begin{codeexample}[]
\begin{codeexample}[setup code]
\tikz \datavisualization data group {points} = {
data {
x, y
Expand All @@ -557,7 +551,7 @@ \subsection{Usage}

We can now use this data in different plots:
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization}}]
\tikz \datavisualization [school book axes, visualize as line] data group {points};
\qquad
\tikz \datavisualization [scientific axes=clean, visualize as line] data group {points};
Expand Down Expand Up @@ -599,7 +593,7 @@ \subsection{Usage}
of the data visualization. In sharp contrast, \tikzname\ code given after a
data visualization can no longer access this coordinate system.
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}[baseline]
\datavisualization [ school book axes, visualize as line ]
data [format=function] {
Expand Down Expand Up @@ -632,7 +626,7 @@ \subsection{Usage}
before the visualization is done. This allows you to draw things
\emph{behind} the visualization.
%
\begin{codeexample}[]
\begin{codeexample}[preamble={\usetikzlibrary{datavisualization.formats.functions}}]
\begin{tikzpicture}[baseline]
\datavisualization [ school book axes, visualize as line ]
data [format=function] {
Expand Down

0 comments on commit 66badb1

Please sign in to comment.