summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pgfplots/manual.reference.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/pgfplots/manual.reference.tex')
-rw-r--r--Master/texmf-dist/doc/latex/pgfplots/manual.reference.tex157
1 files changed, 143 insertions, 14 deletions
diff --git a/Master/texmf-dist/doc/latex/pgfplots/manual.reference.tex b/Master/texmf-dist/doc/latex/pgfplots/manual.reference.tex
index c1bd4fea5e2..5cb97da2080 100644
--- a/Master/texmf-dist/doc/latex/pgfplots/manual.reference.tex
+++ b/Master/texmf-dist/doc/latex/pgfplots/manual.reference.tex
@@ -265,13 +265,17 @@ where each legend element needs to be terminated by \lstinline!\\!. If \texttt{L
\subsubsection{Legend appearance}
The style ``\texttt{every axis legend}'' determines the legend's position and outer appearance:
\begin{lstlisting}
-\tikzstyle{every axis legend}+=[at={(0,0)}]
+\tikzstyle{every axis legend}+=[
+ at={(0,0)},
+ anchor=south west]
\end{lstlisting}
will draw it at the lower left corner of the axis while
\begin{lstlisting}
-\tikzstyle{every axis legend}+=[at={(1,1)}]
+\tikzstyle{every axis legend}+=[
+ at={(1,1)},
+ anchor=north east]
\end{lstlisting}
-means the upper right corner.
+means the upper right corner. The `\texttt{anchor}' option determines which point \emph{of the legend} will be placed at $(0,0)$ or $(1,1)$ (see below for more examples).
The legend is a node, so you can use any \Tikz\ option which affects
nodes (see~\cite[section~13]{tikz}). The node's option ``\texttt{text width}'' is set automatically, depending on the \lstinline!\legend[textwidth=...]! option.
@@ -280,13 +284,17 @@ Examples:
\begin{itemize}
\item
\begin{lstlisting}
-\tikzstyle{every axis legend}+=[at={(1.02,1)},anchor=north west]
+\tikzstyle{every axis legend}+=[
+ at={(1.02,1)},
+ anchor=north west]
\end{lstlisting}
draws the legend OUTSIDE TOP RIGHT.
\item
\begin{lstlisting}
-\tikzstyle{every axis legend}+=[at={(1,0.5)},anchor=east,outer sep=0.5cm]
+\tikzstyle{every axis legend}+=[
+ at={(1,0.5)},
+ anchor=east,outer sep=0.5cm]
\end{lstlisting}
draws the legend INSIDE MIDDLE RIGHT, separated by 0.5cm from the axis.
\end{itemize}
@@ -351,11 +359,38 @@ There are several possiblities to change it:
Please note that the `\lstinline!\\!' is required to separate each element. Please note that comment characters~`\%' are necessary if the elements are on different lines.
\subsection{\texttt{\textbackslash logtologten\{ARG\}}}
-Expands to the result of $\texttt{ARG}/\log(10)$.
+Expands to the result of $\texttt{ARG}/\log(10)$. You can also use
+\begin{lstlisting}
+\logtologtentomacro{9.5}{\result}
+\end{lstlisting}
+and \lstinline!\result! will be filled with the result.
\subsection{\texttt{\textbackslash logten}}
Expands to the constant $\log(10)$. Useful for logplots because $\log(10^i) = i\log(10)$.
+\subsection{\texttt{\textbackslash prettyprintnumber\{NUM\}}}
+Allows to generate pretty--printed output for the number \texttt{NUM}. Examples:
+\begin{lstlisting}
+\prettyprintnumber{1.0}
+
+\prettyprintnumber{151.015341}
+
+\prettyprintnumber{90.99999}
+\end{lstlisting}
+results in
+
+\prettyprintnumber{1.0},
+
+\prettyprintnumber{151.015341},
+
+\prettyprintnumber{90.99999}.
+
+It is used to display axis ticks. The default rounding precision is defined by
+\begin{lstlisting}
+\def\prettyprintnumberprecision{2}
+\end{lstlisting}
+and can be reconfigured if needed (the highest precision is~$5$ due to \TeX's restricted numerical capabilities).
+
\subsection{\texttt{\textbackslash axispreset\{key=value,key=value\}}}
Allows to define default options for any axis. For example,
\begin{lstlisting}
@@ -427,6 +462,98 @@ The default styles are
rotate=90]
\end{lstlisting}
+\subsubsection*{\texttt{title=TEXT}}
+Adds a caption to the plot. This will place a \Tikz-Node with
+\begin{lstlisting}
+\node[style=every axis title] {TEXT};
+\end{lstlisting}
+to the current axis. An example is shown in figure~\ref{fig:titleexample}. The title is placed in the middle of the axis (the placing does not incorporate any axis descriptions). You can reconfigure the appearance and/or placing of the title for example with
+\begin{lstlisting}
+\tikzstyle{every axis title}+=[at={(0.75,1)}]
+\end{lstlisting}
+This will place the title at~75\% of the $x$-axis. The coordinate~$(0,0)$ is the lower left corner and~$(1,1)$ the upper right one.
+
+Please note that using the \LaTeX\ floating figures together with \lstinline!\caption{TEXT}! may be more appropriate in many situation. However, `\texttt{title}' allows access to the axis' size without any axis descriptions which is useful if more than one plot needs a caption.
+\begin{figure}
+ \centering
+ \begin{tikzpicture}
+ \begin{loglogaxis}[
+ width=0.48\textwidth,
+ xlabel=Dof,ylabel=Error,
+ title={$\mu=0.1$, $\sigma=0.2$}]
+
+ \addplot plot coordinates {
+ (5, 8.312e-02)
+ (17, 2.547e-02)
+ (49, 7.407e-03)
+ (129, 2.102e-03)
+ (321, 5.874e-04)
+ (769, 1.623e-04)
+ (1793, 4.442e-05)
+ (4097, 1.207e-05)
+ (9217, 3.261e-06)
+ };
+ \end{loglogaxis}
+ \end{tikzpicture}%
+ \hfill
+ \begin{tikzpicture}
+ \begin{loglogaxis}[
+ width=0.48\textwidth,
+ xlabel=Dof,ylabel=Error,
+ title={$\mu=1$, $\sigma=\frac{1}{2}$}]
+
+ \addplot[color=red,mark=*] plot coordinates {
+ (7, 8.472e-02)
+ (31, 3.044e-02)
+ (111, 1.022e-02)
+ (351, 3.303e-03)
+ (1023, 1.039e-03)
+ (2815, 3.196e-04)
+ (7423, 9.658e-05)
+ (18943, 2.873e-05)
+ (47103, 8.437e-06)
+ };
+ \end{loglogaxis}
+ \end{tikzpicture}
+
+ \begin{lstlisting}
+ \begin{tikzpicture}
+ \begin{loglogaxis}[
+ width=0.48\textwidth,
+ xlabel=Dof,ylabel=Error,
+ title={$\mu=0.1$, $\sigma=0.2$}]
+
+ \addplot plot coordinates {
+ (5, 8.312e-02)
+ (17, 2.547e-02)
+ ...
+ (4097, 1.207e-05)
+ (9217, 3.261e-06)
+ };
+ \end{loglogaxis}
+ \end{tikzpicture}%
+ \hfill
+ \begin{tikzpicture}
+ \begin{loglogaxis}[
+ width=0.48\textwidth,
+ xlabel=Dof,ylabel=Error,
+ title={$\mu=1$, $\sigma=\frac{1}{2}$}]
+
+ \addplot[color=red,mark=*] plot coordinates {
+ (7, 8.472e-02)
+ (31, 3.044e-02)
+ ...
+ (18943, 2.873e-05)
+ (47103, 8.437e-06)
+ };
+ \end{loglogaxis}
+ \end{tikzpicture}
+ \end{lstlisting}
+ \caption{An example for the `\texttt{title}' option. Some data points have not been listed, the `\texttt{...}' is not part of the plot.}
+ \label{fig:titleexample}
+\end{figure}
+
+
\subsubsection*{\texttt{xmode=normal$|$log}, \texttt{ymode=normal$|$log}}
Allows to choose between normal plots or logplots for each $x,y$-combination. Default is \lstinline!xmode=normal!, \lstinline!ymode=normal!.
@@ -465,17 +592,19 @@ Allows to change the \emph{text} assigned to each tick position (see options \te
\end{description}
The default argument is
\begin{itemize}
- \item \lstinline!xticklabel={$\tick$}! for normal plots and
- \item \lstinline!xticklabel={$10^{\logtologten\tick}$}! for logplots
+ \item \lstinline!\axisdefaultticklabel! for normal plots and
+ \item \lstinline!\axisdefaultticklabellog! for logplots, see below.
\end{itemize}
-(the same holds for \lstinline!yticklabel!). You reconfigure the defaults with
+(the same holds for \lstinline!yticklabel!). The defaults are set to
\begin{lstlisting}
-\renewcommand{\axisdefaultticklabel}[0]{%
- $\tick$%
-}
-\renewcommand{\axisdefaultticklabellog}[0]{%
- $10^{\logtologten\tick}$%
+\newcommand{\axisdefaultticklabel}[0]{%
+ $\prettyprintnumber{\tick}$%
}
+
+\newcommand{\axisdefaultticklabellog}[0]{{%
+ \logtologtentomacro{\tick}{\roundedtick}%
+ $10^{\prettyprintnumber{\roundedtick}}$%
+}}
\end{lstlisting}
You can change the appearance of tick labels with
\begin{lstlisting}