如何在一系列圆圈下进行标记?

如何在一系列圆圈下进行标记?

我想标记一系列圆圈。标签应位于绘图下方并居中。由于我是 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}

相关内容