# Tikz - Draw rectangle with dashed one side and hatching on the others

I need to a scheme like this one:

The problem is, I have no idea how to do the dashed line on top of rectangle and the hatching in the left side and in the bottom.

Is it possible with Tikz?

• definitely possible, you just need someone motivated enough to do it.... it'd be great if you could get that person started – cmhughes Apr 25 '16 at 15:24
• You can use the patterns library by saying \usetikzlibrary{patterns}. Then you create a path with \pattern[pattern=north west lines] (x1,y1) -- (x2,y2) ... -- cycle which gets filled with the hatching. The dashed lines you simply create with \draw[dashed] (x1,y1) -- (x2,y2) -- ... Here (x,y) are the coordinates of the corners. Just try it and when you run into problems, edit your question to the specific problem. – JMP Apr 25 '16 at 15:44
• – Matsmath Jul 12 '16 at 21:30

Here is a starting point for you. Start to modify it to your needs and if you run into problems, edit your question and comment under this answer, so I get a notification. Then I am going to help you further:

\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{patterns}
%
\begin{document}
%
\begin{tikzpicture}
%
\pattern[pattern=north east lines] (0,0)--(0,1)--(1,1)--(1,0)--cycle;
\draw[dashed] (0,2) -- (1,2);
%
\end{tikzpicture}%
%
\end{document}


• How is this an answer? – Matsmath Jul 12 '16 at 21:29
• @Matsmath It's a starting point for the OP. – Karlo Jul 13 '16 at 9:41

This could be a good starting point.

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{patterns, decorations.pathreplacing, calc}

\begin{document}

\renewcommand{\b}{10}
\newcommand{\h}{5}
\renewcommand{\t}{.5}

\begin{tikzpicture}
\coordinate (O) at (0,0);
\coordinate (E) at (\b,0);
\coordinate (En) at (\b,\t);
\coordinate (One) at (\t,\t);
\coordinate (Ne) at (\t,\h);
\coordinate (N) at (0,\h);
\coordinate (NE) at (N -| E);
\draw[thick, pattern=north east lines] (O) -- (E) -- (En) -- (One) -- (Ne) -- (N) -- cycle;
\draw[thick] (En) -- (NE);
\draw[dashed] (Ne) -- (NE);
\draw[thick, decorate, decoration={brace, raise=20pt}] (NE) -- (E) node[midway, right=30pt] {text};
\draw[thick, decorate, decoration={brace, raise=20pt, mirror}] (O) -- (E) node[midway, below=30pt] {text};
\end{tikzpicture}

\end{document}


Another starting point

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

\begin{document}
\begin{tikzpicture}
\draw[pattern=north west lines] (0,0)-|(3,.5)-|(0.5,2)-|cycle;
\draw[dashed] (0,2)--(3,2);
\draw (3,0)--(3,2);
\end{tikzpicture}
\end{document}