![pgfplot Pinlänge](https://rvso.com/image/254729/pgfplot%20Pinl%C3%A4nge.png)
Betrachten Sie das folgende Beispiel aus dem pgfplot
Handbuch.
\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)$}]
\node[small dot,pin=-30:{$(1,1)$}]
\node[small dot,pin=-90:{$(1.03,0.5)$}]
\node[small dot,pin=125:{$(0.5,0.5)$}]
\end{axis}
\end{tikzpicture}
Dieser Code erzeugt das folgende Bild
Was ich ändern möchte und was ich im Handbuch nicht finden konnte, ist die Länge der Pins zu ändern. Beispielsweise könnte ich den Text des Pins in der Mitte näher am Wert 5 der Y-Achse erscheinen lassen und die Verbindungslinie bis zu diesem Punkt ausdehnen. Das gewünschte Ergebnis ist im folgenden Bild zu sehen.
Ist das irgendwie möglich?
Antwort1
Sie können Folgendes verwenden pin distance
:
\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,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={[pin distance=2cm]125:{$(0.5,0.5)$}}] at (axis description cs:0.5,0.5) {};
\end{axis}
\end{tikzpicture}
\end{document}