77

In TikZ is it possible to draw lines thinner than 0.1 mm? ultra thin option gives line thickness 0.1 mm. I want to draw a pattern using line thickness 0.07 mm.

2 Answers2

133

You can specify the line width. Here is a zoomed in view of the output so that one can see the difference:

enter image description here

Notes:

  • As John Kormylo pointed out the tikz-pgf manual says about the "0 width" line:

    Line width: The “thickness” of the line. A width of 0 is the thinnest width renderable on the device. On a high-resolution printer this may become invisible and should be avoided. A good choice is 0.4pt, which is the default.

  • Obviously at some point the size difference won't be noticeable at all, especially in a print edition.

Code:

\documentclass{article}
\usepackage{siunitx}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[yscale=0.5] \draw [line width=0.25mm, red ] (0,-1) -- (2,-1) node [right] {\SI{0.25}{\milli\meter}};; \draw [line width=0.1mm, blue] (0,-2) -- (2,-2) node [right] {\SI{0.10}{\milli\meter}};; \draw [line width=0.05mm, red ] (0,-3) -- (2,-3) node [right] {\SI{0.05}{\milli\meter}}; \draw [line width=0.01mm, blue] (0,-4) -- (2,-4) node [right] {\SI{0.01}{\milli\meter}}; \draw [line width=0mm, black] (0,-5) -- (2,-5) node [right] {\SI{0.0}{\milli\meter}}; \end{tikzpicture}

\end{document}

Cactus
  • 1,107
Peter Grill
  • 223,288
  • 7
    +1 for using the siunitx package – onewhaleid Oct 07 '14 at 06:21
  • @percusse : I am using the tikz-3dplot package which draw spheres with grid lines. There is not an option to remove the grid lines. I thought about making the line width=0 to remove the grid lines but I still got something. Is there a way to make the grid lines invisible with some pgf command? Thanks. – Herman Jaramillo Nov 13 '15 at 17:58
  • @HermanJaramillo Is there anything to squeeze the option draw=none? – percusse Nov 13 '15 at 18:19
  • @percusse : No that I can see. Thanks for your response. I am looking now into "pgfplots" . – Herman Jaramillo Nov 13 '15 at 20:44
  • 3
    You can have also very thin, thin, thick, very thick alternatives. That is \draw[line width=very thick] (0,0) -- (4,0) – somenxavier Aug 31 '21 at 06:12
  • 2
    @somenxavier no line width=very thick is a mistake and you get an error ! you can write \draw[line width=0.4 pt] or \draw[very thick] – Alain Matthes Dec 31 '21 at 20:53
9

A PSTricks solution:

\documentclass{article}

\usepackage{pstricks-add}
\usepackage{siunitx}

\begin{document}

\begin{pspicture}(6.25,5.2)
  \multido{\rA = 0.1+-0.01, \rB = 0.1+0.5}{11}{
    \psline[linewidth = \rA mm](0,\rB)(5,\rB)
    \uput[0](5,\rB){\texttt{linewidth} = \SI[round-mode = places, round-precision = 2]{\rA}{\mm}}
  }
\end{pspicture}

\end{document}

output

You specify the width of the line with the option linewidth = <length>.

P.S. As can be seen, the line width is too small to distinguish when using PSTricks, so that is not a good tool in this case. (I can't believe I'm saying that.)