화살표가 특정 노드를 가리키도록 그림에 화살표를 어떻게 그리나요?

화살표가 특정 노드를 가리키도록 그림에 화살표를 어떻게 그리나요?

8개의 노드가 있는 그래프 그림이 있습니다. 화살표를 그리고 싶습니다. 화살표는 일부 노드를 가리킬 것입니다(예를 들어 4개의 노드를 가리키는 화살표를 그리려고 합니다). 또한 각 화살표 옆에 텍스트를 쓰고 싶습니다. 이를 위해 다음 웹페이지를 사용했습니다.http://en.wikibooks.org/wiki/LaTeX/Picture#Arrows그리고 화살표 하나하나를 따로 작성하고 수동으로 배치를 수정해야겠다는 생각이 들었습니다. 하지만 화살표가 있는 위치에서는 움직일 수 없습니다. 어떤 아이디어가 있나요? 이것이 결과이다내가 사용한 전체 코드는 다음과 같습니다.

 \\documentclass[11pt]{article}
\usepackage{tikz}
\usepackage{caption}
\usepackage{subcaption}
\begin{document}
\tikzset{%
   point/.style = {fill=black,inner sep=1pt, circle, minimum width=3pt,align=right,rotate=60},
   } 
\tikzstyle{weight} = [font=\scriptsize]  
\tikzstyle{vertex}=[circle,fill=blue!20]

\makeatletter
\setlength{\@fptop}{0pt}
\makeatother

\section{Some section}

\begin{figure}
 \centering
 \begin{subfigure}{0.5\textwidth}
 \resizebox{0.7\textwidth}{!}{
 \begin{tikzpicture}
  [scale=.8,auto=right]
      \put(0,10){\vector(1,0){20}}
      \node[vertex] (v1) at (1,10)  {$a$};
      \node[vertex] (v2) at (1,8)  {$b$};
      \node[vertex] (v3) at (1,6)  {$c$};
      \node[vertex] (v4) at (1,4)  {$d$};
      \node[vertex] (v5) at (8,10)  {$e$};
      \node[vertex] (v6) at (8,8)  {$f$};
      \node[vertex] (v7) at (8,6)  {$g$};
      \node[vertex] (v8) at (8,4)   {$h$};

     \draw[->] (v1)--(v8);
     \draw[->] (v1)--(v5);
     \draw[->] (v2)--(v5);
     \draw[->] (v2)--(v6);
     \draw[->] (v3)--(v6);
     \draw[->] (v3)--(v7);
     \draw[->] (v4)--(v7);
     \draw[->] (v4)--(v8);
 \end{tikzpicture}
 }

 \caption{I want to place the arrow s.t. it will point to node "a". Also I want to insert some text above the arrow}
    \label{fig:1}
    \end{subfigure}
    \hspace{4em}%
    \caption{I want to place the arrow s.t. it will point to node "a". Also I want to insert some text above the arrow.}\label{fig:animals}
\end{figure}




\end{document}

답변1

아마도 이런 것일까요?

고정된 노드

pin이는 노드 라벨링 시설을 사용하여 생산되었습니다 . 더 이상 사용되지 않으므로 \tikzset일관되게 사용하도록 코드를 업데이트했습니다 \tikzstyle.

\documentclass[tikz, border=10pt]{standalone}

\begin{document}

  \tikzset{%
    point/.style = {fill=black,inner sep=1pt, circle, minimum width=3pt,align=right,rotate=60},
    weight/.style={font=\scriptsize},
    vertex/.style={circle,fill=blue!20}
  }

  \begin{tikzpicture}
    [scale=.8,auto=right]
    \put(0,10){\vector(1,0){20}}
    \node[vertex, pin={[pin edge=<-, pin distance=10pt]105:{Label Here}}] (v1) at (1,10)  {$a$};
    \node[vertex] (v2) at (1,8)  {$b$};
    \node[vertex] (v3) at (1,6)  {$c$};
    \node[vertex] (v4) at (1,4)  {$d$};
    \node[vertex] (v5) at (8,10)  {$e$};
    \node[vertex] (v6) at (8,8)  {$f$};
    \node[vertex] (v7) at (8,6)  {$g$};
    \node[vertex] (v8) at (8,4)   {$h$};

    \draw[->] (v1)--(v8);
    \draw[->] (v1)--(v5);
    \draw[->] (v2)--(v5);
    \draw[->] (v2)--(v6);
    \draw[->] (v3)--(v6);
    \draw[->] (v3)--(v7);
    \draw[->] (v4)--(v7);
    \draw[->] (v4)--(v8);

  \end{tikzpicture}

\end{document}

관련 정보