0

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. – user121799 Feb 4 at 15:04
  • 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. – user121799 Feb 4 at 15:09
2
\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

  • Very nice. And what about line case? Do i allowed to use this patteren without referencing in literatures? – C.F.G Feb 4 at 18:08
  • @C.F.G what does IT mean? – Ignasi Feb 4 at 18:18
  • IT? Information Technology?! :) . my means is copyright issues. – C.F.G Feb 5 at 6:00
  • @C.F.G You can use this code as you want. But, if it solves your problem, you could accept the answer ;-) – Ignasi Feb 5 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.