Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

It would be great if I could get the annotation in the graph depicted below on two lines, but I can't seem to figure it out.

Presently, I have:

\begin{tikzpicture}
\begin{axis}[
            xlabel={$d_x = w^T_x-w^G_x$},
            ylabel={$s_x = e^{-\frac{d_x^2}{2\sigma^2_x}}$},
        ]
    \addplot+[
                domain=0:600,
                smooth,
            ]{exp(-x^2/(2*266.72^2))};
    \node[coordinate,pin=-90:{$d_x = 100, s_x = 0.932$}] at (axis cs:100,0.932) {};
\end{axis}
\end{tikzpicture}

Graph with annotation on single line

Looking at a similar question, I've tried changing the \node to:

\node[coordinate,pin=-90:{$d_x = 100$\\$s_x = 0.932$}] at (axis cs:100,0.932) {};

This produces the following error:

There's no line here to end

I've also tried replacing \node with a \draw:

\draw
        (axis cs:100,0)
    |-  (axis cs:0,0.8)
    node[near start,left]{$d_y = 100$\\$s_x = 0.932$};

This, too, doesn't seem to want to compile:

Something's wrong; perhaps a missing \item

share|improve this question

1 Answer 1

up vote 8 down vote accepted

You need to set the align option in order to get the \\ to work. Try

\node[coordinate, pin={[align=left]-90:{$d_x = 100$,\\$s_x = 0.932$}}]
      at (axis cs:100,0.932) {};

(where you can also choose align=center or whatever if you prefer. Note the extra set of curly braces after pin=.)

share|improve this answer
    
Fantastic, that worked out exactly as I was hoping! –  Paul Lammertsma Oct 5 '11 at 11:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.