summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.tex')
-rw-r--r--Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.tex771
1 files changed, 546 insertions, 225 deletions
diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.tex
index 1db93c31c52..1af5eb8b231 100644
--- a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.tex
+++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.tex
@@ -1,4 +1,4 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%[basicstyle=\footnotesize\ttfamily]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Package pgfplots.sty documentation.
%
@@ -87,7 +87,9 @@
\section{Introduction}
\PGFPlotstable\ is a lightweight sub-package of \PGFPlots\ which employs its table input methods and the number formatting techniques to convert tab-separated tables into tabulars.
-Its input is a text file containing space separated rows, possibly starting with column names. Its output is a \LaTeX\ tabular\footnote{Please see the remarks in section~\ref{sec:pgfplotstable:context} for plain \TeX\ and Con\TeX t.} which contains selected columns of the text table, rounded to the desired precision, printed in the desired number format (fixed point, integer, scientific etc.).
+Its input is a text file containing space-separated rows, possibly starting with column names. Its output is a \LaTeX\ tabular\footnote{Please see the remarks in Section~\ref{sec:pgfplotstable:context} for plain \TeX\ and Con\TeX t.} which contains selected columns of the text table, rounded to the desired precision, printed in the desired number format (fixed point, integer, scientific etc.). The output is \LaTeX\ code, and that code is finally typeset by \LaTeX.
+
+In other words, \PGFPlotstable\ is nothing but a more-or-less smart code generator which spits out something like |\begin{tabular}....\end{tabular}|. Use it if you'd like to customize row- or column--dependent styles or if you have numerical data for which you want to have automatically formatted content.
It is used with
% NO GALLERY
@@ -115,7 +117,7 @@ It is used with
\end{enumerate}
Both ways are shown in the examples below.
- Knowledge of |pgfkeys| is useful for a deeper insight into this package, as |/.style|, |/.append style| etc. are specific to |pgfkeys|. Please refer to the \PGF\ manual,~\cite[section pgfkeys]{tikz} if you want a deeper insight into |pgfkeys|. Otherwise, simply skip over to the examples provided in this document.
+ Knowledge of |pgfkeys| is useful for a deeper insight into this package, as |/.style|, |/.append style| etc.\ are specific to |pgfkeys|. Please refer to the \PGF\ manual,~\cite[Section pgfkeys]{tikz} or the shorter introduction~\cite{keyvalintro} to learn more about |pgfkeys|. Otherwise, simply skip over to the examples provided in this document.
You will find key prefixes |/pgfplots/table/| and |/pgf/number format/|. These prefixes can be skipped if they are used in \PGFPlotstable; they belong to the ``default key path'' of |pgfkeys|.
\end{command}
@@ -142,19 +144,12 @@ level dof error1 error2 info grad(log(dof),log(error2))
\end{codeexample}
Lines starting with `|%|' or `|#|' are considered to be comment lines and are ignored.
-There is future support for a second header line which must start with `|$flags |' (the space is obligatory, even if the column separator is \emph{not} space!). Currently, such a line is ignored. It may be used to provide number formatting options like precision and number format.
+There is future support for a second header line which must start with `|$flags |' (the space is mandatory, even if the column separator is \emph{not} space!). Currently, such a line is ignored. It may be used to provide number formatting options like precision and number format.
\begin{command}{\pgfplotstabletypeset\oarg{optional arguments}\marg{file name {\normalfont or} \textbackslash macro {\normalfont or} inline table}}
Loads (or acquires) a table and typesets it using the current configuration of number formats and table options.
- In case the first argument is a file name, the table will be loaded from disk. If it is an already loaded table (see |\pgfplotstableread| or |\pgfplotstablenew|), it will be used. Otherwise, if it is inline table data, this data will be parsed just as if it would have been found in a file (see |\pgfplotstableread|).
-{
- % allow to typeset the example. I couldn't get the \catcodes
- % correctly...
- \pgfplotstableset{
- /codeexample/newline=\noexpand\\,
- row sep=\\,
- }%
+ In case the first argument is a file name, the table will be loaded from disk. If it is an already loaded table (see |\pgfplotstableread| or |\pgfplotstablenew|), it will be used. Otherwise, if it is inline table data, this data will be parsed just as if it was found in a file (see |\pgfplotstableread|).
\begin{codeexample}[]
\pgfplotstabletypeset[sci zerofill]{
a b
@@ -164,7 +159,6 @@ There is future support for a second header line which must start with `|$flags
9000 1000000
}
\end{codeexample}
-}%
\begin{codeexample}[]
@@ -210,7 +204,7 @@ There is future support for a second header line which must start with `|$flags
\end{codeexample}
\noindent All of these options are explained in all detail in the following sections.
-You may also use a similar input format as for tabular environment:
+You may also use an input format similar to the tabular environment:
\begin{codeexample}[width=8cm]
\pgfplotstabletypeset
[col sep=&,row sep=\\,sci zerofill]
@@ -234,21 +228,21 @@ Technical note: every opened file will be protocolled into your log file.
\end{command}
\begin{command}{\pgfplotstabletypesetfile\oarg{optional arguments}\marg{file name}}
- Loads the table \marg{file name} and typesets it. As of \PGFPlotstable\ 1.2, this command is an alias to |\pgfplotstabletypeset|, that means the first argument can be either a file name or an already loaded table.
+ Loads the table \meta{file name} and typesets it. As of \PGFPlotstable\ 1.2, this command is an alias to |\pgfplotstabletypeset|, that means the first argument can be either a file name or an already loaded table.
\end{command}
\begin{commandlist}{%
\pgfplotstableread\marg{file name}\marg{\textbackslash macro},
\pgfplotstableread\marg{inline table}\marg{\textbackslash macro}}
- Loads a table into the \TeX-macro \meta{\textbackslash macro}. This macro will store the table as internal structure and can be used several times.
+ Loads a table into the \TeX-macro \meta{\textbackslash macro}. This macro will store the table as internal structure and can be used multiple times.
\begin{codeexample}[]
\pgfplotstableread{pgfplotstable.example1.dat}\loadedtable
\pgfplotstabletypeset[columns={dof,error1}]\loadedtable
\hspace{2cm}
\pgfplotstabletypeset[columns={dof,error2}]\loadedtable
\end{codeexample}
- The first argument can be either a \meta{file name} as in the example here. It is also possible to provide the table data directly:
+ The first argument can be a \meta{file name} as in the example here. It is also possible to provide the table data directly:
\begin{codeexample}[code only]
% Alternative: inline table data:
\pgfplotstableread{
@@ -271,19 +265,19 @@ level dof error1 error2 info grad(log(dof),log(error2)) quot(err
\end{codeexample}
It is checked automatically whether the first argument contains inline data or a file name.
- The check whether the first argument is inline data or a file name works as follows: if |format=auto|, the first argument is considered to be a file name unless it contains the |row sep| character (see |row sep|). If |format=inline|, it is always considered to be inline data. If |format=file|, it is a file name.
+ This check whether the first argument is inline data or a file name works as follows: if |format=auto|, the first argument is considered to be a file name unless it contains the |row sep| character (see |row sep|). If |format=inline|, it is always considered to be inline data. If |format=file|, it is a file name.
\paragraph{Special cases and more details:}
\begin{itemize}
\item The inline data format is ``fragile''. If you experience problems, terminate your tables with `|\\|' combined with |row sep=\\| (the docs for |row sep| contain alternative ways and more explanation).
- \item There are variants of this command which do not really built up a struct but which report every line to a ``listener''. There is also a struct which avoids protection by \TeX\ scopes. In case you need such things, consider reading the source code comments.
+ \item There are variants of this command which do not really build up a struct, but which report every line to a ``listener''. There is also a struct which avoids protection by \TeX\ scopes. In case you need such things, consider reading the source code comments.
\item Technical note: every opened file will be protocolled into your log file.
\item Note: avoid using `|\table|' as name, it conflicts with |\begin{table}| of \LaTeX.
\end{itemize}
\end{commandlist}
\begin{key}{/pgfplots/table/col sep=\mchoice{space,tab,comma,semicolon,colon,braces,\&,ampersand} (initially space)}
- Specifies the column separation character for table reading. The initial choice, |space| means ``at least one white space''. White spaces are tab stops or spaces (newlines always delimit lines).
+ Specifies the column separation character for table reading. The initial choice, |space|, means ``at least one white space''. White spaces are tab stops or spaces (newlines characters always delimit lines).
For example, the file |pgfplotstable.example1.csv| uses commas as separation characters.
\begin{codeexample}[code only]
@@ -309,19 +303,19 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1)
Please note that if cell entries (for example column names) contain the separation character, you need to enclose the column entry in \emph{braces}: |{grad(log(dof),log(error2)}|. If you want to use unmatched braces, you need to write a backslash before the brace. For example the name `|column{withbrace|' needs to be written as `|column\{withbrace|'.
- For |col sep|$\neq$|space|, spaces will be considered to be part of the argument (there is no trimming). However, (as usual in \TeX), multiple successive spaces and tabs are summarized into white space. Of course, if |col sep=tab|, tabs are the column separators and will be treated specially.
+ For |col sep|$\neq$|space|, spaces will be considered to be part of the argument (there is no trimming). However, (as usual in \TeX), multiple successive spaces and tabs are replace by a single white space. Of course, if |col sep=tab|, tabs are the column separators and will be treated specially.
Furthermore, if you need empty cells in case |col sep=space|, you have to provide |{}| to delimit such a cell since |col sep=space| uses \emph{at least} one white space (consuming all following ones).
- The value |col sep=braces| is special since it actually uses two separation characters. Every single cell entry is delimited by an opening and a closing brace, \marg{entry}, for this choice. Furthermore, any white spaces (spaces and tabs) between cell entries are \emph{skipped} in case |braces| until the next \marg{entry} is found.
+ The value |col sep=braces| is special since it actually uses two separation characters. Every single cell entry is delimited by an opening and a closing brace, \meta{entry}, for this choice. Furthermore, any white space (spaces and tabs) between cell entries are \emph{skipped} in case |braces| until the next \meta{entry} is found.
- A further speciality of |col sep=braces| is that it has support for \emph{multi-line} cells: everything within balanced braces is considered to be part of a cell. This includes newlines\footnote{This treatment of newlines within balanced braces actually applies to every other column separator as well (it is a \TeX\ readline feature). In other words: you \emph{can} have multi line cells for every column separator if you enclose them in balanced curly braces. However, \texttt{col sep=braces} has the special treatment that end-of-line counts as white space character; for every other \texttt{col sep} value, this white space is suppressed to remove spurious spaces.}.
+ A further specialty of |col sep=braces| is that it has support for \emph{multi-line} cells: everything within balanced braces is considered to be part of a cell. This includes newlines\footnote{This treatment of newlines within balanced braces actually applies to every other column separator as well (it is a \TeX\ readline feature). In other words: you \emph{can} have multi-line cells for every column separator if you enclose them in balanced curly braces. However, \texttt{col sep=braces} has the special treatment that end-of-line counts as white space character; for every other \texttt{col sep} value, this white space is suppressed to remove spurious spaces.}.
The |col sep=&| case (probably together with |row sep=\\|) allows to read tables as you'd usually type them in \LaTeX. This will automatically enable |trim cells|.
\end{key}
\begin{key}{/pgfplots/table/trim cells=\mchoice{true,false} (initially false)}
- If enabled, leading and trailing white spaces will be removed while tables are read.
+ If enabled, leading and trailing white space will be removed while tables are read.
This might be necessary if you have |col sep|$\neq$|space| but your cells contain spaces. It will be activated automatically for |col sep=&|.
\end{key}
@@ -361,7 +355,7 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1)
\end{enumerate}
The same applies if you experience problems with inline data and special |col sep| choices (like |col sep=tab|).
- The reasons for such problems is that \TeX\ scans the macro bodies and replaces newlines by white spaces. It does other substitutions of this sort as well, and these substitutions can't be undone (maybe not even found).
+ The reasons for such problems is that \TeX\ scans the macro bodies and replaces newlines by white space. It does other substitutions of this sort as well, and these substitutions can't be undone (maybe not even found).
\end{pgfplotskey}
\begin{key}{/pgfplots/table/ignore chars=\marg{comma-separated-list} (initially empty)}
@@ -377,7 +371,7 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1)
{pgfplotstable.example5.dat}
\end{codeexample}
- The \meta{comma-separated-list} should contain exactly one character in each list element, and the single characters should be separated by commas. Some special characters like commas, white spaces, hashes, percents or backslashes need to be escaped by prefixing them with a backslash.
+ The \meta{comma-separated-list} should contain exactly one character in each list element, and the single characters should be separated by commas. Some special characters like commas, white space, hashes, percents or backslashes need to be escaped by prefixing them with a backslash.
Besides normal characters, it is also supported to eliminate any binary code from your input files. For example, suppose you have binary characters of code |0x01| (hex notation) in your files. Then, use
\begin{codeexample}[code only]
@@ -389,20 +383,50 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1)
This setting applies to |\addplot table| and |\addplot file| for \PGFPlots\ as well.
- Note that |ignore chars| is ``fragile'' when it is applied to |format=inline| or |format=auto|. Consider |format=file| if you experience problems\footnote{See also |row\ sep| for more information about dealing with fragile inline tables formats.}.
+ Note that |ignore chars| is ``fragile'' when it is applied to |format=inline| or |format=auto|. Consider |format=file| if you experience problems\footnote{See also |row\ sep| for more information about dealing with fragile inline table formats.}.
\end{key}
\begin{key}{/pgfplots/table/white space chars=\marg{comma-separated-list} (initially empty)}
- Allows to define a list of single characters which are actually treated like white spaces (in addition to tabs and spaces). It might be useful in order to get more than one column separator character.
+ Allows to define a list of single characters which are actually treated like white space (in addition to tabs and spaces). It might be useful in order to get more than one column separator character.
The |white space chars| list is used in exactly the same way as |ignore chars|, and the same remarks as above apply as well.
\end{key}
+\begin{key}{/pgfplots/table/comment chars=\marg{comma-separated-list} (initially empty)}
+ Allows to add one or more \emph{additional} comment characters. Each of these characters has a similar effect as the |#| character, i.e.\ all following characters of that particular input line are skipped.
+\begin{codeexample}[]
+\pgfplotstabletypeset[comment chars=!]{
+! Some comments
+1 0
+2 -10
+! another comment line
+3 0
+}
+\end{codeexample}
+ The example above uses `|!|' as additional comment character (which allows to parse Touchstone files).
+\end{key}
+
+\begin{key}{/pgfplots/table/skip first n=\marg{integer} (initially 0)}
+ Allows to skip the first \meta{integer} lines of an input file. The lines will not be processed.
+\begin{codeexample}[]
+\pgfplotstabletypeset[skip first n=4]{%<- this '%' is important. Otherwise, the
+ %newline here would delimit an (empty) row.
+ XYZ Format,
+ Version 1.234
+ Date 2010-09-01
+ @author Mustermann
+ A B C
+ 1 2 3
+ 4 5 6
+}
+\end{codeexample}
+\end{key}
+
\subsection{Selecting Columns and their Appearance Styles}
\begin{key}{/pgfplots/table/columns=\marg{comma-separated-list}}
- Selects particular columns the table. If this option is empty (has not been provided), all available columns will be selected.
+ Selects particular columns of the table. If this option is empty (has not been provided), all available columns will be selected.
- Inside of \marg{comma-separated-list}, column names as they appear in the table's header are expected. If there is no header, simply use column indices. If there are column names, the special syntax |[index]|\meta{integer} can be used to select columns by index. The first column has index~$0$.
+ Inside of \meta{comma-separated-list}, column names as they appear in the table's header are expected. If there is no header, simply use column indices. If there are column names, the special syntax |[index]|\meta{integer} can be used to select columns by index. The first column has index~$0$.
\begin{codeexample}[]
\pgfplotstabletypeset[columns={dof,level,[index]4}]{pgfplotstable.example1.dat}
\end{codeexample}
@@ -416,17 +440,16 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1)
% in preamble:
\pgfplotstableset{
alias/newname/.initial=b,
-}%
-%
+}
+
% in document:
\pgfplotstabletypeset[
- row sep=\\,
columns={a,newname},% access to `newname' is the same as to `b'
]{
- a b\\
- 1 2\\
- 3 4\\
- 5 6\\
+ a b
+ 1 2
+ 3 4
+ 5 6
}%
\end{codeexample}
You can use |columns/|\meta{col name}|/.style| to assign styles for the alias, not for the original column name.
@@ -435,11 +458,11 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1)
In case \meta{col name} contains characters which are required for key settings, you need to use braces around it: ``|alias/{name=wi/th,special}/.initial={othername}|''.
- This key is used whenever columns are queries, it applies also to the |\addplot table| statement of \PGFPlots.
+ This key is used whenever columns are queried, it applies also to the |\addplot table| statement of \PGFPlots.
\end{pgfplotstablealiaskey}
\begin{pgfplotstablecolumnkey}
- Sets all options in \marg{key-value-list} exclusively for \marg{column name}.
+ Sets all options in \meta{key-value-list} exclusively for \meta{column name}.
\begin{codeexample}[]
\pgfplotstabletypeset[
@@ -476,11 +499,11 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1)
]
{pgfplotstable.example1.dat}
\end{codeexample}
- If your tables don't have column names, you can simply use integer indices instead of \marg{column name} to refer to columns. If you have column names, you can't set column styles using indices.
+ If your tables don't have column names, you can simply use integer indices instead of \meta{column name} to refer to columns. If you have column names, you can't set column styles using indices.
\end{pgfplotstablecolumnkey}
\begin{pgfplotstabledisplaycolumnkey}
- Applies all options in \marg{key-value-list} exclusively to the column which will appear at position \meta{index} in the output table.
+ Applies all options in \meta{key-value-list} exclusively to the column which will appear at position \meta{index} in the output table.
In contrast to the |table/columns/|\meta{name} styles, this option refers to the output table instead of the input table. Since the output table has no unique column name, you can only access columns by index.
@@ -531,7 +554,9 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1)
\end{codekey}
\begin{stylekey}{/pgfplots/table/multicolumn names=\marg{tabular column type} (initially c)}
- A style which typesets each column name using a |\multicolumn{1}|\marg{tabular column type}\marg{the column name} statement.
+ A style which typesets each column name in the current context using a |\multicolumn{1}|\marg{tabular column type}\marg{the column name} statement.
+
+ Here,\meta{the column name} is set with |column name| as usual.
\end{stylekey}
\begin{stylekey}{/pgfplots/table/dec sep align=\marg{header column type} (initially c)}
@@ -650,7 +675,7 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1)
{pgfplotstable.example1.dat}
\end{codeexample}
- The |sort| mechanism is applied before the actual typesetting routine starts, i.e.\ it has the same effect as if you'd call |\pgfplotstablesort| manually before typesetting the table (however, the |sort| key has the advantage of respective the |include outfiles| caching mechanism). Any |create on use| specifications are resolved before calling the |sort key|.
+ The |sort| mechanism is applied before the actual typesetting routine starts, i.e.\ it has the same effect as if you'd call |\pgfplotstablesort| manually before typesetting the table (however, the |sort| key has the advantage of respecting the |include outfiles| caching mechanism). Any |create on use| specifications are resolved before calling the |sort key|.
%The |sort| key applies also to |\addplot table[sort,read completely]|.
@@ -725,14 +750,14 @@ A style which is installed for every column with odd column index (starting with
\end{stylekey}
\begin{command}{\pgfplotstablecol}
- During the evaluation of row or column options, this command expands to the current columns' index.
+ During the evaluation of row or column options, this command expands to the current column's index.
\end{command}
\begin{command}{\pgfplotstablecolname}
- During the evaluation of column options, this command expands to the current column's name. It is valid while |\pgfplotstabletypeset| processes the column styles (including the preprocessing step explained in section~\ref{sec:pgfplotstable:preproc}), prepares the output cell content and checks row predicates.
+ During the evaluation of column options, this command expands to the current column's name. It is valid while |\pgfplotstabletypeset| processes the column styles (including the preprocessing step explained in Section~\ref{sec:pgfplotstable:preproc}), prepares the output cell content and checks row predicates.
\end{command}
\label{pgfplotstable:page:tablerow}
\begin{command}{\pgfplotstablerow}
- During the evaluation of row or column options, this command expands to the current rows' index.
+ During the evaluation of row or column options, this command expands to the current row's index.
\end{command}
\begin{command}{\pgfplotstablecols}
During the evaluation of row or column options, this command expands to the total number of columns in the output table.
@@ -758,6 +783,97 @@ The following styles allow to configure the final table code \emph{after any cel
\begin{key}{/pgfplots/table/before row=\marg{\TeX\ code}}
Contains \TeX\ code which will be installed before the first cell in a row.
+
+ Keep in mind that \PGFPlotstable\ does no magic -- it is simply a code generator which produces |tabular| environments. Consequently, you can add any \TeX\ code which you would normally write into your |tabular| environment here.
+
+ An example could be a multicolumn heading for which \PGFPlotstable\ has no own solution:
+\begin{codeexample}[]
+% \usepackage{booktabs}
+\pgfplotstabletypeset[
+ column type=l,
+ every head row/.style={
+ before row={%
+ \toprule
+ & \multicolumn{2}{c}{Singular} & \multicolumn{2}{c}{Plural}\\
+ },
+ after row=\midrule,
+ },
+ every last row/.style={
+ after row=\bottomrule},
+ columns/person/.style ={column name=},
+ columns/singGaeilge/.style ={column name=Gaeilge},
+ columns/pluralGaeilge/.style={column name=Gaeilge},
+ columns/singEnglish/.style ={column name=English},
+ columns/pluralEnglish/.style={column name=English},
+ col sep=&,row sep=\\,
+ string type,
+]{
+person & singEnglish & singGaeilge & pluralEnglish & pluralGaeilge\\
+1st & at me & agam & at us & againn\\
+2st & at you & agat & at you & agaibh\\
+3st & at him & aige & at them & acu\\
+ & at her & aici & &\\
+}
+\end{codeexample}
+ \noindent The example declares a lot of options and is finally followed by a short inline table. The |every head row| style configures |\multicolumn| headings by means of verbatim |tabular| code, together with |booktabs| rules. It might be helpful to consider the |debug| or |outfile| keys during experiments. The |columns/...| styles are necessary to change the column headings.
+
+
+ Sometimes, one wants to combine |\multicolumn| and |\rowcolor|. From what I know about \LaTeX, this is a little bit complicated: it requires the use of |\columncolor| inside of the |\multicolumn|. As in the example above, it is necessary to modify the code generated by \PGFPlotstable\ a little bit. Keep in mind that \PGFPlotstable\ is just a code generator for |tabular| environments -- modify whatever you want. The following example demonstrates the combination of |\multicolumn| and |\rowcolor|. It has been taken out of an -- admittedly advanced -- application:
+\begin{codeexample}[]
+\newcolumntype{C}{>{\centering\arraybackslash}p{6mm}}% a centered fixed-width-column
+\pgfplotstabletypeset[
+ col sep=&,
+ row sep=\\,
+ every head row/.style={
+ % as in the previous example, this patches the first row:
+ before row={
+ \hline
+ \rowcolor{lightgray}
+ \multicolumn{3}{|>{\columncolor{lightgray}}c|}{Quantenzahlen} & Term--\\
+ \rowcolor{lightgray}
+ },
+ after row=\hline,
+ },
+ every last row/.style={
+ after row=\hline},
+ % define column-specific styles:
+ columns/n/.style={column type=|C,column name=$n$},
+ columns/l/.style={column type=|C,column name=$\ell$},
+ columns/lambda/.style={column type=|C,column name=$\lambda$},
+ columns/text/.style={column type=|c|,column name=bezeichnung,
+ string type % <-it contains formatted data
+ },
+]
+{
+n & l & lambda & text\\
+1 & 0 & 0 & $1 s\sigma$ \\
+2 & 0 & 0 & $2 s\sigma$ \\
+2 & 1 & 0 & $2 p\sigma$ \\
+2 & 1 & 1 & $2 p \pi $\\
+3 & 2 & 0 & $3 d\sigma$ \\
+3 & 2 & 2 & $3 d\delta$ \\
+}
+\end{codeexample}
+
+ Up to the number formatting (which actually invokes |\pgfmathprintnumber|), the code above is equivalent to the listing
+\begin{codeexample}[code only]
+\newcolumntype{C}{>{\centering\arraybackslash}p{6mm}}% a centered fixed-width-column
+\begin{tabular}{|C|C|C|c|}
+\hline
+\rowcolor{lightgray} \multicolumn{3}{|>{\columncolor{lightgray}}c|}{Quantenzahlen} & Term--\\
+\rowcolor{lightgray} $n$ & $\ell$ & $\lambda$ & bezeichnung\\
+\hline
+$1$ & $0$ & $0$ & $1 s\sigma$ \\
+$2$ & $0$ & $0$ & $2 s\sigma$ \\
+$2$ & $1$ & $0$ & $2 p\sigma$ \\
+$2$ & $1$ & $1$ & $2 p \pi$ \\
+$3$ & $2$ & $0$ & $3 d\sigma$ \\
+$3$ & $2$ & $2$ & $3 d\delta$ \\
+\hline
+\end{tabular}
+\end{codeexample}
+
+ Clearly, the overhead introduced by defining a lot of styles is only worth the effort if you require number printing, automated processing, or have a huge bulk of similar tables.
\end{key}
\begin{key}{/pgfplots/table/after row=\marg{\TeX\ code}}
@@ -837,13 +953,120 @@ The following styles allow to configure the final table code \emph{after any cel
\end{stylekey}
\begin{stylekey}{/pgfplots/table/every last row}
- A style which is installed for each last \emph{data} row.
+ A style which is installed for each last row.
\end{stylekey}
\begin{stylekey}{/pgfplots/table/every row no \meta{index}}
A style which is installed for the row with index \meta{index}.
\end{stylekey}
+\begin{keylist}{%
+ /pgfplots/table/every nth row=\marg{integer}\marg{options},
+ /pgfplots/table/every nth row=\marg{integer\oarg{shift}}\marg{options}}
+ %
+ This allows to install \meta{options} for every $n$th row with $n=$\meta{integer}.
+\begin{codeexample}[]
+\pgfplotstabletypeset[
+ every nth row={3}{before row=\midrule},
+ every head row/.style={
+ before row=\toprule,after row=\midrule},
+ every last row/.style={
+ after row=\bottomrule},
+]{
+ a b
+ 0 0
+ 1 1
+ 2 2
+ 3 3
+ 4 4
+ 5 5
+ 6 6
+ 7 7
+ 8 8
+}
+\end{codeexample}
+ Only data rows are considered for |every nth row|; it will never apply to column names and data rows are numbered like $i=0,1,2,\dotsc$ (the example above applies it to the rows with $a = 3,6$). Since the case $i=0$ can be handled by |every first row|, it is not considered for |every nth row|.
+
+ The second syntax allows to provide an additional \meta{shift}:
+\begin{codeexample}[]
+\pgfplotstabletypeset[
+ every nth row={3[+1]}{before row=\midrule},
+]{
+ a b
+ 0 0
+ 1 1
+ 2 2
+ 3 3
+ 4 4
+ 5 5
+ 6 6
+ 7 7
+ 8 8
+ 9 9
+ 10 10
+}
+\end{codeexample}
+ \noindent Here, the style is applied to rows $i=1,4,7,10$ (mathematically, it is applied if $(i \text{ mod } n) = $\meta{shift}). The \meta{shift} can be negative.
+
+ You can define many |every nth row| styles, they are processed in the order of occurance (consider using |before row/.add=|\marg{before existing}\marg{after existing} to modify an existing value).
+
+ Note that |every nth row/.style 2 args=...| is the same as |every nth row=...|.
+\end{keylist}
+
+\subsection{Configuring Single--Cell Appearance: Styles}
+Besides the possibilities to change column styles and row styles, there are also a couple of styles to change single cells.
+\begin{stylekey}{/pgfplots/table/every row \meta{rowindex} column \meta{colindex}}
+ A style which applies to at most one cell: the one with row index \meta{rowindex} and column index \meta{colindex}. Each of these indices starts with~$0$.
+
+ The style is evaluated in the same context as the |preproc cell content|, |assign cell content|, and |postproc cell content| keys and it is a legitimate possibility to modify any of these parameters. It is also possible to replace the initial cell value by assigning something to |@cell content|.
+
+ For example, consider this unmodified table:
+\begin{codeexample}[]
+\pgfplotstabletypeset[
+ col sep=&,row sep=\\]{
+ colA & colB & colC \\
+ 11 & 12 & 13 \\
+ 21 & 22 & 23 \\
+}
+\end{codeexample}
+
+ Now, we change the number format of one of its cells, and at the same time we change the formatting of another (single) cell:
+\begin{codeexample}[]
+\pgfplotstabletypeset[
+ every row 1 column 2/.style={/pgf/number format/sci},
+ every row 0 column 0/.style={postproc cell content/.style={@cell content=\textbf{##1}}},
+ col sep=&,row sep=\\]{
+ colA & colB & colC \\
+ 11 & 12 & 13 \\
+ 21 & 22 & 23 \\
+}
+\end{codeexample}
+ Note that this style is (only) applied to input row/column values.
+\end{stylekey}
+
+\begin{stylekey}{/pgfplots/table/every row no \meta{rowindex} column no \meta{colindex}}
+ This is actually the same -- |row no| and |row| are both supported, the same for |column| and |column no|.
+\end{stylekey}
+
+\begin{stylekey}{/pgfplots/table/every row \meta{rowindex} column \meta{colname}}
+ A similar style as above, but it allows column \emph{names} rather than column indices. Column names need to be provided in the same way as for other column--specific styles (including the extra curly braces in case \meta{colname} contains special characters).
+
+ Our example from above can thus become:
+\begin{codeexample}[]
+\pgfplotstabletypeset[
+ every row 1 column colB/.style={string replace*={2}{4}},
+ every row 0 column colA/.style={preproc/expr={##1*8}},
+ col sep=&,row sep=\\]{
+ colA & colB & colC \\
+ 11 & 12 & 13 \\
+ 21 & 22 & 23 \\
+}
+\end{codeexample}
+ The example employs the |string replace*| preprocessor style and the |preproc/expr| style. All preprocessor or postprocessor styles can be used.
+
+ Please refer to Section~\ref{sec:data:processing} for predefined choices.
+\end{stylekey}
+
\subsection{Customizing and Getting the Tabular Code}
The following keys allow changes of alignment (|begin table|) and |font| and they allow to write the generated code to |outfile|s (see also |write to macro|). Furthermore, the generated code can be fine--tuned to provide other sorts of table output, beyond \LaTeX.
\begin{stylekey}{/pgfplots/table/every table=\marg{file name}}
@@ -876,7 +1099,7 @@ The following keys allow changes of alignment (|begin table|) and |font| and the
prepends the empty string |{}| and appends the prefix |[t]|. Thus, `|\begin{tabular}|' becomes `|\begin{tabular}[t]|'.
\end{key}
\begin{key}{/pgfplots/table/end table=\marg{code} (initially \textbackslash end\{tabular\})}
- Contains \marg{code} which is generated as table end.
+ Contains \meta{code} which is generated as table end.
\end{key}
\begin{codekey}{/pgfplots/table/typeset cell}
@@ -897,7 +1120,7 @@ The following keys allow changes of alignment (|begin table|) and |font| and the
\begin{key}{/pgfplots/table/outfile=\marg{file name} (initially empty)}
\label{page:outfile}
- Writes the generated tabular code into \marg{file name}. It can then be used with |\input|\marg{file name}, \PGFPlotstable\ is no longer required since it contains a completely normal |tabular|.
+ Writes the generated tabular code into \meta{file name}. It can then be used with |\input|\marg{file name}, \PGFPlotstable\ is no longer required since it contains a completely normal |tabular|.
\pgfplotstableset{begin table=\begin{tabular}}
\begin{codeexample}[]
\pgfplotstabletypeset[
@@ -926,17 +1149,17 @@ The command |\pgfutilensuremath| checks whether math mode is active and switches
\noindent which will generate an |outfile| name for every table.
\end{key}
\begin{key}{/pgfplots/table/force remake=\marg{boolean} (initially false)}
- If enabled, the effect of |include outfiles| is disabled. As all key settings only last until the next brace (or |\end|\meta{}), this key can be used to re-generate some output files while others are still included.
+ If enabled, the effect of |include outfiles| is disabled. As all key settings only last until the next brace (or |\end|\meta{}), this key can be used to regenerate some output files while others are still included.
\end{key}
\begin{key}{/pgfplots/table/write to macro=\marg{\textbackslash macroname}}
- If the value of |write to macro| is not empty, the completely generated (tabular) code will be written into the macro \marg{\textbackslash macroname}.
+ If the value of |write to macro| is not empty, the completely generated (tabular) code will be written into the macro \meta{\textbackslash macroname}.
See the |typeset=false| key in case you need \emph{only} the resulting macro.
\end{key}
\begin{key}{/pgfplots/table/skip coltypes=\mchoice{true,false} (initially false)}
- Allows to skip the \marg{coltypes} in |\begin{tabular}|\marg{coltypes}. This allows simplifications for other table types which don't have \LaTeX's table format.
+ Allows to skip the \meta{coltypes} in |\begin{tabular}|\marg{coltypes}. This allows simplifications for other table types which don't have \LaTeX's table format.
\end{key}
\begin{key}{/pgfplots/table/typeset=\mchoice{true,false} (initially true)}
@@ -944,14 +1167,14 @@ The command |\pgfutilensuremath| checks whether math mode is active and switches
\end{key}
\begin{key}{/pgfplots/table/debug=\marg{boolean} (initially false)}
- If enabled, will write every final tabular code to your log file.
+ If enabled, it will write every final tabular code to your log file.
\end{key}
\begin{key}{/pgfplots/table/TeX comment=\marg{comment sign} (initially \%)}
- The comment sign which is inserted into outfiles to suppress trailing white spaces.
+ The comment sign which is inserted into outfiles to suppress trailing white space.
\end{key}
-\noindent As last example, we use \PGFPlotstable\ to write an |.html| file (including number formatting and rounding!):
+\noindent As a last example, we use \PGFPlotstable\ to write an |.html| file (including number formatting and rounding!):
% \usepackage{listings}
\begin{codeexample}[width=8cm]
\pgfplotstabletypeset[
@@ -972,10 +1195,10 @@ The command |\pgfutilensuremath| checks whether math mode is active and switches
\end{codeexample}
\subsection{Defining Column Types for \texttt{tabular}}
-Besides input of text files, it is sometimes desireable to define column types for existing \texttt{tabular} environments.
+Besides input of text files, it is sometimes desirable to define column types for existing \texttt{tabular} environments.
\begin{command}{\newcolumntype\marg{letter}\oarg{number of arguments}$>$\marg{before column}\meta{column type}$<$\marg{after column}}
-The command |\newcolumntype| is part of the |array| package and it defines a new column type \marg{letter} for use in \LaTeX\ tabular environments.
+The command |\newcolumntype| is part of the |array| package and it defines a new column type \meta{letter} for use in \LaTeX\ tabular environments.
\begin{codeexample}[code only]
\usepackage{array}
\end{codeexample}
@@ -988,7 +1211,7 @@ c & d \\
\end{tabular}
\end{codeexample}
-Now, the environment |pgfplotstablecoltype| can be used in \marg{before column} and \marg{after column} to define numerical columns:
+Now, the environment |pgfplotstablecoltype| can be used in \meta{before column} and \meta{after column} to define numerical columns:
% \usepackage{array}
\begin{codeexample}[]
% requires \usepackage{array}
@@ -1033,15 +1256,17 @@ Now, the environment |pgfplotstablecoltype| can be used in \marg{before column}
\subsection{Number Formatting Options}
\label{sec:number:printing}%
-The following extract of \cite{tikz} explains how to configure number formats. The common option prefix |/pgf/number format| can be omitted; it will be recognised automatically.
+The following extract of \cite{tikz} explains how to configure number formats. The common option prefix |/pgf/number format| can be omitted; it will be recognized automatically.
+
+All these number formatting options can also be applied to \PGFPlots.
\begin{command}{\pgfmathprintnumber\marg{x}}
-Generates pretty-printed output for the (real) number \marg{x}. The input number \marg{x} is parsed using |\pgfmathfloatparsenumber| which allows arbitrary precision.
+Generates pretty-printed output for the (real) number \meta{x}. The input number \meta{x} is parsed using |\pgfmathfloatparsenumber| which allows arbitrary precision.
Numbers are typeset in math mode using the current set of number printing options, see below. Optional arguments can also be provided using |\pgfmathprintnumber[|\meta{options}|]|\marg{x}.
\end{command}
\begin{command}{\pgfmathprintnumberto\marg{x}\marg{\textbackslash macro}}
- Returns the resulting number into \marg{\textbackslash macro} instead of typesetting it directly.
+ Returns the resulting number into \meta{\textbackslash macro} instead of typesetting it directly.
\end{command}
\begin{key}{/pgf/number format/fixed}
@@ -1056,7 +1281,7 @@ Configures |\pgfmathprintnumber| to round the number to a fixed number of digits
\pgfmathprintnumber{123456.12345}
\end{codeexample}
-See section~\ref{sec:number:styles} for how to change the appearance.
+See Section~\ref{sec:number:styles} for how to change the appearance.
\end{key}
\begin{key}{/pgf/number format/fixed zerofill=\marg{boolean} (default true)}
@@ -1070,7 +1295,7 @@ Enables or disables zero filling for any number drawn in fixed point format.
\pgfmathprintnumber{24415.98123}\hspace{1em}
\pgfmathprintnumber{123456.12345}
\end{codeexample}
-This key affects numbers drawn with |fixed| or |std| styles (the latter only if no scientific format is choosen).
+This key affects numbers drawn with |fixed| or |std| styles (the latter only if no scientific format is chosen).
\begin{codeexample}[]
\pgfkeys{/pgf/number format/.cd,std,fixed zerofill,precision=2}
\pgfmathprintnumber{4.568}\hspace{1em}
@@ -1079,11 +1304,11 @@ This key affects numbers drawn with |fixed| or |std| styles (the latter only if
\pgfmathprintnumber{123456.12345}
\end{codeexample}
-See section~\ref{sec:number:styles} for how to change the appearance.
+See Section~\ref{sec:number:styles} for how to change the appearance.
\end{key}
\begin{key}{/pgf/number format/sci}
-Configures |\pgfmathprintnumber| to display numbers in scientific format, that means sign, mantisse and exponent (basis~$10$). The mantisse is rounded to the desired |precision| (or |sci precision|, see below).
+Configures |\pgfmathprintnumber| to display numbers in scientific format, that means sign, mantissa and exponent (base~$10$). The mantissa is rounded to the desired |precision| (or |sci precision|, see below).
\begin{codeexample}[]
\pgfkeys{/pgf/number format/.cd,sci,precision=2}
@@ -1094,7 +1319,7 @@ Configures |\pgfmathprintnumber| to display numbers in scientific format, that m
\pgfmathprintnumber{123456.12345}
\end{codeexample}
-See section~\ref{sec:number:styles} for how to change the exponential display style.
+See Section~\ref{sec:number:styles} for how to change the exponential display style.
\end{key}
\begin{key}{/pgf/number format/sci zerofill=\marg{boolean} (default true)}
@@ -1110,11 +1335,11 @@ Enables or disables zero filling for any number drawn in scientific format.
\end{codeexample}
As with |fixed zerofill|, this option does only affect numbers drawn in |sci| format (or |std| if the scientific format is chosen).
-See section~\ref{sec:number:styles} for how to change the exponential display style.
+See Section~\ref{sec:number:styles} for how to change the exponential display style.
\end{key}
\begin{stylekey}{/pgf/number format/zerofill=\marg{boolean} (default true)}
- Sets both, |fixed zerofill| and |sci zerofill| at once.
+ Sets both |fixed zerofill| and |sci zerofill| at once.
\end{stylekey}
\begin{keylist}{/pgf/number format/std,%
@@ -1134,6 +1359,52 @@ The parameters can be customized using the optional integer argument(s): if $\te
\end{keylist}
+\begin{keylist}{/pgf/number format/relative=\meta{exponent base 10}}
+ Configures |\pgfmathprintnumber| to format numbers relative to an order of magnitude, $10^r$, where $r$ is an integer number.
+
+ The motivation is to provide a unified format for a \emph{sequence} of numbers:
+\begin{codeexample}[]
+\pgfkeys{/pgf/number format/relative={1}}
+\pgfmathprintnumber{6.42e-16}\hspace{1em}
+\pgfmathprintnumber{1.2}\hspace{1em}
+\pgfmathprintnumber{6}\hspace{1em}
+\pgfmathprintnumber{20.6}\hspace{1em}
+\pgfmathprintnumber{87}
+\end{codeexample}
+ \noindent With any other style, the |6.42e-16| would have been formatted as an isolated number. Here, it is rounded to |0| because when viewed relative to $10^3$, it has no significant digits.
+
+\begin{codeexample}[]
+\pgfkeys{/pgf/number format/relative={2}}
+\pgfmathprintnumber{123.345}\hspace{1em}
+\pgfmathprintnumber{0.0012}\hspace{1em}
+\pgfmathprintnumber{0.0014}\hspace{1em}
+\end{codeexample}
+ Here, it applies the initial |precision=2| to |123.345| -- relative to $100$. Two significant digits of |123.345| relative to $100$ are |123|. Similarly, the other two numbers are |0| compared to $100$ using the given |precision|.
+
+
+\begin{codeexample}[]
+\pgfkeys{/pgf/number format/relative={-3}}
+\pgfmathprintnumber{123.345}\hspace{1em}
+\pgfmathprintnumber{0.0012}\hspace{1em}
+\pgfmathprintnumber{0.0014}\hspace{1em}
+\end{codeexample}
+
+
+ When applied to a number $x = \pm m \cdot 10^e$, the |relative=|$r$ method actually rounds $x / 10^r$ to the desired precision. More precisely: if $e-r>0$, it only rounds the mantissa of $x/10^r$ to the desired precision, otherwise it rounds the complete number to the desired precision. Afterwards, it disables rounding, multiplies the intermediate result by $10^r$, and evaluates the style |every relative| to actually format the result.
+\end{keylist}
+\begin{stylekey}{/pgf/number format/every relative}
+ A style which configures how the |relative| method finally displays its results.
+
+ The initial configuration is
+\begin{codeexample}[code only]
+\pgfkeys{/pgf/number format/every relative/.style=std}
+\end{codeexample}
+
+ Note that rounding is turned off when the resulting style is being evaluated (since |relative| already rounded the number).
+
+ Although supported, I discourage from using |fixed zerofill| or |sci zerofill| in this context -- it may lead to a suggestion of higher precision than is actually used (because |fixed zerofill| might simply add |.00| although there was a different information before |relative| rounded the result).
+\end{stylekey}
+
\begin{key}{/pgf/number format/int detect}
Configures |\pgfmathprintnumber| to detect integers automatically. If the input number is an integer, no period is displayed at all. If not, the scientific format is chosen.
@@ -1219,7 +1490,7 @@ Displays numbers as fractionals.
\end{codeexample}
\end{key}
\begin{key}{/pgf/number format/frac shift=\marg{integer} (initially 4)}
- In case you experience problems because of stability problems, try experimenting with a different |frac shift|.
+ In case you experience stability problems, try experimenting with a different |frac shift|.
Higher shift values $k$ yield higher sensitivity to inaccurate data or inaccurate arithmetics.
Technically, the following happens. If $r < 1$ is the fractional part of the mantissa, then a scale $i = 1/r \cdot 10^k$ is computed where $k$ is the shift; fractional parts of $i$ are neglected. The value $1/r$ is computed internally, its error is amplified.
@@ -1229,7 +1500,7 @@ Displays numbers as fractionals.
\end{key}
\begin{key}{/pgf/number format/precision=\marg{number}}
-Sets the desired rounding precision for any display operation. For scientific format, this affects the mantisse.
+Sets the desired rounding precision for any display operation. For scientific format, this affects the mantissa.
\end{key}
\begin{key}{/pgf/number format/sci precision=\meta{number or empty} (initially empty)}
Sets the desired rounding precision only for |sci| styles.
@@ -1243,7 +1514,7 @@ Sets the desired rounding precision for any display operation. For scientific fo
You can change the way how numbers are displayed. For example, if you use the `\texttt{fixed}' style, the input number is rounded to the desired precision and the current fixed point display style is used to typeset the number. The same is applied to any other format: first, rounding routines are used to get the correct digits, afterwards a display style generates proper \TeX-code.
\begin{key}{/pgf/number format/set decimal separator=\marg{text}}
-Assigns \marg{text} as decimal separator for any fixed point numbers (including the mantisse in sci format).
+Assigns \meta{text} as decimal separator for any fixed point number (including the mantissa in sci format).
\end{key}
\begin{key}{/pgf/number format/dec sep=\marg{text}}
Just another name for |set decimal separator|.
@@ -1251,7 +1522,7 @@ Assigns \marg{text} as decimal separator for any fixed point numbers (including
\begin{key}{/pgf/number format/set thousands separator=\marg{text}}
-Assigns \marg{text} as thousands separator for any fixed point numbers (including the mantisse in sci format).
+Assigns \meta{text} as thousands separator for any fixed point number (including the mantissa in sci format).
\begin{codeexample}[]
\pgfkeys{/pgf/number format/.cd,
@@ -1300,6 +1571,31 @@ The last example employs commas and disables the default comma-spacing.
Just another name for |set thousands separator|.
\end{key}
+\begin{key}{/pgf/number format/1000 sep in fractionals=\marg{boolean} (initially false)}
+ Configures whether the fractional part should also be grouped into groups of three digits.
+
+ The value |true| will activate the |1000 sep| for both integer and fractional parts. The value |false|
+ will activate |1000 sep| only for the integer part.
+\begin{codeexample}[]
+\pgfkeys{/pgf/number format/.cd,
+ fixed,
+ precision=999,
+ set thousands separator={\,},
+ 1000 sep in fractionals,
+ }
+\pgfmathprintnumber{1234.1234567}
+\end{codeexample}
+\begin{codeexample}[]
+\pgfkeys{/pgf/number format/.cd,
+ fixed,fixed zerofill,
+ precision=9,
+ set thousands separator={\,},
+ 1000 sep in fractionals,
+ }
+\pgfmathprintnumber{1234.1234567}
+\end{codeexample}
+\end{key}
+
\begin{key}{/pgf/number format/min exponent for 1000 sep=\marg{number} (initially 0)}
Defines the smalles exponent in scientific notation which is required to draw thousand separators. The exponent is the number of digits minus one, so $\meta{number}=4$ will use thousand separators starting with $1e4 = 10000$.
\begin{codeexample}[]
@@ -1391,7 +1687,7 @@ A predefined style which installs commas `\texttt{,}' as decimal separators and
\end{key}
\begin{stylekey}{/pgf/number format/print sign=\marg{boolean}}
- A style which is simply an alias for |showpos=|\marg{boolean}.
+ A style which is simply an alias for |showpos=|\meta{boolean}.
\end{stylekey}
\begin{key}{/pgf/number format/sci 10e}
@@ -1426,7 +1722,7 @@ The same with an uppercase `\texttt{E}'.
\end{key}
\begin{key}{/pgf/number format/sci subscript}
-Typesets the exponent as subscript for any number displayed in scientific format. This style requires very few space.
+Typesets the exponent as subscript for any number displayed in scientific format. This style requires very little space.
\begin{codeexample}[]
\pgfkeys{/pgf/number format/.cd,sci,sci subscript}
@@ -1435,7 +1731,7 @@ Typesets the exponent as subscript for any number displayed in scientific format
\end{key}
\begin{key}{/pgf/number format/sci superscript}
-Typesets the exponent as superscript for any number displayed in scientific format. This style requires very few space.
+Typesets the exponent as superscript for any number displayed in scientific format. This style requires very little space.
\begin{codeexample}[]
\pgfkeys{/pgf/number format/.cd,sci,sci superscript}
@@ -1444,10 +1740,10 @@ Typesets the exponent as superscript for any number displayed in scientific form
\end{key}
\begin{key}{/pgf/number format/sci generic=\marg{keys}}
-Allows to define an own number style for the scientific format. Here, \meta{keys} can be one of the following choices (omit the long key prefix):
+Allows to define a custom number style for the scientific format. Here, \meta{keys} can be one of the following choices (omit the long key prefix):
-\begin{key}{/pgf/number format/sci generic/mantisse sep=\marg{text} (initially empty)}
- Provides the separator between a mantisse and the exponent. It might be |\cdot|, for example,
+\begin{key}{/pgf/number format/sci generic/mantissa sep=\marg{text} (initially empty)}
+ Provides the separator between the mantissa and the exponent. It might be |\cdot|, for example,
\end{key}
\begin{key}{/pgf/number format/sci generic/exponent=\marg{text} (initially empty)}
Provides text to format the exponent. The actual exponent is available as argument |#1| (see below).
@@ -1457,23 +1753,23 @@ Allows to define an own number style for the scientific format. Here, \meta{keys
\pgfkeys{
/pgf/number format/.cd,
sci,
- sci generic={mantisse sep=\times,exponent={10^{#1}}}}
+ sci generic={mantissa sep=\times,exponent={10^{#1}}}}
\pgfmathprintnumber{12.345};
\pgfmathprintnumber{0.00012345}
\end{codeexample}
- The \meta{keys} can depend on three parameters, namely on |#1| which is the exponent, |#2| containing the flags entity of the floating point number and |#3| is the (unprocessed and unformatted) mantisse.
+ The \meta{keys} can depend on three parameters, namely on |#1| which is the exponent, |#2| containing the flags entity of the floating point number and |#3| is the (unprocessed and unformatted) mantissa.
- Note that |sci generic| is \emph{not} suitable to modify the appearance of fixed point numbers, nor can it be used to format the mantisse (which is typeset like fixed point numbers). Use |dec sep|, |1000 sep| and |print sign| to customize the mantisse.
+ Note that |sci generic| is \emph{not} suitable to modify the appearance of fixed point numbers, nor can it be used to format the mantissa (which is typeset like fixed point numbers). Use |dec sep|, |1000 sep| and |print sign| to customize the mantissa.
\end{key}
\begin{key}{/pgf/number format/@dec sep mark=\marg{text}}
- Will be placed right before the place where a decimal separator belongs to. However, \marg{text} will be inserted even if there is no decimal separator. It is intented as place-holder for auxiliary routines to find alignment positions.
+ Will be placed right before the place where a decimal separator belongs to. However, \meta{text} will be inserted even if there is no decimal separator. It is intended as place-holder for auxiliary routines to find alignment positions.
This key should never be used to change the decimal separator! Use |dec sep| instead.
\end{key}
\begin{key}{/pgf/number format/@sci exponent mark=\marg{text}}
- Will be placed right before exponents in scientific notation. It is intented as place-holder for auxiliary routines to find alignment positions.
+ Will be placed right before exponents in scientific notation. It is intended as place-holder for auxiliary routines to find alignment positions.
This key should never be used to change the exponent!
\end{key}
@@ -1499,13 +1795,14 @@ Allows to define an own number style for the scientific format. Here, \meta{keys
\end{codeexample}
The style resets |1000 sep|, |dec sep|, |print sign|, |skip 0.| and sets |assume math mode|. Furthermore, it installs a |sci generic| format for verbatim output of scientific numbers.
- However, it will still respect |precision|, |fixed zerofill|, |sci zerofill| and the overall styles |fixed|, |sci|, |int detect| (and their variants). It might be useful if you intent to write output files.
+ However, it will still respect |precision|, |fixed zerofill|, |sci zerofill| and the overall styles |fixed|, |sci|, |int detect| (and their variants). It might be useful if you intend to write output files.
\end{stylekey}
\section{From Input Data To Output Tables: Data Processing}
+\label{sec:data:processing}
The conversion from an unprocessed input table to a final typesetted |tabular| code uses four stages for every cell,
\begin{enumerate}
\item Loading the table,
@@ -1513,10 +1810,10 @@ The conversion from an unprocessed input table to a final typesetted |tabular| c
\item Typesetting,
\item Postprocessing.
\end{enumerate}
-The main idea is to select one typesetting algorithm (for example ``format my numbers with the configured number style''). This algorithm usually doesn't need to be changed. Fine tuning can then be done using zero, one or more preprocessors and postprocessors. Preprocessing can mean to select only particular rows or to apply some sort of operation before the typesetting algorithm sees the content. Postprocessing means to apply fine-tuning to the resulting \TeX\ output -- for example to deal with empty cells or to insert unit suffixes or modify fonts for single cells.
+The main idea is to select one typesetting algorithm (for example ``format my numbers with the configured number style''). This algorithm usually doesn't need to be changed. Fine-tuning can then be done using zero, one or more preprocessors and postprocessors. Preprocessing can mean to select only particular rows or to apply some sort of operation before the typesetting algorithm sees the content. Postprocessing means to apply fine-tuning to the resulting \TeX\ output -- for example to deal with empty cells or to insert unit suffixes or modify fonts for single cells.
\subsection{Loading the table}
-This first step to typeset a table involves the obvious input operations. Furthermore, the ``new column creation'' operations explained in section~\ref{pgfplotstable:createcol} are processed at this time. The table data is read (or acquired) as already explained earlier in this manual. Then, if columns are missing, column alias and |create on use| specifications will be processed as part of the loading procedure. See section~\ref{pgfplotstable:createcol} for details about column creation.
+This first step to typeset a table involves the obvious input operations. Furthermore, the ``new column creation'' operations explained in Section~\ref{pgfplotstable:createcol} are processed at this time. The table data is read (or acquired) as already explained earlier in this manual. Then, if columns are missing, column alias and |create on use| specifications will be processed as part of the loading procedure. See Section~\ref{pgfplotstable:createcol} for details about column creation.
\subsection{Typesetting Cell Content}
Typesetting cells means to take their value and ``do something''. In many cases, this involves number formatting routines. For example, the ``raw'' input data |12.56| might become |1.26| |\cdot| |10^1|. The result of this stage is no longer useful for content-based computations. The typesetting step follows the preprocessing step.
@@ -1525,6 +1822,10 @@ Typesetting cells means to take their value and ``do something''. In many cases,
Allows to redefine the algorithm which assigns cell contents. The argument |#1| is the (unformatted) contents of the input table.
The resulting output needs to be written to |/pgfplots/table/@cell content|.
+\pgfplotstableset{
+ %debug=true,
+ begin table=\begin{tabular},% eliminate the '[b]' from the preamble here
+}
% \usepackage{booktabs}
% \usepackage{multirow}
\begin{codeexample}[]
@@ -1547,6 +1848,7 @@ Typesetting cells means to take their value and ``do something''. In many cases,
every head row/.style={before row=\toprule,after row=\midrule},
every last row/.style={after row=\bottomrule},
row sep=\\,col sep=&,
+ outfile=pgfplotstable.multirow.out,% write it to file
]{% here: inline data in tabular format:
Z & a & b \\
data & 1 & 2 \\
@@ -1554,6 +1856,8 @@ Typesetting cells means to take their value and ``do something''. In many cases,
& 5 & 6 \\
& 7 & 8 \\
}
+% ... and show the generated file:
+\lstinputlisting[basicstyle=\footnotesize\ttfamily]{pgfplotstable.multirow.out}
\end{codeexample}
\index{multirow}%
\noindent The example above uses |\usepackage{multirow}| to format column |Z|. More precisely, it uses |\multirow{4}{*}{data}| for row \#0 of column |Z| and the empty string for any other row in column |Z|.
@@ -1566,7 +1870,7 @@ Typesetting cells means to take their value and ``do something''. In many cases,
\end{codekey}
\begin{stylekey}{/pgfplots/table/numeric type}
- A style which (re)-defines |assign cell content| back to its original value which assumes numerical data.
+ A style which (re)defines |assign cell content| back to its original value which assumes numerical data.
It invokes |\pgfmathprintnumberto| and writes the result into |@cell content|.
\end{stylekey}
@@ -1586,7 +1890,7 @@ Typesetting cells means to take their value and ``do something''. In many cases,
\end{stylekey}
\begin{stylekey}{/pgfplots/table/date type=\marg{date format}}% (initially \year-\month-\day)}
- A style which expects ISO dates of the form |YYYY-MM-DD| in each cell and produces pretty-printed strings on output. The output format is given as \marg{date format}. Inside of \marg{date format}, several macros which are explained below can be used.
+ A style which expects ISO dates of the form |YYYY-MM-DD| in each cell and produces pretty-printed strings on output. The output format is given as \meta{date format}. Inside of \meta{date format}, several macros which are explained below can be used.
% \usepackage{pgfcalendar}
\begin{codeexample}[]
% Requires
@@ -1619,41 +1923,41 @@ Typesetting cells means to take their value and ``do something''. In many cases,
\end{codeexample}
\begin{command}{\year}
- Inside of \marg{date format}, this macro expands to the year as number (like |2008|).
+ Inside of \meta{date format}, this macro expands to the year as a number (like |2008|).
\end{command}
\begin{command}{\month}
- Inside of \marg{date format}, this macro expands to the month as number, starting with~$1$ (like |1|).
+ Inside of \meta{date format}, this macro expands to the month as a number, starting with~$1$ (like |1|).
\end{command}
\begin{command}{\monthname}
- Inside of \marg{date format}, this macro expands to the month's name as set in the current language (like |January|).
+ Inside of \meta{date format}, this macro expands to the month's name as set in the current language (like |January|).
See below for how to change the language.
\end{command}
\begin{command}{\monthshortname}
- Inside of \marg{date format}, this macro expands to the month's short name as set in the current language (like |Jan|).
+ Inside of \meta{date format}, this macro expands to the month's short name as set in the current language (like |Jan|).
See below for how to change the language.
\end{command}
\begin{command}{\day}
- Inside of \marg{date format}, this macro expands to the day as number (like |31|).
+ Inside of \meta{date format}, this macro expands to the day as number (like |31|).
\end{command}
\begin{command}{\weekday}
- Inside of \marg{date format}, this macro expands to the weekday number ($0$ for Monday, $1$ for Tuesday etc.).
+ Inside of \meta{date format}, this macro expands to the weekday number ($0$ for Monday, $1$ for Tuesday etc.).
\end{command}
\begin{command}{\weekdayname}
- Inside of \marg{date format}, this macro expands to the weekday's name in the current language (like |Wednesday|).
+ Inside of \meta{date format}, this macro expands to the weekday's name in the current language (like |Wednesday|).
See below for how to change the language.
\end{command}
\begin{command}{\weekdayshortname}
- Inside of \marg{date format}, this macro expands to the weekday's short name in the current language (like |Wed|).
+ Inside of \meta{date format}, this macro expands to the weekday's short name in the current language (like |Wed|).
See below for how to change the language.
\end{command}
\subsubsection*{Changing the language for dates}
-The date feature is implemented using the \PGF\ calendar module. This module employs the package |translator| (if it is loaded). I don't have more detail yet, sorry. Please refer to \cite{tikz} for more details.
+The date feature is implemented using the \PGF\ calendar module. This module employs the package |translator| (if it is loaded). I don't have more details yet, sorry. Please refer to \cite{tikz} for more details.
\end{stylekey}
\subsection{Preprocessing Cell Content}
\label{sec:pgfplotstable:preproc}
-The preprocessing step allows to change cell contents \emph{before} any typesetting routine (like number formatting) has been applied. Thus, if tables contain numerical data, it is possible to apply math operations at this stage. Furthermore, cells can be erased depending on their numerical value. The preprocess step follows the data acquisition step (``loading step''). This means in particular that you can create (or copy) columns and apply operations on them.
+The preprocessing step allows to change cell contents \emph{before} any typesetting routine (like number formatting) has been applied. Thus, if tables contain numerical data, it is possible to apply math operations at this stage. Furthermore, cells can be erased depending on their numerical value. The preprocessing step follows after the data acquisition step (``loading step''). This means in particular that you can create (or copy) columns and apply operations on them.
\begin{codekey}{/pgfplots/table/preproc cell content}
Allows to \emph{modify} the contents of cells \emph{before} |assign cell content| is called.
@@ -1667,8 +1971,8 @@ The preprocessing step allows to change cell contents \emph{before} any typesett
In case you don't want (or need) stackable preprocessors, you can also use `|#1|' to get the raw input datum as it is found in the file. Furthermore, the key |@unprocessed cell content| will also contain the raw input datum.
\end{codekey}
-\begin{stylekey}{/pgfplots/table/string replace=\marg{pattern}\marg{replacement}}
- Appends code to the current |preproc cell content| value which replaces every occurence of \marg{pattern} with \marg{replacement}. No expansion is performed during this step; \marg{pattern} must match literally.
+\begin{stylekey}{/pgfplots/table/string replace=\marg{cell match}\marg{cell replacement}}
+ Appends code to the current |preproc cell content| value which replaces any cell with exact match \meta{cell match} by \meta{cell replacement}. No expansion is performed during this step; \meta{cell match} must match literally.
\begin{codeexample}[]
\pgfplotstabletypeset[columns={level,dof}]
{pgfplotstable.example1.dat}
@@ -1676,10 +1980,25 @@ The preprocessing step allows to change cell contents \emph{before} any typesett
\pgfplotstabletypeset[
columns={level,dof},
- columns/level/.style={string replace={A}{B}}, % does nothing because there is no 'A'
- columns/dof/.style={string replace={256}{-42}}] % replace '256' with '-42'
+ columns/level/.style={string replace={A}{B}}, % does nothing because there is no cell 'A'
+ columns/dof/.style={string replace={256}{-42}}] % replace cell '256' with '-42'
{pgfplotstable.example1.dat}
\end{codeexample}
+
+ See the |string replace*| method for sub--string replacement.
+\end{stylekey}
+
+\begin{stylekey}{/pgfplots/table/string replace*=\marg{pattern}\marg{replacement}}
+ Appends code to the current |preproc cell content| value which replaces every occurence of \meta{pattern} with \meta{replacement}. No expansion is performed during this step; \meta{pattern} must match literally.
+\begin{codeexample}[]
+\pgfplotstabletypeset[
+ string replace*={2}{6},
+ col sep=&,row sep=\\]{
+ colA & colB & colC \\
+ 11 & 12 & 13 \\
+ 21 & 22 & 23 \\
+}
+\end{codeexample}
\end{stylekey}
\begin{stylekey}{/pgfplots/table/clear infinite}
@@ -1687,9 +2006,9 @@ The preprocessing step allows to change cell contents \emph{before} any typesett
\end{stylekey}
\begin{stylekey}{/pgfplots/table/preproc/expr=\marg{math expression}}
- Appends code to the current |preproc cell content| value which evaluates \marg{math expression} for every cell. Arithmetics are carried out in floating point.
+ Appends code to the current |preproc cell content| value which evaluates \meta{math expression} for every cell. Arithmetics are carried out in floating point.
- Inside of \marg{math expression}, use one of the following expressions to get the current cell's value.
+ Inside of \meta{math expression}, use one of the following expressions to get the current cell's value.
\begin{itemize}
\item The string `|##1|' expands to the cell's content as it has been found in the input file, ignoring preceeding preprocessors.
@@ -1720,16 +2039,16 @@ The preprocessing step allows to change cell contents \emph{before} any typesett
Note that there is also an |create col/expr| which is more powerful than |preproc/expr|.
\end{stylekey}
-\begin{stylekey}{/pgfplots/table/multiply with=\marg{real number}}
- Appends code to the current |preproc cell content| value which multiplies every cell with \marg{real number}. Arithmetics are carried out in floating point.
+\begin{stylekey}{/pgfplots/table/multiply by=\marg{real number}}
+ Appends code to the current |preproc cell content| value which multiplies every cell by \meta{real number}. Arithmetics are carried out in floating point.
\end{stylekey}
\begin{stylekey}{/pgfplots/table/divide by=\marg{real number}}
- Appends code to the current |preproc cell content| value which divides every cell by \marg{real number}. Arithmetics are carried out in floating point.
+ Appends code to the current |preproc cell content| value which divides every cell by \meta{real number}. Arithmetics are carried out in floating point.
\end{stylekey}
\begin{stylekey}{/pgfplots/table/sqrt}
- Appends code to the current |preproc cell content| value which applies $\sqrt{x}$ to every non-empty cell. Arithmetics are carried out in floating point.
+ Appends code to the current |preproc cell content| value which takes the square root $\sqrt{\cdot}$ of every non-empty cell. Arithmetics are carried out in floating point.
The following example copies the column |error1| and applies |sqrt| to the copy.
\begin{codeexample}[]
@@ -1742,11 +2061,11 @@ The preprocessing step allows to change cell contents \emph{before} any typesett
}
\pgfplotstabletypeset{pgfplotstable.example1.dat}
\end{codeexample}
- Please take a look at section~\ref{pgfplotstable:createcol} for details about |create on use|.
+ Please take a look at Section~\ref{pgfplotstable:createcol} for details about |create on use|.
\end{stylekey}
\begin{stylekey}{/pgfplots/table/multiply -1}
- Appends code to current |preproc cell content| value which multiplies every cell with $-1$. This style does the same job as |multiply with=-1|, it is just faster because only the sign changes.
+ Appends code to current |preproc cell content| value which multiplies every cell by $-1$. This style does the same job as |multiply by=-1|, it is just faster because only the sign changes.
\begin{codeexample}[]
\pgfplotstableset{
columns={dof,error2,slopes2},
@@ -1766,7 +2085,7 @@ The preprocessing step allows to change cell contents \emph{before} any typesett
A boolean predicate which allows to select particular rows of the input table, based on the current row's index. The argument |#1| contains the current row's index (starting with~$0$, not counting comment lines or column names).
The return value is assigned to the \TeX-if \declareandlabel{\ifpgfplotstableuserow}. If the boolean is not changed, the return value is true.
-\begin{codeexample}[narrow]
+\begin{codeexample}[newline=]
% requires \usepackage{booktabs}
\pgfplotstabletypeset[
every head row/.style={
@@ -1782,7 +2101,7 @@ The preprocessing step allows to change cell contents \emph{before} any typesett
]
{pgfplotstable.example1.dat}
\end{codeexample}
- Please note that |row predicate| is applied \emph{before} any other option which affects row (or column) appearance. It is evaluated before |assign cell content|. One of the consequences ist that even/odd row styles refer to those rows for which the predicate returns |true|. In fact, you can use |row predicate| to truncate the complete table before it has actually been processed.
+ Please note that |row predicate| is applied \emph{before} any other option which affects row (or column) appearance. It is evaluated before |assign cell content|. One of the consequences is that even/odd row styles refer to those rows for which the predicate returns |true|. In fact, you can use |row predicate| to truncate the complete table before it has actually been processed.
During |row predicate|, the macro |\pgfplotstablerows| contains the total number of \emph{input} rows.
@@ -1790,7 +2109,7 @@ The preprocessing step allows to change cell contents \emph{before} any typesett
\end{codekey}
\begin{stylekey}{/pgfplots/table/skip rows between index=\marg{begin}\marg{end}}
- A style which appends an |row predicate| which discards selected rows. The selection is done by index where indexing starts with~$0$. Every row with index $\meta{begin} \le i < \meta{end}$ will be skipped.
+ A style which appends a |row predicate| which discards selected rows. The selection is done by index where indexing starts with~$0$. Every row with index $\meta{begin} \le i < \meta{end}$ will be skipped.
\begin{codeexample}[narrow]
% requires \usepackage{booktabs}
\pgfplotstabletypeset[
@@ -1806,7 +2125,7 @@ The preprocessing step allows to change cell contents \emph{before} any typesett
\end{stylekey}
\begin{stylekey}{/pgfplots/table/select equal part entry of=\marg{part no}\marg{part count}}
- A style which overwrites |row predicate| with a subset selection predicate. The idea is to split the current column into \marg{part count} equally sized parts and select only \marg{part no}.
+ A style which overwrites |row predicate| with a subset selection predicate. The idea is to split the current column into \meta{part count} equally sized parts and select only \meta{part no}.
This can be used to simulate multicolumn tables.
\begin{codeexample}[]
@@ -1828,22 +2147,22 @@ The preprocessing step allows to change cell contents \emph{before} any typesett
\end{codeexample}
The example above shows the original file as-is on the left side. The right side shows columns A,B,A,B~-- but only half of the elements are shown, selected by indices \#0 or \#1 of \#2. The parts are equally large, up to a remainder.
- If the available number of rows is not dividable by \marg{part count}, the remaining entries are distributed equally among the first parts.
+ If the available number of rows is not divisible by \meta{part count}, the remaining entries are distributed equally among the first parts.
\end{stylekey}
\begin{stylekey}{/pgfplots/table/unique=\marg{column name}}
- A style which appends a |row predicate| which suppresses successive occurances of the same elements in \marg{column name}.
- For example, if \marg{column name} contains |1,1,3,5,5,6,5,0|, the application of |unique| results in |1,3,5,6,5,0| (the last |5| is kept -- it is not directly preceeded by another |5|).
+ A style which appends a |row predicate| which suppresses successive occurances of the same elements in \meta{column name}.
+ For example, if \meta{column name} contains |1,1,3,5,5,6,5,0|, the application of |unique| results in |1,3,5,6,5,0| (the last |5| is kept -- it is not directly preceded by another |5|).
- The algorithm uses string token comparison to find multiple occurances\footnote{To be more precise, the comparison is done using \texttt{\textbackslash ifx}, i.e. cell contents won't be expanded. Only the tokens as they are seen in the input table will be used.}.
+ The algorithm uses string token comparison to find multiple occurance\footnote{To be more precise, the comparison is done using \texttt{\textbackslash ifx}, i.e. cell contents won't be expanded. Only the tokens as they are seen in the input table will be used.}.
- The argument \marg{column name} can be a column name, index, alias, or |create on use| specification (the latter one must not depend on other |create on use| statements). It is not necessary to provide a \marg{column name} which is part of the output.
+ The argument \meta{column name} can be a column name, index, alias, or |create on use| specification (the latter one must not depend on other |create on use| statements). It is not necessary to provide a \meta{column name} which is part of the output.
However, it \emph{is} necessary that the |unique| predicate can be evaluated for all columns, starting with the first one. That means it is an error to provide |unique| somewhere deep in column--specific styles.
\end{stylekey}
\subsection{Postprocessing Cell Content}
-The postprocessing step is applied after the typesetting stage, that means it can't access the original input data. However, it can apply final formatting instructions which are not content based.
+The postprocessing step is applied after the typesetting stage, that means it can't access the original input data. However, it can apply final formatting instructions which are not content-based.
\begin{codekey}{/pgfplots/table/postproc cell content}
Allows to \emph{modify} assigned cell content \emph{after} it has been assigned, possibly content-dependent. Ideas could be to draw negative numbers in red, typeset single entries in bold face or insert replacement text.
@@ -1867,11 +2186,12 @@ The postprocessing step is applied after the typesetting stage, that means it ca
}]
{pgfplotstable.example1.dat}
\end{codeexample}
- The code above modifies |@cell content| in two steps. The net effect is to prepend ``|$\bf |'' and to append ``|$ \EUR|''. It should be noted that |pgfkeys| handles |/.style| and |/.code| in (quasi) the same way -- both are simple code keys and can be used as such. You can combine both with |/.append style| and |/.append code|. Please refer to~\cite[section about pgfkeys]{tikz} for details.
+ The code above modifies |@cell content| in two steps. The net effect is to prepend ``|$\bf |'' and to append ``|$ \EUR|''. It should be noted that |pgfkeys| handles |/.style| and |/.code| in (basically) the same way -- both are simple code keys and can be used as such. You can combine both with |/.append style| and |/.append code|. Please refer to~\cite[section about pgfkeys]{tikz} for details.
As in |assign cell content|, the code can evaluate helper macros like |\pgfplotstablerow| to change only particular entries. Furthermore, the postprocessor may depend on the unprocessed cell input (as it has been found in the input file or produced by the loading procedure) and/or the preprocessed cell value. These values are available as
\begin{itemize}
\item the key \declareandlabel{@unprocessed cell content} which stores the raw input,
+ \item the key \declareandlabel{@cell content after rowcol styles} which stores the value of |@cell content| after evaluating cell--specific styles,
\item the key \declareandlabel{@preprocessed cell content} which stores the result of the preprocessor,
\item the key \declareandlabel{@cell content} which contains the result of the typesetting routine,
\item the shorthand `|#1|' which is also the unprocessed input argument as it has been found in the input table.
@@ -1882,7 +2202,7 @@ The postprocessing step is applied after the typesetting stage, that means it ca
at any time.
- This allows complete context based formatting options. Please remember that empty strings may appear due to column balancing -- introduce special treatment if necessary.
+ This allows complete context-based formatting options. Please remember that empty strings may appear due to column balancing -- introduce special treatment if necessary.
There is one special case which occurs if |@cell content| itsself contains the cell separation character `|&|'. In this case, |postproc cell content| is invoked \emph{separately} for each part before and after the ampersand and the ampersand is inserted afterwards. This allows compatibility with special styles which create artificial columns in the output (which is allowed, see |dec sep align|). To allow separate treatment of each part, you can use the macro \declareandlabel{\pgfplotstablepartno}. It is defined only during the evaluation of |postproc cell content| and it evaluates to the current part index (starting with~$0$). If there is no ampersand in your text, the value will always be~$0$.
@@ -1910,19 +2230,19 @@ Since this may be useful in a more general context, it is available as |empty ce
\end{codekey}
\begin{stylekey}{/pgfplots/table/empty cells with=\marg{replacement}}
- Appends code to |postproc cell content| which replaces any empty cell with \marg{replacement}.
+ Appends code to |postproc cell content| which replaces any empty cell with \meta{replacement}.
If |dec sep align| is active, the replacement will be inserted only for the part before the decimal separator.
\end{stylekey}
\begin{stylekey}{/pgfplots/table/set content=\marg{content}}
- A style which redefines |postproc cell content| to always return the value \marg{content}.
+ A style which redefines |postproc cell content| to always return the value \meta{content}.
\end{stylekey}
\begin{stylekey}{/pgfplots/table/fonts by sign=\marg{\TeX\ code for positive}\marg{\TeX\ code for negative}}
Appends code to |postproc cell content| which allows to set fonts for positive and negative numbers.
- The arguments \meta{\TeX\ code for positive} and \meta{\TeX\ code for negative} are inserted right before the typesetted cell content. It is permissable to use both ways to change \LaTeX\ fonts: the |\textbf|\marg{argument} or the |{\bfseries |\marg{argument}|}| way.
+ The arguments \meta{\TeX\ code for positive} and \meta{\TeX\ code for negative} are inserted right before the typesetted cell content. It is permissible to use both ways to change \LaTeX\ fonts: the |\textbf|\marg{argument} or the |{\bfseries |\marg{argument}|}| way.
% \usepackage{pgfcalendar}
\begin{codeexample}[]
@@ -1969,9 +2289,9 @@ It is possible to create new tables from scratch or to change tables after they
Furthermore, there must be |create on use| statements (see the next subsection) for every
column which shall be generated\footnote{Currently, you need to provide at least one column: the implementation gets confused for completely empty tables. If you do not provide any column name, a dummy column will be created.}. Columns are generated
- independently, in the order of appearance in |columns|. As soon as a column is complete, it can be accessed using any of the basic level access mechanisms. Thus, you can built columns which depend on each other.
+ independently, in the order of appearance in |columns|. As soon as a column is complete, it can be accessed using any of the basic level access mechanisms. Thus, you can build columns which depend on each other.
- The table will contain exactly \marg{row count} rows. If \marg{row count} is an |\pgfplotstablegetrowsof| statement, that statement will be executed and the resulting number of rows be used. Otherwise, \marg{row count} will be evaluated as number.
+ The table will contain exactly \meta{row count} rows. If \meta{row count} is an |\pgfplotstablegetrowsof| statement, that statement will be executed and the resulting number of rows be used. Otherwise, \meta{row count} will be evaluated as number.
\begin{codeexample}[]
% this key setting could be provided in the document's preamble:
\pgfplotstableset{
@@ -1998,18 +2318,18 @@ It is possible to create new tables from scratch or to change tables after they
\begin{command}{\pgfplotstablevertcat\marg{\textbackslash table1}\marg{\textbackslash table2 or filename}}
\label{table:vertcat}
- Appends the contents of \marg{\textbackslash table2} to \marg{\textbackslash table1} (``vertical cat''). To be more precise, only columns which exist already in \marg{\textbackslash table1} will be appended and every column which exists in \marg{\textbackslash table1} must exist in \marg{\textbackslash table2} (or there must be |alias| or |create on use| specifications to generate them).
+ Appends the contents of \meta{\textbackslash table2} to \meta{\textbackslash table1} (``vertical concatenation''). To be more precise, only columns which exist already in \meta{\textbackslash table1} will be appended and every column which exists in \meta{\textbackslash table1} must exist in \meta{\textbackslash table2} (or there must be |alias| or |create on use| specifications to generate them).
If the second argument is a file name, that file will be loaded from disk.
- If \marg{\textbackslash table1} does not exist, \marg{\textbackslash table2} will be copied to \marg{\textbackslash table1}.
+ If \meta{\textbackslash table1} does not exist, \meta{\textbackslash table2} will be copied to \meta{\textbackslash table1}.
\begin{codeexample}[code only]
\pgfplotstablevertcat{\output}{datafile1} % loads `datafile1' -> `\output'
\pgfplotstablevertcat{\output}{datafile2} % appends rows of datafile2
\pgfplotstablevertcat{\output}{datafile3} % appends rows of datafile3
\end{codeexample}
- \paragraph{Remark:} The output table \marg{\textbackslash table1} will be defined in the current \TeX\ scope and it will be erased afterwards.
+ \paragraph{Remark:} The output table \meta{\textbackslash table1} will be defined in the current \TeX\ scope and it will be erased afterwards.
The current \TeX\ scope is delimited by an extra set of curly braces. However, every \LaTeX\ environment and, unfortunately, the \Tikz\ |\foreach| statement as well, introduce \TeX\ scopes.
\PGFPlots\ has some some loop statements which do not introduce extra scopes. For example,
@@ -2027,18 +2347,18 @@ It is possible to create new tables from scratch or to change tables after they
\subsection{Creating New Columns From Existing Ones}
\begin{command}{\pgfplotstablecreatecol\oarg{options}\marg{new col name}\marg{\textbackslash table}}
-Creates a new column named \marg{new col name} and appends it to an already existing table \marg{\textbackslash table}.
+Creates a new column named \meta{new col name} and appends it to an already existing table \meta{\textbackslash table}.
End users probably don't need to use |\pgfplotstablecreatecol| directly at all -- there is the high--level framework |create on use| which invokes it internally and can be used with simple key--value assignments (see below). However, this documentation explains how to use values of existing columns to fill new cells.
This command offers a flexible framework to generate new columns. It has been designed to create new columns using the already existing values -- for example using logical or numerical methods to combine existing values. It provides fast access to a row's value, the previous row's value and the next row's value.
-The following documentation is for all who want to \emph{write} specialised columns. It is not particularly difficult; it is just technical and it requires some knowledge of |pgfkeys|. If you don't like it, you can resort to predefined column generation styles - and enable those styles in \marg{options}.
+The following documentation is for everyone who wants to \emph{write} specialized columns. It is not particularly difficult; it is just technical and it requires some knowledge of |pgfkeys|. If you don't like it, you can resort to predefined column generation styles -- and enable those styles in \meta{options}.
The column entries will be created using the command key \pgfmanualpdflabel{/pgfplots/table/create col/assign}{\declaretext{create col/assign}}. It will be invoked for every row of the table.
It is supposed to assign contents to \pgfmanualpdflabel{/pgfplots/table/create col/next content}{\declaretext{create col/next content}}.
During the evaluation, the macro |\thisrow|\marg{col name}
-expands to the current row's value of the column identified by \marg{col name}.
+expands to the current row's value of the column identified by \meta{col name}.
Furthermore, |\nextrow|\marg{col name} expands to the \emph{next} row's
value of the designated column and |\prevrow|\marg{col name} expands to the value of the \emph{previous} row.
@@ -2052,7 +2372,7 @@ The following macros are useful during cell assignments:
\begin{enumerate}
\item \declareandlabel{\prevrow}\marg{col name} / \declareandlabel{\getprevrow}\marg{col name}\marg{\textbackslash macro}
- These two routines return the value stored in the \emph{previous} row of the designated column \marg{col name}. The |get| routine stores it into \meta{\textbackslash macro}.
+ These two routines return the value stored in the \emph{previous} row of the designated column \meta{col name}. The |get| routine stores it into \meta{\textbackslash macro}.
The argument \meta{col name} has to denote either an existing column name or one for which an |alias/|\meta{col name} exists.
@@ -2070,11 +2390,11 @@ The following macros are useful during cell assignments:
\item |\pgfplotstablerow| and |\pgfplotstablerows| which contain the current row's index and the total number of rows, respectively. See page~\pageref{pgfplotstable:page:tablerow} for details.
\item \declareandlabel{\pgfmathaccuma} and \declareandlabel{\pgfmathaccumb} can be used to transport intermediate results.
- Both maintain their value from one column assignment to the next. All other local variables will be deleted after leaving the assignment routines. The initial value is the empty string for both of them unless they are already initialised by column creation styles.
+ Both maintain their value from one column assignment to the next. All other local variables will be deleted after leaving the assignment routines. The initial value is the empty string for both of them unless they are already initialized by column creation styles.
\item \declareandlabel{\pgfplotstablename} a macro containing the name of the currently processed table (i.e.\ it contains the second argument of |\pgfplotstablecreatecol|).
\item commands which are valid throughout every part of this package, for example |\pgfplotstablerow| to get the current row index or |\pgfplotstablerows| to get the total number of rows.
\end{enumerate}
-The \marg{col name} is expected to be a \emph{physical} column name, no alias or column index is allowed (unless column indices and column names are the same).
+The \meta{col name} is expected to be a \emph{physical} column name, no alias or column index is allowed (unless column indices and column names are the same).
The following example takes our well-known input table and creates a copy of the |level| column. Furthermore, it produces a lot of output to show the available macros. Finally, it uses |\pgfkeyslet| to assign the contents of the resulting |\entry| to |next content|.
\begin{codeexample}[]
@@ -2096,7 +2416,7 @@ The following example takes our well-known input table and creates a copy of the
]\loadedtable
\end{codeexample}
-There is one more speciality: you can use |columns=|\marg{column list} to reduce the runtime complexity of this command. This works only if the |columns| key is provided directly into \marg{options}. In this case |\thisrow| and its variants are only defined for those columns listed in the |columns| value.
+There is one more specialty: you can use |columns=|\marg{column list} to reduce the runtime complexity of this command. This works only if the |columns| key is provided directly into \meta{options}. In this case |\thisrow| and its variants are only defined for those columns listed in the |columns| value.
\paragraph{Limitations.} Currently, you can only access three values of one column at a time: the current row, the previous row and the next row. Access to arbitrary indices is not (yet) supported.
@@ -2120,7 +2440,7 @@ The default implementation of |assign| is to produce empty strings. The default
columns/quot1/.style={dec sep align}]
{pgfplotstable.example1.dat}
\end{codeexample}
- The example above queries |quot1| which does not yet exist in the input file. Therefor, it is checked whether a |create on use| style for |quot1| exists. This is the case, so it is used to create the missing column. The |create col/quotient| key is discussed below; it computes quotients of successive rows in column |error1|.
+ The example above queries |quot1| which does not yet exist in the input file. Therefore, it is checked whether a |create on use| style for |quot1| exists. This is the case, so it is used to create the missing column. The |create col/quotient| key is discussed below; it computes quotients of successive rows in column |error1|.
A |create on use| specification is translated into
@@ -2130,7 +2450,7 @@ The default implementation of |assign| is to produce empty strings. The default
|\pgfplotstablecreatecol[|create on use/\meta{col name}|]|\marg{col name}\marg{the table}.
- This feature allows some lazyness, because you can omit the lengthy table modifications. However, lazyness may cost something: in the example above, the generated column will be \emph{lost} after returning from |\pgfplotstabletypeset|.
+ This feature allows some laziness, because you can omit the lengthy table modifications. However, laziness may cost something: in the example above, the generated column will be \emph{lost} after returning from |\pgfplotstabletypeset|.
The |create on use| has higher priority than |alias|.
@@ -2146,7 +2466,7 @@ The following keys can be used in both |\pgfplotstablecreatecol| and the easier
\subsubsection{Acquiring Data Somewhere}
\begin{stylekey}{/pgfplots/table/create col/set=\marg{value}}
- A style for use in column creation context which creates a new column and writes \marg{value} into each new cell. The value is written as string (verbatim).
+ A style for use in column creation context which creates a new column and writes \meta{value} into each new cell. The value is written as string (verbatim).
\begin{codeexample}[]
\pgfplotstableset{
create on use/my new col/.style={create col/set={--empty--}},
@@ -2160,9 +2480,9 @@ The following keys can be used in both |\pgfplotstablecreatecol| and the easier
\end{stylekey}
\begin{stylekey}{/pgfplots/table/create col/set list=\marg{comma-separated-list}}
- A style for use in column creation context which creates a new column consisting of the entries in \marg{comma-separated-list}. The value is written as string (verbatim).
+ A style for use in column creation context which creates a new column consisting of the entries in \meta{comma-separated-list}. The value is written as string (verbatim).
- The \marg{comma-separated-list} is processed via \Tikz's |\foreach| command, that means you can use |...| expressions to provide number (or character) ranges.
+ The \meta{comma-separated-list} is processed via \Tikz's |\foreach| command, that means you can use |...| expressions to provide number (or character) ranges.
\begin{codeexample}[]
\pgfplotstableset{
create on use/my new col/.style={
@@ -2178,7 +2498,7 @@ The following keys can be used in both |\pgfplotstablecreatecol| and the easier
\end{stylekey}
\begin{stylekey}{/pgfplots/table/create col/copy=\marg{column name}}
- A style for use in column creation context which simply copies the existing column \marg{column name}.
+ A style for use in column creation context which simply copies the existing column \meta{column name}.
\begin{codeexample}[]
\pgfplotstableset{
create on use/new/.style={create col/copy={level}}
@@ -2192,7 +2512,7 @@ The following keys can be used in both |\pgfplotstablecreatecol| and the easier
\end{stylekey}
\begin{stylekey}{/pgfplots/table/create col/copy column from table=\marg{file name or \textbackslash macro}\marg{column name}}
- A style for use in column creation context which creates a new column consisting of the entries in \marg{column name} of the provided table. The argument may be either a file name or an already loaded table (i.e. a \meta{\textbackslash macro} as returned by |\pgfplotstableread|).
+ A style for use in column creation context which creates a new column consisting of the entries in \meta{column name} of the provided table. The argument may be either a file name or an already loaded table (i.e. a \meta{\textbackslash macro} as returned by |\pgfplotstableread|).
You can use this style, possibly combined with |\pgfplotstablenew|, to merge one common sort of column from different tables into one large table.
@@ -2214,11 +2534,11 @@ The following keys can be used in both |\pgfplotstablecreatecol| and the easier
\begin{codeexample}[code only]
\pgfkeys{/pgf/fpu=true}
\end{codeexample}
- \noindent in order to activate the extended precision. The standard math parser is limited to fixed point numbers in the range $\pm 16384.00000$.
+ \noindent in order to activate the extended precision. The standard math parser is limited to fixed point numbers in the range of $\pm 16384.00000$.
\end{key}
\begin{stylekey}{/pgfplots/table/create col/expr=\marg{math expression}}
- A style for use in |\pgfplotstablecreatecol| which uses \marg{math expression} to assign contents for the new column.
+ A style for use in |\pgfplotstablecreatecol| which uses \meta{math expression} to assign contents for the new column.
\begin{codeexample}[]
\pgfplotstableset{
@@ -2235,18 +2555,18 @@ The following keys can be used in both |\pgfplotstablecreatecol| and the easier
Please see |\pgfplotstablecreatecol| for more information.
- \paragraph{Accumulated columns:} The |expr| style initialises |\pgfmathaccuma| to |0| before its first column. Whenever it computes a new column value, it redefines |\pgfmathaccuma| to be the result. That means you can use |\pgfmathaccuma| inside of \marg{math expression} to accumulate columns. See |create col/expr accum| for more details.
+ \paragraph{Accumulated columns:} The |expr| style initializes |\pgfmathaccuma| to |0| before its first column. Whenever it computes a new column value, it redefines |\pgfmathaccuma| to be the result. That means you can use |\pgfmathaccuma| inside of \meta{math expression} to accumulate columns. See |create col/expr accum| for more details.
\paragraph{About the precision and number range:}\index{Precision}\index{Floating Point Unit} Starting with version 1.2, |expr| uses a floating point unit. The FPU provides the full data range of scientific computing with a relative precision between $10^{-4}$ and $10^{-6}$. The |/pgf/fpu| key provides some more details.
\paragraph{Accepted operations:} The math parser of \PGF, combined with the FPU, provides the following function and operators:
- |+|, |-|, |*|, |/|, |abs|, |round|, |floor|, |mod|, |<|, |>|, |max|, |min|, |sin|, |cos|, |tan|, |deg| (conversion from radians to degrees), |rad| (conversion from degrees to radians), |atan|, |asin|, |acos|, |cot|, |sec|, |cosec|, |exp|, |ln|, |sqrt|, the constanst |pi| and |e|, |^| (power operation), |factorial|\footnote{Starting with \PGF\ versions newer than $2.00$, you can use the postfix operator \texttt{!} instead of \texttt{factorial}.}, |rand| (random between $-1$ and $1$), |rnd| (random between $0$ and $1$), number format conversions |hex|, |Hex|, |oct|, |bin| and some more. The math parser has been written by Mark Wibrow and Till Tantau~\cite{tikz}, the FPU routines have been developed as part of \PGFPlots. The documentation for both parts can be found in~\cite{tikz}. \textbf{Attention:} Trigonometric functions work with degrees, not with radians!
+ |+|, |-|, |*|, |/|, |abs|, |round|, |floor|, |mod|, |<|, |>|, |max|, |min|, |sin|, |cos|, |tan|, |deg| (conversion from radians to degrees), |rad| (conversion from degrees to radians), |atan|, |asin|, |acos|, |cot|, |sec|, |cosec|, |exp|, |ln|, |sqrt|, the constanst |pi| and |e|, |^| (power operation), |factorial|\footnote{Starting with \PGF\ versions newer than $2.00$, you can use the postfix operator \texttt{!} instead of \texttt{factorial}.}, |rand| (random between $-1$ and $1$ following a uniform distribution), |rnd| (random between $0$ and $1$ following a uniform distribution), number format conversions |hex|, |Hex|, |oct|, |bin| and some more. The math parser has been written by Mark Wibrow and Till Tantau~\cite{tikz}, the FPU routines have been developed as part of \PGFPlots. The documentation for both parts can be found in~\cite{tikz}. \textbf{Attention:} Trigonometric functions work with degrees, not with radians!
\end{stylekey}
\begin{stylekey}{/pgfplots/table/create col/expr accum=\marg{math expression}\marg{accum initial}}
- A variant of |create col/expr| which also allows to define the initial value of |\pgfmathaccuma|. The case \marg{accum initial}=|0| is \emph{equivalent} to |expr=|\marg{math expression}.
+ A variant of |create col/expr| which also allows to define the initial value of |\pgfmathaccuma|. The case \meta{accum initial}=|0| is \emph{equivalent} to |expr=|\marg{math expression}.
\begin{codeexample}[]
\pgfplotstableset{
@@ -2263,11 +2583,11 @@ The following keys can be used in both |\pgfplotstablecreatecol| and the easier
columns/new2/.style={column name=$\prod$level}
]{pgfplotstable.example1.dat}
\end{codeexample}
-The example creates two columns: the |new| column is just the sum of each value in the \meta{level} column (it employs the default |\pgfmathaccuma=0|). The |new2| column initialises |\pgfmathaccuma=100| and then successively subtracts the value of \meta{level}.
+The example creates two columns: the |new| column is just the sum of each value in the \meta{level} column (it employs the default |\pgfmathaccuma=0|). The |new2| column initializes |\pgfmathaccuma=100| and then successively subtracts the value of \meta{level}.
\end{stylekey}
\begin{stylekey}{/pgfplots/table/create col/quotient=\marg{column name}}
- A style for use in |\pgfplotstablecreatecol| which computes the quotient $c_i := m_{i-1} / m_i$ for every entry $i = 1,\dotsc, (n-1)$ in the column identified with \marg{column name}. The first value $c_0$ is kept empty.
+ A style for use in |\pgfplotstablecreatecol| which computes the quotient $c_i := m_{i-1} / m_i$ for every entry $i = 1,\dotsc, (n-1)$ in the column identified with \meta{column name}. The first value $c_0$ is kept empty.
\begin{codeexample}[]
% requires \usepackage{array}
@@ -2285,7 +2605,7 @@ The example creates two columns: the |new| column is just the sum of each value
\pgfplotstabletypeset{pgfplotstable.example1.dat}
\end{codeexample}
- This style employs methods of the floating point unit, that means it works with a relative precision of about $10^{-7}$ ($7$ significant digits in the mantisse).
+ This style employs methods of the floating point unit, that means it works with a relative precision of about $10^{-7}$ ($7$ significant digits in the mantissa).
\end{stylekey}
\begin{stylekey}{/pgfplots/table/create col/iquotient=\marg{column name}}
@@ -2293,7 +2613,7 @@ The example creates two columns: the |new| column is just the sum of each value
\end{stylekey}
\begin{stylekey}{/pgfplots/table/create col/dyadic refinement rate=\marg{column name}}
- A style for use in |\pgfplotstablecreatecol| which computes the convergence rate $\alpha$ of the data in column \marg{column name}. The contents of \marg{column name} is assumed to be something like $e_i(h_i) = O(h_i^\alpha)$. Assuming a dyadic refinement relation from one row to the next, $h_i = h_{i-1}/2$, we have $h_{i-1}^\alpha / (h_{i-1}/2)^\alpha = 2^\alpha$, so we get $\alpha$ using
+ A style for use in |\pgfplotstablecreatecol| which computes the convergence rate $\alpha$ of the data in column \meta{column name}. The contents of \meta{column name} is assumed to be something like $e_i(h_i) = O(h_i^\alpha)$. Assuming a dyadic refinement relation from one row to the next, $h_i = h_{i-1}/2$, we have $h_{i-1}^\alpha / (h_{i-1}/2)^\alpha = 2^\alpha$, so we get $\alpha$ using
\[ c_i := \log_2\left( \frac{e_{i-1}}{e_i} \right). \]
The first value $c_0$ is kept empty.
@@ -2309,7 +2629,7 @@ The example creates two columns: the |new| column is just the sum of each value
columns/rate2/.style={dec sep align}]
{pgfplotstable.example1.dat}
\end{codeexample}
- This style employs methods of the floating point unit, that means it works with a relative precision of about $10^{-6}$ ($6$ significant digits in the mantisse).
+ This style employs methods of the floating point unit, that means it works with a relative precision of about $10^{-6}$ ($6$ significant digits in the mantissa).
\end{stylekey}
\begin{stylekey}{/pgfplots/table/create col/idyadic refinement rate=\marg{column name}}
@@ -2321,9 +2641,9 @@ The example creates two columns: the |new| column is just the sum of each value
/pgfplots/table/create col/gradient loglog=\marg{col x}\marg{col y},
/pgfplots/table/create col/gradient semilogx=\marg{col x}\marg{col y},
/pgfplots/table/create col/gradient semilogy=\marg{col x}\marg{col y}}
- A style for |\pgfplotstablecreatecol| which computes piecewise gradients $(y_{i+1} - y_i) / (x_{i+1} - x_i )$ for each row. The $y$ values are taken out of column \marg{col y} and the $x$ values are taken from \marg{col y}.
+ A style for |\pgfplotstablecreatecol| which computes piecewise gradients $(y_{i+1} - y_i) / (x_{i+1} - x_i )$ for each row. The $y$ values are taken out of column \meta{col y} and the $x$ values are taken from \meta{col y}.
- The logarithmic variants apply the natural logarithm, $\log(\cdot)$, to its argument before starting to compute differences. More precisely, the |loglog| variant applies the logarithm to both, $x$ and $y$, the |semilogx| variant applies the logarithm only to~$x$ and the |semilogy| variant applies the logarithm only to~$y$.
+ The logarithmic variants apply the natural logarithm, $\log(\cdot)$, to its argument before starting to compute differences. More precisely, the |loglog| variant applies the logarithm to both $x$ and $y$, the |semilogx| variant applies the logarithm only to~$x$ and the |semilogy| variant applies the logarithm only to~$y$.
\begin{codeexample}[]
% requires \usepackage{array}
@@ -2353,7 +2673,7 @@ The example creates two columns: the |new| column is just the sum of each value
}
\pgfplotstabletypeset{pgfplotstable.example1.dat}
\end{codeexample}
- This style employs methods of the floating point unit, that means it works with a relative precision of about $10^{-6}$ ($6$ significant digits in the mantisse).
+ This style employs methods of the floating point unit, that means it works with a relative precision of about $10^{-6}$ ($6$ significant digits in the mantissa).
\end{keylist}
\begin{stylekey}{/pgfplots/table/create col/linear regression=\marg{key-value-config}}%
@@ -2361,14 +2681,14 @@ The example creates two columns: the |new| column is just the sum of each value
\begin{codeexample}[pre={\vbox\bgroup\hsize=3cm},post=\egroup]
% load table from somewhere:
-\pgfplotstableread[row sep=\\]{
- x y\\
- 1 1 \\
- 2 4\\
- 3 9\\
- 4 16\\
- 5 25\\
- 6 36\\
+\pgfplotstableread{
+ x y
+ 1 1
+ 2 4
+ 3 9
+ 4 16
+ 5 25
+ 6 36
}\loadedtbl
% create the `regression' column:
@@ -2388,7 +2708,7 @@ The slope is `\slope'.
\end{stylekey}
\begin{stylekey}{/pgfplots/table/create col/function graph cut y=\marg{cut value}\marg{common options}\marg{one key-value set for each plot}}
- A specialized style for use in |create on use| statements which computes cuts of (one or more) discrete plots $y(x_1), \dotsc, y(x_N)$ with a fixed \marg{cut value}. The $x_i$ are written into the table's cells.
+ A specialized style for use in |create on use| statements which computes cuts of (one or more) discrete plots $y(x_1), \dotsc, y(x_N)$ with a fixed \meta{cut value}. The $x_i$ are written into the table's cells.
In a cost--accuracy plot, this feature allows to extract the cost for fixed accuracy. The dual feature with |cut x| allows to compute the accuracy for fixed cost.
@@ -2419,9 +2739,9 @@ The slope is `\slope'.
\end{tikzpicture}
\end{codeexample}
In the example above, we are searching for $x_1$ and $x_2$ such that $f_1(x_1) = \pgfmathprintnumber{2.5e-4}$ and $f_2(x_2) =\pgfmathprintnumber{2.5e-4}$. On the left is the automatically computed result. On the right is a problem illustration with proper annotation using \PGFPlots\ to visualize the results.
- The \marg{cut value} is set to |2.5e-4|. The \marg{common options} contain the problem setup; in our case logarithmic scales and column names. The third argument is a comma-separated-list. Each element $i$ is a set of keys describing how to get $f_i(\cdot)$.
+ The \meta{cut value} is set to |2.5e-4|. The \meta{common options} contain the problem setup; in our case logarithmic scales and column names. The third argument is a comma-separated-list. Each element $i$ is a set of keys describing how to get $f_i(\cdot)$.
- During both, \marg{common options} and \marg{one key-value set for each plot}, the following keys can be used:
+ During both \meta{common options} and \meta{one key-value set for each plot}, the following keys can be used:
\begin{itemize}
\item \declareandlabel{table}|=|\marg{table file or \textbackslash macro}: either a file name or an already loaded table where to get the data points,
\item \declareandlabel{x}|=|\marg{col name}: the column name of the $x$ axis,
@@ -2444,13 +2764,13 @@ The slope is `\slope'.
% Show the data:
\pgfplotstabletypeset{\loadedtable}
\end{codeexample}
- \PGFPlotstable\ will call |\foreach |\meta{\textbackslash foreach loop head} and it will expand \marg{file name pattern} for every iteration. For every iteration, a simpler list entry of the form
+ \PGFPlotstable\ will call |\foreach |\meta{\textbackslash foreach loop head} and it will expand \meta{file name pattern} for every iteration. For every iteration, a simpler list entry of the form
|table=|\marg{expanded pattern}|,x=|\marg{value of x}|,y=|\marg{value of y}
will be generated.
- It is also possible to provide |foreach=| inside of \marg{one key-value set for each plot}. The |foreach| key takes precedence over |table|. Details about the accepted syntax of |\foreach| can be found in the \pgfname\ manual.
+ It is also possible to provide |foreach=| inside of \meta{one key-value set for each plot}. The |foreach| key takes precedence over |table|. Details about the accepted syntax of |\foreach| can be found in the \pgfname\ manual.
\end{itemize}
The keys \declareandlabel{xmode} and \declareandlabel{ymode} can take either |log| or |linear|. All mentioned keys have the common key path
@@ -2463,7 +2783,7 @@ The slope is `\slope'.
\section{Miscellaneous}
\subsection{Writing (Modified) Tables To Disk}
\begin{key}{/pgfplots/table/outfile=\marg{file name} (initially empty)}
- Writes the completely processed table as \TeX\ file to \marg{file name}. This key is described in all detail on page~\pageref{page:outfile}.
+ Writes the completely processed table as \TeX\ file to \meta{file name}. This key is described in all detail on page~\pageref{page:outfile}.
\end{key}
\begin{command}{\pgfplotstablesave\oarg{options}\marg{\textbackslash macro or input file name}\marg{output file name}}
@@ -2475,7 +2795,7 @@ The slope is `\slope'.
|\pgfplotstablesave| uses the keys |reset styles| and |disable rowcol styles| to clear any typesetting related options.
- Furthermore, it sets |string type| to allow verbatim output. You may want to use |numeric as string type| instead in case you only have numerical data -- this will display integers resulting from arithmetics not in scientific notation\footnote{Note however, that |string type| doesn't round or truncate integers as well, even though they are displayed as floats.}.
+ Furthermore, it sets |string type| to allow verbatim output. You may want to use |numeric as string type| instead in case you only have numerical data -- this will display integers resulting from arithmetics not in scientific notation\footnote{Note however, that \texttt{string type} does not round or truncate integers either, even though they are displayed as floats.}.
\begin{codeexample}[]
\pgfplotstablesave[
create on use/postproc1/.style={create col/dyadic refinement rate=error1},
@@ -2525,15 +2845,15 @@ Empty cells will be filled with |{}| if |col sep=space|. Use the |empty cells wi
\subsection{A summary of how to define and use styles and keys}
This section summarizes features of |pgfkeys|. The complete documentation can be found in the \pgfname\ manual,~\cite{tikz}.
\begin{handler}{{.style}=\marg{key-value-list}}
- Defines or redefines a style \meta{key}. A style is a normal key which will set all options in \marg{key-value-list} when it is set.
+ Defines or redefines a style \meta{key}. A style is a normal key which will set all options in \meta{key-value-list} when it is set.
- Use |\pgfplotstableset{|\meta{key}|/.style={|\meta{key-value-list}|}}| to (re-) define a style \meta{key} in the namespace |/pgfplots/table|.
+ Use |\pgfplotstableset{|\meta{key}|/.style={|\meta{key-value-list}|}}| to (re)define a style \meta{key} in the namespace |/pgfplots/table|.
\end{handler}
\begin{handler}{{.append style}=\marg{key-value-list}}
- Appends \marg{key-value-list} to an already existing style \meta{key}. This is the preferred method to change the predefined styles: if you only append, you maintain compatibility with future versions.
+ Appends \meta{key-value-list} to an already existing style \meta{key}. This is the preferred method to change the predefined styles: if you only append, you maintain compatibility with future versions.
- Use |\pgfplotstableset{|\meta{key}|/.append style={|\meta{key-value-list}|}}| to append \marg{key-value-list} to the style \meta{key}. This will assume the prefix |/pgfplots/table|.
+ Use |\pgfplotstableset{|\meta{key}|/.append style={|\meta{key-value-list}|}}| to append \meta{key-value-list} to the style \meta{key}. This will assume the prefix |/pgfplots/table|.
\end{handler}
\begin{handler}{{.initial}=\marg{value}}
@@ -2554,7 +2874,7 @@ This section summarizes features of |pgfkeys|. The complete documentation can be
\end{handler}
\begin{handler}{{.code}=\marg{\TeX\ code}}
- Occasionally, the \PGFPlots\ user interface offers to replace parts of its routines. This is accomplished using so called ``code keys''. What it means is to replace the original key and its behavior with new \marg{\TeX\ code}. Inside of \marg{\TeX\ code}, any command can be used. Furthermore, the |#1| pattern will be the argument provided to the key.
+ Occasionally, the \PGFPlots\ user interface offers to replace parts of its routines. This is accomplished using so called ``code keys''. What it means is to replace the original key and its behavior with new \meta{\TeX\ code}. Inside of \meta{\TeX\ code}, any command can be used. Furthermore, the |#1| pattern will be the argument provided to the key.
\begin{codeexample}[]
\pgfplotsset{
@@ -2565,7 +2885,7 @@ This section summarizes features of |pgfkeys|. The complete documentation can be
\end{handler}
\begin{handler}{{.append code}=\marg{\TeX\ code}}
- Appends \marg{\TeX\ code} to an already existing |/.code| key named \meta{key}.
+ Appends \meta{\TeX\ code} to an already existing |/.code| key named \meta{key}.
\end{handler}
@@ -2576,17 +2896,17 @@ This section summarizes features of |pgfkeys|. The complete documentation can be
\subsection{Plain \TeX\ and Con\TeX t support}
\label{sec:pgfplotstable:context}
-The table code generator is initialised to produce \LaTeX\ |tabular| environments. However, it only relies on~`|&|' being the column separator and~`|\\|' the row terminator. The |column type| feature is more or less specific to |tabular|, but you can disable it completely. Replace |begin table| and |end table| with appropriate \TeX- or Con\TeX t commands to change it. If you have useful default styles (or bug reports), let me know.
+The table code generator is initialized to produce \LaTeX\ |tabular| environments. However, it only relies on~`|&|' being the column separator and~`|\\|' the row terminator. The |column type| feature is more or less specific to |tabular|, but you can disable it completely. Replace |begin table| and |end table| with appropriate \TeX- or Con\TeX t commands to change it. If you have useful default styles (or bug reports), let me know.
\subsection{Basic Level Table Access and Modification}
\PGFPlotstable\ provides several methods to access and manipulate tables at an elementary level.
-Please keep in mind that \PGFPlotstable\ has been written as tool for table visualization. As such, it has been optimized for the case of relatively few rows (although it may have a lot of columns). The runtime for table creation and modification is currently $O(N^2)$ where $N$ is the number of rows\footnote{The runtime for \texttt{plot table} is linear in the number of rows using a special routine.}. This is completely acceptable for tables with few rows because \TeX\ can handle those structures relatively fast. Keep your tables small! \PGFPlotstable\ is \emph{not} a tool for large-scale matrix operations.
+Please keep in mind that \PGFPlotstable\ has been written as a tool for table visualization. As such, it has been optimized for the case of relatively few rows (although it may have a lot of columns). The runtime for table creation and modification is currently $O(N^2)$ where $N$ is the number of rows\footnote{The runtime for \texttt{plot table} is linear in the number of rows using a special routine.}. This is completely acceptable for tables with few rows because \TeX\ can process those structures relatively fast. Keep your tables small! \PGFPlotstable\ is \emph{not} a tool for large-scale matrix operations.
Tables are always stored as a sequence of column vectors. Therefore, iteration over all values in one column is simple whereas iteration over all values in one row is complicated and expensive.
\begin{command}{\pgfplotstableforeachcolumn\meta{table}\textbackslash as\marg{\textbackslash macro}\marg{code}}
- Iterates over every column name of \meta{table}. The \meta{\textbackslash macro} will be set to the currently visited column name. Then, \marg{code} will be executed. During \marg{code}, |\pgfplotstablecol| denotes the current column index (starting with 0).
+ Iterates over every column name of \meta{table}. The \meta{\textbackslash macro} will be set to the currently visited column name. Then, \meta{code} will be executed. During \meta{code}, |\pgfplotstablecol| denotes the current column index (starting with 0).
\begin{codeexample}[]
\begin{minipage}{0.8\linewidth}
\pgfplotstableread{pgfplotstable.example1.dat}\loadedtable
@@ -2596,13 +2916,13 @@ Tables are always stored as a sequence of column vectors. Therefore, iteration o
\end{minipage}
\end{codeexample}
- This routine does not introduce \TeX\ groups, variables inside of \marg{code} are not scoped.
+ This routine does not introduce \TeX\ groups, variables inside of \meta{code} are not scoped.
\end{command}
\begin{command}{\pgfplotstableforeachcolumnelement\meta{column name}\textbackslash of\meta{table}\textbackslash as\meta{\textbackslash cellcontent}\marg{code}}
Reports every table cell $t_{ij}$ for a fixed column $j$ in read-only mode.
- For every cell in the column named \meta{column name}, \marg{code} will be executed. During this invocation, the macro \meta{\textbackslash cellcontent} will contain the cell's content and |\pgfplotstablerow| will contain the current row's index.
+ For every cell in the column named \meta{column name}, \meta{code} will be executed. During this invocation, the macro \meta{\textbackslash cellcontent} will contain the cell's content and |\pgfplotstablerow| will contain the current row's index.
\begin{codeexample}[]
\begin{minipage}{0.8\linewidth}
\pgfplotstableread{pgfplotstable.example1.dat}\loadedtable
@@ -2611,14 +2931,14 @@ Tables are always stored as a sequence of column vectors. Therefore, iteration o
}
\end{minipage}
\end{codeexample}
- The argument \meta{column name} can also be a column index. In that case, it should contain |[index]|\meta{integer}, for example |[index]4|. Furthermore, column aliases and column which should be generated on-the-fly (see |create on use|) can be used for \meta{column name}.
+ The argument \meta{column name} can also be a column index. In that case, it should contain |[index]|\meta{integer}, for example |[index]4|. Furthermore, column aliases and columns which should be generated on-the-fly (see |create on use|) can be used for \meta{column name}.
- This routine does not introduce \TeX\ groups, variables inside of \marg{code} are not scoped.
+ This routine does not introduce \TeX\ groups, variables inside of \meta{code} are not scoped.
\end{command}
\begin{command}{\pgfplotstablemodifyeachcolumnelement\meta{column name}\textbackslash of\meta{table}\textbackslash as\meta{\textbackslash cellcontent}\marg{code}}
A routine which is similar to |\pgfplotstableforeachcolumnelement|,
- but any changes of \meta{\textbackslash cellcontent} which might occur during \marg{code} will be written back into the respective cell.
+ but any changes of \meta{\textbackslash cellcontent} which might occur during \meta{code} will be written back into the respective cell.
\begin{codeexample}[]
\pgfplotstableread{pgfplotstable.example1.dat}\loadedtable
@@ -2628,11 +2948,11 @@ Tables are always stored as a sequence of column vectors. Therefore, iteration o
\pgfplotstabletypeset[columns=error1,string type]{\loadedtable}
\end{codeexample}
- If \marg{column name} is a column alias or has been created on-the-fly, a new column named \meta{column name} will be created.
+ If \meta{column name} is a column alias or has been created on-the-fly, a new column named \meta{column name} will be created.
\end{command}
\begin{command}{\pgfplotstablegetelem\marg{row}\marg{col}\textbackslash of\meta{table}}
- Selects a single table element at row \marg{row} and column \marg{col}. The second argument has the same format as that described in the last paragraph: it should be a column name or a column index (in which case it needs to be written as |[index]|\meta{number}).
+ Selects a single table element at row \meta{row} and column \meta{col}. The second argument has the same format as that described in the last paragraph: it should be a column name or a column index (in which case it needs to be written as |[index]|\meta{number}).
The return value will be written to |\pgfplotsretval|.
\begin{codeexample}[]
@@ -2659,16 +2979,16 @@ The value (2,0) is `\pgfplotsretval'.
\end{command}
\begin{command}{\pgfplotstablenew\oarg{options}\marg{row count}\marg{\textbackslash table}}
- See section~\ref{pgfplotstable:createcol} for details about this command.
+ See Section~\ref{pgfplotstable:createcol} for details about this command.
\end{command}
\begin{command}{\pgfplotstablecreatecol\oarg{options}\marg{row count}\marg{\textbackslash table}}
- See section~\ref{pgfplotstable:createcol} for details about this command.
+ See Section~\ref{pgfplotstable:createcol} for details about this command.
\end{command}
\begin{commandlist}{%
\pgfplotstabletranspose\oarg{options}\marg{\textbackslash outtable}\marg{\textbackslash table or filename},%
\pgfplotstabletranspose*\oarg{options}\marg{\textbackslash outtable}\marg{\textbackslash table or filename}}%
- Defines \meta{\textbackslash outtable} to be the transposed of \marg{\textbackslash table of filename}. The input argument can be either a file name or an already loaded table.
+ Defines \meta{\textbackslash outtable} to be the transposed of \meta{\textbackslash table of filename}. The input argument can be either a file name or an already loaded table.
The version with `|*|' is only interesting in conjunction with the |columns| option, see below.
@@ -2685,14 +3005,14 @@ The value (2,0) is `\pgfplotsretval'.
\begin{pgfplotskey}{table/colnames from=\marg{colname} (initially empty)}
Inside of |\pgfplotstabletranspose|, this key handles how to define output column names.
- If \marg{colname} \emph{is} empty (the initial value), the output column names will simply be the old row indices, starting with~$0$.
+ If \meta{colname} \emph{is} empty (the initial value), the output column names will simply be the old row indices, starting with~$0$.
- If \marg{colname} is not empty, it denotes an input column name whose cell values will make up the output column names:
+ If \meta{colname} is not empty, it denotes an input column name whose cell values will make up the output column names:
\begin{codeexample}[]
\pgfplotstabletranspose[colnames from=c]\loadedtable{pgfplotstable.example3.dat}
\pgfplotstabletypeset[string type]\loadedtable
\end{codeexample}
- The argument \meta{colname} won't appear as cell contents. It is an error if the the cells in \meta{colname} don't yield unique column names.
+ The argument \meta{colname} won't appear as cell contents. It is an error if the cells in \meta{colname} don't yield unique column names.
\end{pgfplotskey}
\begin{pgfplotskey}{table/input colnames to=\marg{name} (initially colnames)}
@@ -2731,18 +3051,18 @@ The value (2,0) is `\pgfplotsretval'.
Use the high level |sort| key to enable sorting automatically during |\pgfplotstabletypeset|.
\begin{codeexample}[]
-\pgfplotstablesort[row sep=\\]\result{%
- a b c \\
- 19 2 [a]\\
- -6 -14 [b]\\
- 4 -14 [c]\\
- -11 -9 [d]\\
- 11 14 [e]\\
- -9 -9 [f]\\
- 1 13 [g]\\
- 8 -10 [h]\\
- 16 18 [i]\\
- 19 -6 [j]\\
+\pgfplotstablesort\result{%
+ a b c
+ 19 2 [a]
+ -6 -14 [b]
+ 4 -14 [c]
+ -11 -9 [d]
+ 11 14 [e]
+ -9 -9 [f]
+ 1 13 [g]
+ 8 -10 [h]
+ 16 18 [i]
+ 19 -6 [j]
}
\pgfplotstabletypeset[columns/c/.style={string type}]{\result}%
\end{codeexample}
@@ -2768,28 +3088,28 @@ The value (2,0) is `\pgfplotsretval'.
date >,
string <,
string >}
- These styles constitute the predefined comparison functions. The |fixed <|, |int <| and |float <| routines operate on numerical data where |int <| expects positive or negative integers and the other two expect real numbers. The |fixed <| has considerably smaller number range but is slightly faster than |float <|.
+ These styles constitute the predefined comparison functions. The |fixed <|, |int <| and |float <| routines operate on numerical data where |int <| expects positive or negative integers and the other two expect real numbers. The |fixed <| has a considerably smaller number range, but is slightly faster than |float <|.
The |date <| compares dates of the form |YYYY-MM-DD|. The |string <| uses lexicographical string comparison based on the ASCII character codes of the sort keys. The |string <| routine also evaluates ASCII codes of control sequences or active characters\footnote{As long as they haven't been consumed by \TeX's preprocessing.}.
\begin{codeexample}[]
-\pgfplotstablesort[row sep=\\,sort cmp=string <]\result{%
- Header:\\% the column name
- the\\
- quick\\
- brown\\
- fox\\
- jumps\\
- over\\
- the\\
- lazy\\
- dog\\
+\pgfplotstablesort[sort cmp=string <]\result{% 'Header' is the column name:
+ Header
+ the
+ quick
+ brown
+ fox
+ jumps
+ over
+ the
+ lazy
+ dog
}
\pgfplotstabletypeset[string type]{\result}%
\end{codeexample}
\end{pgfplotskeylist}
\begin{codeargskey}{/pgfplots/iflessthan}{#1#2#3#4}
Allows to define custom comparison functions (a strict ordering). It compares |#1 < #2| and invokes |#3| in case the comparison is true and |#4| if not.
- The comparison will be evaluated in local scopes (local variables are freed afterwise).
+ The comparison will be evaluated in local scopes (local variables are freed afterwards).
\end{codeargskey}
\end{key}
\end{command}
@@ -2812,7 +3132,7 @@ The value (2,0) is `\pgfplotsretval'.
The following \PGFPlots\ looping macros are an alternative.
\begin{command}{\pgfplotsforeachungrouped \meta{variable} |in| \meta{list} \marg{command}}
- A specialised variant of |\foreach| which can do two things: it does not introduce extra groups while executing \meta{command} and it allows to invoke the math parser for (simple!) \meta{$x_0$}|,|\meta{$x_1$}|,...,|\meta{$x_n$} expressions.
+ A specialized variant of |\foreach| which can do two things: it does not introduce extra groups while executing \meta{command} and it allows to invoke the math parser for (simple!) \meta{$x_0$}|,|\meta{$x_1$}|,...,|\meta{$x_n$} expressions.
\begin{codeexample}[]
\def\allcollected{}
@@ -2835,13 +3155,13 @@ All collected = \allcollected.
\end{command}
\begin{command}{\pgfplotsinvokeforeach\marg{list} \marg{command}}
- A variant of |\pgfplotsforeachungrouped| (and such also of |\foreach|) which replaces any occurence of |#1| inside of \meta{command} once for every element in \meta{list}. Thus, it actually assumes that \marg{command} is like a |\newcommand| body.
+ A variant of |\pgfplotsforeachungrouped| (and such also of |\foreach|) which replaces any occurence of |#1| inside of \meta{command} once for every element in \meta{list}. Thus, it actually assumes that \meta{command} is like a |\newcommand| body.
- In other words, \marg{command} is invoked for every element of \marg{list}. The actual element of \marg{list} is available as |#1|.
+ In other words, \meta{command} is invoked for every element of \meta{list}. The actual element of \meta{list} is available as |#1|.
As |\pgfplotsforeachungrouped|, this command does \emph{not} introduce extra scopes (i.e.\ it is ungrouped as well).
- The difference to |\foreach \x in |\meta{list}\marg{command} is subtle: the |\x| would \emph{not} be expanded wheres |#1| is.
+ The difference to |\foreach \x in |\meta{list}\marg{command} is subtle: the |\x| would \emph{not} be expanded whereas |#1| is.
\begin{codeexample}[]
\pgfkeys{
otherstyle a/.code={[a]},
@@ -2852,7 +3172,7 @@ All collected = \allcollected.
{\pgfkeys{key #1/.style={otherstyle #1}}}
Invoke them: \pgfkeys{key a} \pgfkeys{key b} \pgfkeys{key c} \pgfkeys{key d}
\end{codeexample}
-The counter example would use a macro (here |\x|) as loop argument:
+The counterexample would use a macro (here |\x|) as loop argument:
\begin{codeexample}[]
\pgfkeys{
otherstyle a/.code={[a]},
@@ -2864,10 +3184,11 @@ The counter example would use a macro (here |\x|) as loop argument:
Invoke them: \pgfkeys{key a} \pgfkeys{key b} \pgfkeys{key c} \pgfkeys{key d}
\end{codeexample}
- \paragraph{Restrictions:} you can't nest this command yet (since it does not introduce protection by scopes).
+ \paragraph{Restrictions:} You cannot nest this command yet (since it does not introduce protection by scopes).
\end{command}
\printindex
\bibliographystyle{abbrv} %gerapali} %gerabbrv} %gerunsrt.bst} %gerabbrv}% gerplain}
\bibliography{pgfplots}
\end{document}
+% vi: spell spelllang=en