![如何在一系列圆圈下进行标记?](https://linux22.com/image/424957/%E5%A6%82%E4%BD%95%E5%9C%A8%E4%B8%80%E7%B3%BB%E5%88%97%E5%9C%86%E5%9C%88%E4%B8%8B%E8%BF%9B%E8%A1%8C%E6%A0%87%E8%AE%B0%EF%BC%9F.png)
我想标记一系列圆圈。标签应位于绘图下方并居中。由于我是 Tikz 新手,因此我绘制了一系列圆圈,如下所示:
\documentclass[tikz,border=10pt]{standalone}
\definecolor{rot}{RGB}{255,0,0}
\definecolor{gruen}{RGB}{0,147,0}
\definecolor{blau}{RGB}{0,0,255}
\begin{document}
\huge
\begin{tikzpicture}
\fill[gruen] (0,0) circle (0.15cm);
\fill[gruen] (1,0) circle (0.15cm);
\fill[gruen] (2,0) circle (0.15cm);
\fill[gruen] (3,0) circle (0.15cm);
\fill[gruen] (4,0) circle (0.15cm);
\fill[gruen] (5,0) circle (0.15cm);
\fill[gruen] (6,0) circle (0.15cm);
\fill[gruen] (7,0) circle (0.15cm);
\fill[gruen] (8,0) circle (0.15cm);
\fill[gruen] (9,0) circle (0.15cm);
\fill[gruen] (10,0) circle (0.15cm);
\fill[gruen] (11,0) circle (0.15cm);
\node {Node};
\end{tikzpicture}
\end{document}
我找到了节点选项,但无法将它放置在我想要的位置。
答案1
您的问题不太清楚。您想在哪里贴标签?在每个圆圈下面,如下所示:
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{chains,
positioning}
\usepackage{xcolor}
\definecolor{gruen}{RGB}{0,147,0}
\begin{document}
\begin{tikzpicture}[
node distance = 10mm,
start chain = going right,
C/.style = {circle, fill=gruen, inner sep=0pt, minimum size=3mm},
every label/.append style = {font=\footnotesize, align=center}
]
\foreach \i in {1,2,...,12}
\node [C, on chain, label=below:label\\ \i] {};
\end{tikzpicture}
\end{document}
或在下面的圆圈序列中选择一个标签:
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{chains,
positioning}
\usepackage{xcolor}
\definecolor{gruen}{RGB}{0,147,0}
\begin{document}
\begin{tikzpicture}[
node distance = 10mm,
start chain = going right,
C/.style = {circle, fill=gruen, inner sep=0pt, minimum size=3mm},
]
\foreach \i in {1,2,...,12}
\node (n\i) [C, on chain] {};
\path (n1) -- node[font=\huge, below=3mm] {Sequenca name?} (n12);
\end{tikzpicture}
\end{document}
答案2
\documentclass[tikz,border=10pt]{standalone}
\definecolor{rot}{RGB}{255,0,0}
\definecolor{gruen}{RGB}{0,147,0}
\definecolor{blau}{RGB}{0,0,255}
\begin{document}
\begin{tikzpicture}
\fill[gruen] (0,0) circle (0.15cm) node[label=below:w](){};
\fill[gruen] (1,0) circle (0.15cm);
\fill[gruen] (2,0) circle (0.15cm);
\fill[gruen] (3,0) circle (0.15cm);
\fill[gruen] (4,0) circle (0.15cm);
\fill[gruen] (5,0) circle (0.15cm);
\fill[gruen] (6,0) circle (0.15cm);
\fill[gruen] (7,0) circle (0.15cm);
\fill[gruen] (8,0) circle (0.15cm);
\fill[gruen] (9,0) circle (0.15cm);
\fill[gruen] (10,0) circle (0.15cm);
\fill[gruen] (11,0) circle (0.15cm);
\end{tikzpicture}
\end{document}
或者 代码
\node[circle,fill=gruen,label=below:010101] (CircleNode) at (0,0) {};
可以用来创建一系列圆圈
\documentclass[tikz,border=10pt]{standalone}
\definecolor{rot}{RGB}{255,0,0}
\definecolor{gruen}{RGB}{0,147,0}
\definecolor{blau}{RGB}{0,0,255}
\begin{document}
\begin{tikzpicture}
%\fill[gruen] (0,0) circle (0.15cm) [label=below:w];
%\fill[gruen] (1,0) circle (0.15cm);
%\fill[gruen] (2,0) circle (0.15cm);
%\fill[gruen] (3,0) circle (0.15cm);
%\fill[gruen] (4,0) circle (0.15cm);
%\fill[gruen] (5,0) circle (0.15cm);
%\fill[gruen] (6,0) circle (0.15cm);
%\fill[gruen] (7,0) circle (0.15cm);
%\fill[gruen] (8,0) circle (0.15cm);
%\fill[gruen] (9,0) circle (0.15cm);
%\fill[gruen] (10,0) circle (0.15cm);
%\fill[gruen] (11,0) circle (0.15cm);
\node[circle,fill=gruen,label=below:010101] (CircleNode) at (0,0) {};
\end{tikzpicture}
\end{document}