增加 TikZ 中節點邊框的厚度

增加 TikZ 中節點邊框的厚度

假設我有一個圓形的節點。要怎麼樣才能讓它的邊框變粗呢?

\node[circle,draw=blue!80,inner sep=0pt,最小尺寸=12pt] (1) at (0,0) {1};

答案1

節點的邊界是一條路徑,您可以對 a 使用相同的選項\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)

相關內容