summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tickoptions.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tickoptions.tex')
-rw-r--r--Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tickoptions.tex28
1 files changed, 20 insertions, 8 deletions
diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tickoptions.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tickoptions.tex
index e08329345da..0cb1556035f 100644
--- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tickoptions.tex
+++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tickoptions.tex
@@ -13,7 +13,7 @@ The \marg{coordinate list} will be used inside of a |\foreach \x in |\marg{coord
\item |{0,2,...,10}| (the same as |{0,2,4,6,8,10}|),
\item |{9,...,3.5}| (the same as |{9, 8, 7, 6, 5, 4}|),
\item See \cite[Section~34]{tikz} for a more detailed definition of the options.
- \item Please be careful with whitespaces inside of \marg{coordinate list} (at least around the dots).
+ \item Please be careful with white spaces inside of \marg{coordinate list} (at least around the dots).
\end{itemize}
For logplots, \PGFPlots\ will apply $\log(\cdot)$ to each element in `\marg{coordinate list}'.
\begin{codeexample}[]
@@ -41,7 +41,7 @@ For logplots, \PGFPlots\ will apply $\log(\cdot)$ to each element in `\marg{coor
\vspace*{0.3cm}
\noindent
-The default choice for tick \emph{positions} in normal plots is to place a tick at each coordinate~$i\cdot h$. The step size~$h$ depends on the axis scaling and the axis limits. It is chosen from a list a ``feasable'' step sizes such that neither too much nor too few ticks will be generated. The default for logplots is to place ticks at positions $10^i$ in the axis' range. The positions depend on the axis scaling and the dimensions of the picture. If log plots contain just one (or two) positions $10^i$ in their limits, ticks will be placed at positions $10^{i\cdot h}$ with ``feasable'' step sizes $h$ as in the case of linear axis.
+The default choice for tick \emph{positions} in normal plots is to place a tick at each coordinate~$i\cdot h$. The step size~$h$ depends on the axis scaling and the axis limits. It is chosen from a list a ``feasible'' step sizes such that neither too much nor too few ticks will be generated. The default for logplots is to place ticks at positions $10^i$ in the axis' range. The positions depend on the axis scaling and the dimensions of the picture. If log plots contain just one (or two) positions $10^i$ in their limits, ticks will be placed at positions $10^{i\cdot h}$ with ``feasible'' step sizes $h$ as in the case of linear axis.
\noindent
The tick \emph{appearance} can be (re-)configured with
@@ -271,6 +271,8 @@ coordinates {
\end{semilogyaxis}
\end{tikzpicture}
\end{codeexample}
+
+ Note that it is also possible to terminate list entries with two backslashes, |\\|. In that case, the last entry needs to be terminated by |\\| as well (it is the same alternative syntax which is also accepted for |\legend| and |cycle list|).
\end{pgfplotsxykey}
@@ -320,30 +322,40 @@ That means you can configure the appearance of linear axis with the number forma
\end{codeexample}
The following example uses explicitly formatted $x$ tick labels and a small \TeX\ script to format $y$ tick labels in the form \meta{sign}\meta{number}|/10|.
+% \usepackage{nicefrac}
\begin{codeexample}[width=4cm]
+% \usepackage{nicefrace}% required
\begin{tikzpicture}
\begin{axis}[
- title=A special Prewavelet,
+ % x ticks explicitly formatted:
xtick={0,1,0.5,0.25,0.75},
xticklabels={$0$,$1$,$\frac12$,$\frac14$,$\frac34$},
+ % y ticks automatically by some code fragment:
ytick=data,
- ymajorgrids,
yticklabel={%
\scriptsize
\ifdim\tick pt<0pt % a TeX \if -- see TeX Book
\pgfmathparse{-10*\tick}%
- $-\pgfmathprintnumber{\pgfmathresult}/10$%
+ $-\nicefrac{\pgfmathprintnumber{\pgfmathresult}}{10}$%
\else
- \pgfmathparse{10*\tick}%
- $\pgfmathprintnumber{\pgfmathresult}/10$%
+ \ifdim\tick pt=0pt
+ \else
+ \pgfmathparse{10*\tick}%
+ $\nicefrac{\pgfmathprintnumber{\pgfmathresult}}{10}$%
+ \fi
\fi
- }
+ },
+ ymajorgrids,
+ title=A special Prewavelet,
+ axis x line=center,
+ axis y line=left,
]
\addplot coordinates {(0,-1.2) (0.25,1.1)
(0.5,-0.6) (0.75,0.1) (1,0)};
\end{axis}
\end{tikzpicture}
\end{codeexample}
+\noindent The \TeX\ script takes the |\tick| macro as input and applies some logic. The |\ifdim\tick pt<0pt| means ``if dimension |\tick pt| $ < $ |0pt|''. The |\ifdim| is \TeX's only way to compare real fixed point numbers and the author did not want to invoke |\pgfmath| for this simple task. Since |\ifdim| expects a dimension, we have to use the |pt| suffix which is compatible with |\pgfmath|. The result is that negative numbers, zero and positive numbers are typeset differently.
You can change the appearance of tick labels with
\begin{codeexample}[code only]