13

Using pins is a nice way to annote your plots in PGF Plots. However, I would like to have the weight for the line leading from a point on the graph to the text to be bold. How do I do this?

Consider the following MWE:

\documentclass{minimal}
\usepackage{pgfplots}
    \pgfplotsset{compat=1.5.1}

\begin{document}
\begin{tikzpicture}
    \begin{axis}
        \addplot[domain=1:6]
        {exp(x)};
        54.59815
        \node[coordinate,pin=left:{A pin!}]
            at (axis cs:4,54.59815) {};
    \end{axis}
\end{tikzpicture}
\end{document}
14

To modify a single pin, you can use pin edge:

\documentclass{article}
\usepackage{pgfplots}
    \pgfplotsset{compat=1.5.1}

\begin{document}
\begin{tikzpicture}
    \begin{axis}
        \addplot[domain=1:6]
        {exp(x)};
        54.59815
        \node[coordinate,pin={[pin edge={blue,ultra thick}]left:{A pin!} } ]
            at (axis cs:4,54.59815) {};
    \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

To change the format for all pins, you can change the every pin edge style.

4
  • 1
    Fantastic, thanks! May I ask two questions? 1. How did you find this out? I am still learning TikZ and have trouble finding such information. At least I was too blind to see it in the manual, if it is in there. 2. Could I add an arrow tip to the pin? Thanks again!
    – Ingo
    May 30 '12 at 7:17
  • 1
    @Ingo You're welcome! Regarding your questions: 1. pages 196 and 197 of the pgfmanual contain basic information about pins; in particular, pin edge and every pin edge. 2. Of course, you can use the arrow syntax for pin edge: you can use something like \node[coordinate,pin={[pin edge={<-,blue,ultra thick}]left:{A pin!} } ] in the code above. May 30 '12 at 13:46
  • Just to add, if you want this style to apply to all pin use: \tikzset{ every pin edge/.append style={blue, thick} }
    – M.Reza
    Oct 10 '13 at 6:50
  • 1
    What are the options available for the size, thick, ultra thick, ...?
    – Ribz
    Jun 29 '17 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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