diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.linefitting.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.linefitting.tex | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.linefitting.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.linefitting.tex index cd4cba421a5..1264ce8fc62 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.linefitting.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.linefitting.tex @@ -21,25 +21,25 @@ This section documents the attempts of \PGFPlots\ to fit lines to input coordina \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[legend pos=outer north east] - \addplot table[row sep=\\] {% plot X versus Y. This is original data. - X Y\\ - 1 1 \\ - 2 4\\ - 3 9\\ - 4 16\\ - 5 25\\ - 6 36\\ + \addplot table {% plot X versus Y. This is original data. + X Y + 1 1 + 2 4 + 3 9 + 4 16 + 5 25 + 6 36 }; - \addplot table[row sep=\\, + \addplot table[ y={create col/linear regression={y=Y}}] % compute a linear regression from the input table { - X Y\\ - 1 1 \\ - 2 4\\ - 3 9\\ - 4 16\\ - 5 25\\ - 6 36\\ + X Y + 1 1 + 2 4 + 3 9 + 4 16 + 5 25 + 6 36 }; %\xdef\slope{\pgfplotstableregressiona} %<-- might be handy occasionally \addlegendentry{$y(x)$} @@ -50,7 +50,7 @@ This section documents the attempts of \PGFPlots\ to fit lines to input coordina \end{tikzpicture} \end{codeexample} The example above has two plots: one showing the data and one containing the |linear regression| line. We use |y={create col/linear regression={}}| here, which means to create a new column\footnote{The \texttt{y=\{create col/} feature is available for any other \PGFPlotstable\ postprocessing style, see the \texttt{create on use} documentation in the \PGFPlotstable\ manual.} containing the regression values automatically. - As arguments, we need to provide the $y$ column name explicitly\footnote{In fact, \PGFPlots\ sees that there are only two columns and uses the second as default. But you need to provide it if there are at least 3 columns.}. The $x$ value is determined from context: |linear regression| is evaluated inside of |\addplot table|, so it uses the same $x$ as |\addplot table| (i.e.\ if you write |\addplot table[x=|\marg{col name}|]|, the regression will also use \marg{col name} as its |x| input). Furthermore, it shows the line parameters $a$ and $b$ in the legend. + As arguments, we need to provide the $y$ column name explicitly\footnote{In fact, \PGFPlots\ sees that there are only two columns and uses the second by default. But you need to provide it if there are at least 3 columns.}. The $x$ value is determined from context: |linear regression| is evaluated inside of |\addplot table|, so it uses the same $x$ as |\addplot table| (i.e.\ if you write |\addplot table[x=|\marg{col name}|]|, the regression will also use \meta{col name} as its |x| input). Furthermore, it shows the line parameters $a$ and $b$ in the legend. @@ -63,7 +63,7 @@ This section documents the attempts of \PGFPlots\ to fit lines to input coordina \begin{keylist}{% /pgfplots/table/create col/linear regression/x=\marg{column} (initially empty), /pgfplots/table/create col/linear regression/y=\marg{column} (initially empty)} - Provides the source of $x_i$ and $y_i$ data, respectively. The argument \meta{column} is usually a column name of the input table, yet it can also contains |[index]|\meta{integer} to designate column indizes (starting with $0$), |create on use| specifications or |alias|es (see the \PGFPlotstable\ manual for details on |create on use| and |alias|). + Provides the source of $x_i$ and $y_i$ data, respectively. The argument \meta{column} is usually a column name of the input table, yet it can also contain |[index]|\meta{integer} to designate column indices (starting with $0$), |create on use| specifications or |alias|es (see the \PGFPlotstable\ manual for details on |create on use| and |alias|). The initial configuration (an empty value) checks the context where the |linear regression| is evaluated. If it is evaluated inside of |\pgfplotstabletypeset|, it uses the first and second table columns. If it is evaluated inside of |\addplot table|, it uses the same $x$ input as the |\addplot table| statement. The |y| key needs to be provided explicitly (unless the table has only two columns). \end{keylist} |