1

I have no idea for reducing distance of dots (lines) in tikz dotted (horizontal lines) pattern. I find some similar examples in this website (like this), but it was so complicated. Can someone give me some hints?

  • 2
    Could you please list the codes that you found and explain why you do not like them? Otherwise there is a danger you will get the same answer again. –  Feb 04 '19 at 15:04
  • For example see this one:https://tex.stackexchange.com/questions/42003/decorating-with-random-steps-a-filling-pattern or https://tex.stackexchange.com/questions/54358/custom-and-built-in-tikz-fill-patterns –  Feb 04 '19 at 15:05
  • 2
    I have a hard time seeing how this is directly related to your question. This post discusses a random pattern of solid lines, doesn't it? And please add the relevant information to your question, and not in comments. –  Feb 04 '19 at 15:09

1 Answers1

4
\documentclass[tikz,border=2mm]{standalone} 
\usetikzlibrary{patterns}

\pgfdeclarepatternformonly{mydots}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{1pt}{1pt}}{\pgfqpoint{2pt}{2pt}}% original definition: \pgfqpoint{3pt}{3pt}
{%
  \pgfpathcircle{\pgfqpoint{0pt}{0pt}}{.5pt}%
  \pgfusepath{fill}%
}%

\pgfdeclarepatternformonly{mynewdots}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{1pt}{1pt}}{\pgfqpoint{1pt}{1pt}}% original definition: \pgfqpoint{3pt}{3pt}
{%
  \pgfpathcircle{\pgfqpoint{0pt}{0pt}}{.5pt}%
  \pgfusepath{fill}%
}%

\begin{document}
\begin{tikzpicture}
\draw[pattern=dots] (0,0) rectangle ++(3,3);
\draw[pattern=mydots] (4,0) rectangle ++(3,3);
\draw[pattern=mynewdots] (8,0) rectangle ++(3,3);
\end{tikzpicture}
\end{document}

enter image description here

Ignasi
  • 136,588