diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.alignment.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.alignment.tex | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.alignment.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.alignment.tex index 593f7961b80..1abde181669 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.alignment.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.alignment.tex @@ -8,7 +8,7 @@ Alignment works with two main methods: a coordinate where the axis shall be draw \begin{pgfplotskey}{at=\marg{coordinate expression}} Assigns a position for the complete axis image. This option works similarly to the |at|-option of |\node[at=|\marg{coordinate expression}|]|, see~\cite{tikz}. The common syntax is |at={|\parg{x,y}|}|. -The idea is to provide an \marg{coordinate expression} where the axis will be placed. The axis' anchor will be placed at \marg{coordinate expression}. +The idea is to provide an \meta{coordinate expression} where the axis will be placed. The axis' anchor will be placed at \meta{coordinate expression}. \end{pgfplotskey} \begin{pgfplotskey}{anchor=\marg{name} (initially south west)} @@ -45,8 +45,7 @@ There are four sets of anchors available: anchors positioned on the axis boundin \node[pin=#2:(s.#1),fill=black,circle,scale=0.3] at (test plot.#1) {}; }% \tikzstyle{every pin}=[opacity=0.5,fill=yellow,rectangle,rounded corners=3pt,font=\tiny]% -In more detail, we have -Anchors on the axis rectangle (the bounding box around the axis)\footnote{Versions prior to \PGFPlots\ v.1.3 did \emph{not} use the bounding box of the axis, they used axis coordinates to orient these anchors. This has been fixed. If you \emph{really} want to undo the bugfix, see \texttt{\protect\pgfmanualpdfref{compat/anchors}{compat/anchors}}.}, +In more detail, we have anchors on the axis rectangle (the bounding box around the axis)\footnote{Versions prior to \PGFPlots\ v.1.3 did \emph{not} use the bounding box of the axis, they used axis coordinates to orient these anchors. This has been fixed. If you \emph{really} want to undo the bugfix, see \texttt{\protect\pgfmanualpdfref{compat/anchors}{compat/anchors}}.}, \begin{center} \begin{tikzpicture} \plot @@ -83,19 +82,19 @@ There are anchors which have one coordinate on the outer bounding box, and one o {\pgfplotsset{every pin/.append style={pin distance=1cm}}% \showit{above north}{90} }% - \showit{above north east}{90} + \showit{above north east}{45} \showit{right of north east}{0} \showit{right of east}{0} \showit{right of south east}{0} - \showit{below south east}{-90} + \showit{below south east}{-45} {\pgfplotsset{every pin/.append style={pin distance=1cm}}% \showit{below south}{-90} }% - \showit{below south west}{-90} + \showit{below south west}{-135} \showit{left of south west}{180} \showit{left of west}{180} \showit{left of north west}{180} - \showit{above north west}{90} + \showit{above north west}{135} \end{tikzpicture} \end{center} And finally, we have origin anchors which are especially useful when axis lines pass through the origin, @@ -160,10 +159,10 @@ Aligning at ....... The default value is |anchor=south west|. You can use anchors in conjunction with the \Tikz\ |baseline| option and/or |\begin{pgfinterruptboundingbox}| to perform alignment. -\paragraph{Remarks:} Each of the anchors on the axis rectangle has an equivalent to a coordinate in the |axis description cs| described in section~\ref{pgfplots:sec:axis:description:cs}. That means the first set of anchors actually lives on the \emph{tight bounding box around the axis} (without any ticks or descriptions). The |south west| anchor will always be the lower left corner of this bounding box, even in case of a rotated or skewed coordinate system\footnote{Note that this is only true for versions since 1.3.}. Similar statements hold for the other anchors. +\paragraph{Remarks:} Each of the anchors on the axis rectangle has an equivalent to a coordinate in the |axis description cs| described in Section~\ref{pgfplots:sec:axis:description:cs}. That means the first set of anchors actually lives on the \emph{tight bounding box around the axis} (without any ticks or descriptions). The |south west| anchor will always be the lower left corner of this bounding box, even in case of a rotated or skewed coordinate system\footnote{Note that this is only true for versions since 1.3.}. Similar statements hold for the other anchors. } -\subsubsection{Vertical alignment with \texttt{baseline}} +\subsubsection{Vertical Alignment with \texttt{baseline}} \label{sec:align}% \begin{key}{/tikz/baseline} The |baseline| option should be provided as argument to a |tikzpicture|. It configures \Tikz\ to shift the picture position $y=0$ to the embedding text's baseline: @@ -205,8 +204,10 @@ The default axis anchor is |south west|, which means that the picture coordinate \end{axis} \end{tikzpicture} \end{codeexample} + + Note that it is also possible to write |baseline=5cm| in which case the image offset at $y=$|5cm| will be used as baseline. \end{key} -The |baseline| key is related to |\begin{minipage}|\oarg{align how} or |\begin{tabular}|\oarg{align how}: the \meta{align how} tells \LaTeX\ which part of the |minipage| or |tabular| shall be positioned on the baseline. Thus, |baseline| does the some for pictures (with more freedom for \meta{align how}). +The |baseline| key is related to |\begin{minipage}|\oarg{alignment} or |\begin{tabular}|\oarg{alignment}: the \meta{alignment} tells \LaTeX\ which part of the |minipage| or |tabular| shall be positioned on the baseline. Thus, |baseline| does the same for pictures (with more freedom for \meta{alignment}). \subsubsection{Horizontal Alignment} \label{sec:halign}% @@ -253,6 +254,7 @@ cycle list={ \end{tikzpicture} \end{codeexample} +Here, the second axis uses |at={(main plot.below south west)}| to be placed below the first one. Furthermore, it has |yshift=-0.1cm| in order to leave additional space, and it uses |anchor=north west| to place the upper left corner at the specified position. Instead of the |at={}| construction, we could also have used |yshift| with larger negative shift. \subsubsection{Alignment In Array Form (Subplots)} \label{sec:pgfplots:arrayform} @@ -266,7 +268,7 @@ Sometimes multiple alignment axes in array form are desired. \PGFPlots\ supports \item Simply place |\begin{tikzpicture}...\end{tikzpicture}| into a \LaTeX\ table. This is straight--forward; you would do the very same thing with |\includegraphics|. - In addition to |\includegraphics|, the |baseline| feature allows simple yet effective vertical alignment. At the time of this writing, the experimental \PGF\ version available from |texexample.net| also supports the |trim left| and |trim right| features which allow simple yet effective horizontal alignment (see below). + In addition to |\includegraphics|, the |baseline| feature allows simple yet effective vertical alignment. In addition, the |trim left| and |trim right| features allow simple yet effective horizontal alignment (see below). \item Use a \emph{single} picture which contains an array of axes, i.e.\ a pattern like @@ -282,14 +284,14 @@ The |groupplots| library is discussed in all detail in Section~\ref{sec:group:pl \paragraph{Array Alignment using \LaTeX\ Tables} The idea is simple: use a \LaTeX\ table and provide one |tikzpicture| for every cell. You are probably familiar with this sort of alignment, perhaps together with |\includegraphics|. It works in the very same way for \PGFPlots. The approach is the simplest one since it doesn't need special knowledge. Its disadvantage, however, is more difficulty to control positions \emph{inside} of the image (like differently sized axis descriptions). -Is is strongly recommended to employ the |baseline| option for each cell picture, which simplifies vertical alignment considerably. If you want a simple solution to place separate axes in array form, and you prefer to use one |tikzpicture| for every axis, the probably most simple and most effective way to realize horizontal alignment is the |trim left| and |trim right| feature. Unfortunately, it will only be available as part of the \emph{next} stable \PGF\ release (or available as part of the experimental \PGF\ version from |texample.net|). Since I am aware of many users who downloaded the experimental \PGF\ version, I document it here as well. +Is is strongly recommended to employ the |baseline| option for each cell picture, which simplifies vertical alignment considerably. If you want a simple solution to place separate axes in array form, and you prefer to use one |tikzpicture| for every axis, the probably most simple and most effective way to get horizontal alignment are the |trim left| and |trim right| features -- or styles based on them: -The |trim left| feature can be used to exclude axis descriptions on the left from the bounding box, and the |trim right| can exclude axis descriptions on the right from the bounding box. Thus, alignment is done using the vertical axis lines. Since both keys effectively modify the bounding box, they are documented in Section~\ref{sec:bb} ``Bounding Box Restrictions''. Here is just a small example for array alignment by means of |tabular|, |baseline| and the |trim| features: +The |trim axis left| feature can be used to exclude axis descriptions on the left from the bounding box, and the |trim axis right| can exclude axis descriptions on the right from the bounding box. Thus, alignment is done using the vertical axis lines. Since both keys effectively modify the bounding box, they are documented in Section~\ref{sec:bb} ``Bounding Box Restrictions''. Here is just a small example for array alignment by means of |tabular|, |baseline| and the |trim left|/|trim right| features: \begin{codeexample}[vbox] \pgfplotsset{ small, - title=Requires experimental PGF! + title=Trimmed bounding boxes } \begin{center} \begin{tabular}{rl} @@ -328,9 +330,7 @@ The |trim left| feature can be used to exclude axis descriptions on the left fro A strong advantage is that this type of alignment requires almost no changes to your pictures. Thus, you can copy--paste existing images (\TeX\ code) relatively simple. -Note that the approach is fully compatible with the image |external|ization library: each picture is exported separately, and the bounding box restrictions (and the |baseline| offset) are stored in separate |.dpth| files. The |trim left| / |trim right| approach for horizontal alignment is the \emph{only} supported way for reduced bounding boxes and image externalization. - -Unfortunately, |trim left| and |trim right| are not shipped with \PGFPlots\ and will be part of the next stable \Tikz\ release. +Note that the approach is fully compatible with the image |external|ization library: each picture is exported separately, and the bounding box restrictions (and the |baseline| offset) are stored in separate |.dpth| files. The |trim left|/|trim right| approach for horizontal alignment is the \emph{only} supported way for reduced bounding boxes and image externalization. \paragraph{Array Alignment using \Tikz\ Matrices} @@ -374,7 +374,7 @@ The complete documentation of a \Tikz\ matrix is beyond the scope of this manual \end{codeexample} \noindent in front of the matrix. This will use the same configuration for every sub-plot. -\paragraph{Attention:} Unfortunately, the array alignment with |\matrix| need special \emph{attention with legends}. A legend is also a |\matrix| and \Tikz\ matrizes can't be nested. You will need to use the |legend to name| feature (or to assemble a legend by means of |\label| and |\ref|) to overcome this weakness (see Section~\ref{pgfplots:legend:labelref} for details). +\paragraph{Attention:} Unfortunately, the array alignment with |\matrix| needs special \emph{attention with legends}. A legend is also a |\matrix| and \Tikz\ matrices can't be nested. You will need to use the |legend to name| feature (or to assemble a legend by means of |\label| and |\ref|) to overcome this weakness (see Section~\ref{pgfplots:legend:labelref} for details). \subsubsection{Miscellaneous for Alignment} @@ -391,15 +391,15 @@ The complete documentation of a \Tikz\ matrix is beyond the scope of this manual \subsubsection{Bounding box restrictions} \label{sec:bb} -Bounding box restrictions can be realized with several methods of \PGF: +Bounding box restrictions can be archieved with several methods of \PGF: \begin{enumerate} \item The |overlay| option, \item The |pgfinterruptboundingbox| environment, \item The |\pgfresetboundingbox| command, \item The |\useasboundingbox| path, - \item The |trim left| and |trim right| feature (which is the \emph{only} supported way of restricted bounding boxes and image externalization; at least for pdf output). + \item The |trim left| and |trim right| feature (which is the \emph{only} supported way of restricted bounding boxes and image externalization; at least for \textsc{pdf} output). \end{enumerate} -Note that image externalization (the |external| library) is more or less incompatible with methods (1.)--(4.). The problem is that |pdflatex| crops everything outside of the bounding box away. There are only two safe ways to ``restrict'' bounding boxes of external |.pdf| images: the first is the mentioned |trim left| / |trim right| feature and the second is to use negative |\hspace| or |\vspace| commands (or options to |\includegraphics|). Unfortunately, the |trim left| / |trim right| feature is currently unavailable, it needs a more recent \PGF\ version than the current stable release \PGF\ $2.00$ (I only mention the method here because many users downloaded a more recent \PGF\ from \url{http://www.texample.net/tikz/builds/}). +Note that image externalization (the |external| library) is more or less incompatible with methods (1.)--(4.). The problem is that |pdflatex| crops everything outside of the bounding box away. There are only two safe ways to ``restrict'' bounding boxes of external |.pdf| images: the first is the mentioned |trim left|/|trim right| feature and the second is to use negative |\hspace| or |\vspace| commands (or options to |\includegraphics|). \begin{key}{/tikz/overlay} \index{Bounding Box Control!Excluding Image Parts} @@ -524,8 +524,6 @@ The |pgfinterruptboundingbox| environment does not include its content into the /tikz/trim right=\marg{$x$ coordinate or point}} These two keys allow to reduce the size of the bounding box. - {\bfseries They are only available in the experimental version of \PGF, not in \PGF\ 2.00! You may need the \PGF\ version from |texexample.net|!} - The |trim left| key expects either a single $x$ coordinate like |1cm| or a point like |(current axis.west)|. If a point is provided, is uses only the $x$ coordinate of that point. Then, the left end of the bounding box is set to the resulting $x$ coordinate and everything left of it is outside of the bounding box. The |trim right| key has the same effect, only for the right end of the bounding box. |