# Plot of rectangle in the complex plane using tikz

How do I achieve following graphic using tikz?

My attempt until now is

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{patterns}

\begin{document}
\begin{tikzpicture}
\draw (0,-3)--(0,3);
\draw (4,-3)--(4,3);
\draw (-.5,0)--(4.5,0);
\draw [pattern = north east lines, pattern color = black] (0,-2) rectangle (4,2);
\end{tikzpicture}
\end{document}


which produces

How do I increase the spacing between the diagonal lines filling the rectangle?

• Related: Drawing a circle in the complex plane, may just need to replace the circle in either answer with an appropriately-sized rectangle. – Mike Renfro Sep 2 '16 at 23:06
• Thanks, I had a look at it but I think it is not exactly what I want. I added my progress to the question. – TheGeekGreek Sep 2 '16 at 23:32

TikZ defines north east lines using

\pgfdeclarepatternformonly{north east lines}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{4pt}{4pt}}{\pgfqpoint{3pt}{3pt}}%
{
\pgfsetlinewidth{0.4pt}
\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
\pgfpathlineto{\pgfqpoint{3.1pt}{3.1pt}}
\pgfusepath{stroke}
}


where it seems like it defines a rectangle from the first point to the second point and repeats starting at the third point.

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{patterns}

\pgfdeclarepatternformonly{my lines}{\pgfqpoint{-1pt}{-1pt}}{\pgfqpoint{10pt}{10pt}}{\pgfqpoint{9pt}{9pt}}%
{
\pgfsetlinewidth{0.4pt}
\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
\pgfpathlineto{\pgfqpoint{9.1pt}{9.1pt}}
\pgfusepath{stroke}
}

\begin{document}

\begin{tikzpicture}
\draw (0,-3)--(0,3);
\draw (4,-3)--(4,3);
\draw (-.5,0)--(4.5,0);
\draw [pattern = my lines, pattern color = black] (0,-2) rectangle (4,2);
\end{tikzpicture}
\end{document}