![pgfplot 핀 길이](https://rvso.com/image/254729/pgfplot%20%ED%95%80%20%EA%B8%B8%EC%9D%B4.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}
해당 코드는 다음 이미지를 제공합니다
바꾸고 싶은데 설명서에서 찾을 수 없었던 것은 핀 길이를 바꾸는 것입니다. 예를 들어 중앙에 있는 핀의 텍스트가 y축의 값 5에 더 가깝게 나타나도록 만들고 연결선 범위를 해당 지점까지 만듭니다. 내가 원하는 결과는 다음 그림에 나타납니다.
어떻게 든 가능합니까?
답변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}