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?
Asked
Active
Viewed 2,642 times
1
-
2Could 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
-
2I 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 Answers
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}
Ignasi
- 136,588
-
Very nice. And what about line case? Do i allowed to use this patteren without referencing in literatures? – Feb 04 '19 at 18:08
-
-
-
@C.F.G You can use this code as you want. But, if it solves your problem, you could accept the answer ;-) – Ignasi Feb 05 '19 at 08:32
