增加 TikZ 中节点边框的厚度

增加 TikZ 中节点边框的厚度

假设我有一个圆形节点。如何让它的边框变粗?

\node[circle, draw=blue!80, inner sep=0pt, minimal size=12pt] (1) 在 (0,0) {1} 处;

答案1

节点的边界是一条路径,您可以对 使用相同的选项\path,例如ultra thinthickvery thick等等:

\node[circle, draw=blue!80, thick, inner sep=0pt, minimum size=12pt] (1) at (0,0) {1};

密钥line width同样有效:

\node[circle,draw=blue!80, line width=1mm, inner sep=0pt,minimum size=12pt] (1) at(0,0) {1};

所有预定义线宽均为

\tikzset{
    ultra thin/.style= {line width=0.1pt},
    very thin/.style=  {line width=0.2pt},
    thin/.style=       {line width=0.4pt},% thin is the default
    semithick/.style=  {line width=0.6pt},
    thick/.style=      {line width=0.8pt},
    very thick/.style= {line width=1.2pt},
    ultra thick/.style={line width=1.6pt}
}

代码

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[
   every node/.append style={circle, draw=blue!80, inner sep=0pt, minimum size=12pt}]
\node                 (1) at (0,0) {1};
\node[thick]          (2) at (1,0) {2};
\node[line width=1mm] (3) at (2,0) {3};
\end{tikzpicture}
\end{document}

输出

在此处输入图片描述

答案2

您可以按如下方式更改全局路径粗细,因此无需在此处或那里进行更改:

\documentclass[tikz]{standalone}
\begin{document}

\tikzstyle{every node}=[font=\large]
\tikzstyle{every path}=[line width=2pt]

\begin{tikzpicture}[
   every node/.append style={circle, draw=blue!80, inner sep=2pt, minimum size=12pt}]
\node                 (1) at (0,0) {1};
\node[]               (2) at (1,0) {2};
\node[]               (3) at (2,0) {3};
\end{tikzpicture}
\end{document}

输出(使用 inkscape 工具将 pdf 转换为 png)

输出(使用转换工具将 pdf 转换为 png)

相关内容