![длина вывода pgfplot](https://rvso.com/image/254729/%D0%B4%D0%BB%D0%B8%D0%BD%D0%B0%20%D0%B2%D1%8B%D0%B2%D0%BE%D0%B4%D0%B0%20pgfplot.png)
Рассмотрим следующий пример из pgfplot
руководства.
\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}
Этот код дает следующее изображение
То, что я хочу изменить и не смог найти в руководстве, это изменить длину пинов. Например, сделать так, чтобы текст пина в середине казался ближе к значению 5 оси Y и сделать соединительную линию протяженностью до этой точки. Результат, который я хочу, показан на следующем рисунке.
Возможно ли это как-то?
решение1
Вы можете использовать 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}