tikz を使用して円の北西にテキストを配置するにはどうすればよいですか?

tikz を使用して円の北西にテキストを配置するにはどうすればよいですか?

以下に簡単な完全な例を示します。

\documentclass{article}
\usepackage{graphicx}
\usepackage{pgfplots, tikz}
\usetikzlibrary{positioning}

\begin{document}

\section{}

\begin{figure}
    \newcommand\radius{2}
    \newcommand\spacing{2}
    
    \centering
    \begin{tikzpicture}
        \draw (-\radius-\spacing/2, 0) circle (\radius);
        \draw (\radius+\spacing/2, 0) circle (\radius) node[anchor = north west]{Test};
    \end{tikzpicture}
    \caption{Caption}
\end{figure}

出力は

ここに画像の説明を入力してください

しかし、私が望んでいるのは、「テスト」のテキストが円の北西にあることです国境円の北西に停泊しているようです中心代わりに、どうすれば修正できますか?

答え1

の場合\draw (<x>,<y>) circle[radius=<r>] node[anchor=north west] {Test};、ノードは点 に配置されます(<x>,<y>)。解決策としては、ノードを点 に別途配置することです({3+2*cos(135)},{2*sin(135)})

pgfmanual によると、構文は\draw (3,0) circle (2);古いです。新しい構文は です\draw (3,0) circle[radius=2];

ここに画像の説明を入力してください

\documentclass[border=6pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (-3,0) circle[radius=2];
\draw (3,0) circle[radius=2];
\fill ({3+2*cos(135)},{2*sin(135)}) circle[radius=2pt];
\node[anchor=north west] at ({3+2*cos(135)},{2*sin(135)}) {Test};
\end{tikzpicture}
\end{document}

答え2

これが希望通りかどうかはわかりませんが、label任意の角度でノードに を追加できます。

ここに画像の説明を入力してください

正または負の長さを使用してラベルの距離を調整できます。

label={[label distance=2mm]135:Test}

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\node[draw, circle, minimum size=4cm, label=135:Test]{};
\end{tikzpicture}

\end{document}

関連情報