114

Suppose I have a node in the shape of a circle. How can I make its border thicker?

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

2 Answers 2

154

The node’s border is a path, you can use the same options for a \path, e.g. ultra thin, thick, very thick, and so on:

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

The line width key works as well:

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

All predefined line widths are

\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}
}

Code

\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}

Output

enter image description here

1
  • 2
    If you have a rectangle as a node (e.g. using matrix in tikz), can you adjust the thickness of the borders individually? E.g. top, bottom, left, right? line width changes all of them simultaneously.
    – luchonacho
    Feb 19, 2018 at 10:14
11

You can change global path thickness as below, so you no need to change it here and there:

\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}

Output (use inkscape tool to covert pdf to png)

Output (use convert tool to covert pdf to png)

3
  • How did you get this figure? According your code, numbers should be centered inside circles.
    – Ignasi
    Nov 26, 2014 at 7:38
  • 1
    Really good question. I found it caused by different pdf to png convert tool. one is from inkscape and another is from convert. Not sure if it caused by the default font. I have updated the output from both tool. code is the same but image is really differ.
    – Beatlej
    Nov 26, 2014 at 19:16
  • 2
    @Beatlej Inkscape can't use embedded font... Nov 26, 2014 at 23:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .