2

Is there a simple way to customize the dots pattern? With "simple" I mean not like this post (several lines to customize the dots). For example, I have this code:

\begin{center}
    \begin{tikzpicture}
        \draw[pattern = dots] (0,0) rectangle (2,2);
    \end{tikzpicture}
\end{center}

which produces

enter image description here

but I'd like to increase the distance (space) between the dots (to have less, reducing the density of dots). Or, in other case, change the color of the dots. So, is possible to do that without writing several lines of codes? Thank you for reading and helping!

The ideal answer would be this (if you replace "dots" for "Lines" it works but not for "dots"):

\begin{center}
    \begin{tikzpicture}
        \draw[pattern = {dots[color = green, distance = 0.2cm]}] (0,0) rectangle (2,2);
    \end{tikzpicture}
\end{center}

1 Answer 1

4

Use Dots from patterns.meta:

enter image description here

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{patterns, patterns.meta}

\begin{document}

\begin{center}
    \begin{tikzpicture}
        \draw[pattern={Dots[distance=.2cm]}, pattern color=green] (0,0) rectangle (2,2);
    \end{tikzpicture}
\end{center}

\end{document}

You must log in to answer this question.

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