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.

I took an example from pgfplots

% Preamble: \pgfplotsset{width=7cm,compat=1.3}
% [See the TikZ manual if you’d like to learn about nodes and pins]
 \begin{tikzpicture}
  \tikzset{
     every pin/.style={fill=yellow!50!white,rectangle,rounded corners=3pt,font=\tiny},
     small dot/.style={fill=black,circle,scale=0.3}
  }
  \begin{axis}[
              clip=false,
              title=How \texttt{axis description cs} works
  ]
  \addplot {x};
  \node[small dot,pin=120:{$(0,0)$}] at (axis description cs:0,0) {};
  \node[small dot,pin=-30:{$(1,1)$}] at (axis description cs:1,1) {};
  \node[small dot,pin=-90:{$(1.03,0.5)$}] at (axis description cs:1.03,0.5) {};
  \node[small dot,pin=125:{$(0.5,0.5)$}] at (axis description cs:0.5,0.5) {};
 \end{axis}
\end{tikzpicture}

enter image description here

I would like to place an arrow (-stealth’) instead of a circle and to be able to control the thickness.

share|improve this question
    
Could you place an image of the plot that the code you have provided generates into the question please? –  qubyte Feb 20 '12 at 15:01

2 Answers 2

up vote 5 down vote accepted

TikZ manual's section The pin option explains how to control pin and pin edge styles. Here you have some examples with your code. If you don't want dots on you labeled points, delete small dot option from every node.

\documentclass{standalone}
\usepackage{pgfplots}
\usetikzlibrary{arrows}
\begin{document}
 \begin{tikzpicture}
  \tikzset{
     every pin/.style={fill=yellow!50!white,rectangle,rounded corners=3pt,font=\tiny},
     small dot/.style={fill=black,circle,scale=0.3},
      every pin edge/.style={<-,>=stealth'},
      mypinedgestyle/.style={<-,>=stealth',dashed,green, very thick}
  }
  \begin{axis}[
              clip=false,
              title=How \texttt{axis description cs} works
  ]
  \addplot {x};
  \node[small dot,pin={[pin edge={<-,>=stealth',red,very thick}]120:{$(0,0)$}}] at (axis description cs:0,0) {};
  \node[small dot,pin={[pin edge={mypinedgestyle}]-30:{$(1,1)$}}] at (axis description cs:1,1) {};
  \node[small dot,pin=-90:{$(1.03,0.5)$}] at (axis description cs:1.03,0.5) {};
  \node[small dot,pin=125:{$(0.5,0.5)$}] at (axis description cs:0.5,0.5) {};
 \end{axis}
\end{tikzpicture}
\end{document}

the result is:

enter image description here

share|improve this answer

Using the pin option probably isn't ideal. Since it puts a node on the location you want an arrow at. It's probably possible using a decoration or a custom node shape, but in my opinion it's not the easiest solution. The easiest solution is to just create a path from the coordinate you want to point at to the node with the information in it. That would look like this:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
 \begin{tikzpicture}
  \tikzset{
     every pin/.style={fill=yellow!50!white,rectangle,rounded corners=3pt,font=\tiny},
     small dot/.style={fill=black,-stealth,scale=0.3}
  }
  \begin{axis}[
              clip=false,
              title=How \texttt{axis description cs} works
  ]
  \addplot {x};
  \draw[stealth-, very thin] (axis description cs:0,0) -- ++(140:1cm) node[every pin]{$(0,0)$};
  \draw[stealth-, very thin] (axis description cs:1,1) -- ++(-40:1cm) node[every pin]{$(1,1)$};
  \draw[stealth-, very thin] (axis description cs:1.03,0.5) -- ++(-90:1cm) node[every pin]{$(1.03,0.5)$};
  \draw[stealth-, very thin] (axis description cs:0.5,0.5) -- ++(125:1cm) node[every pin]{$(0.5,0.5)$};
 \end{axis}
\end{tikzpicture}
\end{document}

with the resulting picture:

image with arrows

share|improve this answer

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.