79

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

2 Answers 2

136

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}
6
  • 7
    +1 for using the siunitx package
    – onewhaleid
    Oct 7, 2014 at 6: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. Nov 13, 2015 at 17:58
  • @HermanJaramillo Is there anything to squeeze the option draw=none?
    – percusse
    Nov 13, 2015 at 18:19
  • 3
    You can have also very thin, thin, thick, very thick alternatives. That is \draw[line width=very thick] (0,0) -- (4,0) Aug 31, 2021 at 6: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] Dec 31, 2021 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.)

1
  • +1 for (I can't believe I'm saying that.) :))
    – enthu
    Jan 15, 2023 at 7:55

You must log in to answer this question.

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