0

I annotate special points in my diagram and use a node/pin approach:

\documentclass[border=3mm,tikz]{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    axis lines = middle,
    xlabel = {$x$},
    ylabel = {$y$},
        ]
    \addplot [domain=0:10]{x};
    \node[coordinate, pin={[align=left,pin distance = 10mm]-30:{Test Text Test\\ Text Test}}]
               at (axis cs:4,4) {};
\end{axis}
\end{tikzpicture}
\end{document}

I want to change the anchor for the pin line / pin egde -- here are two possibilities:

enter image description here

Is that possible?

1 Answers1

1

An alternative for pin is to place the text node directly, at the position you want. The the line can be drawn between the point on the curve and the node. Variant 1 connects to the west of the text node and variant 2 to the north.

Example:

\documentclass[border=3mm,tikz]{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    axis lines = middle,
    xlabel = {$x$},
    ylabel = {$y$},
        ]
    \addplot [domain=0:10]{x};
    \draw
      (axis cs:3, 3) coordinate (tmp) % start point
      ++(-30:5mm)
      node[
        below right,
        align=left,
      ] (test) {Test Text Test\\Text Test}
      (test.west) -- (tmp)
    ;
    \draw
      (axis cs:6, 6) coordinate (tmp) % start point
      ++(-30:5mm)
      node[
        below right,
        align=left,
      ] (test) {Test Text Test\\Text Test}
      (test.north) -- (tmp)
    ;
\end{axis}
\end{tikzpicture}
\end{document}

Result

Heiko Oberdiek
  • 271,626
  • Thanks a lot Heiko. I would prefer a node/pin solution since it is less code and I like the elegance. But if there isn't a way then I do not have another choice. – Dr. Manuel Kuehner Sep 04 '15 at 18:06