
以下に簡単な完全な例を示します。
\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}