# How to draw dashed area in graph (TiKz)

I'd like to draw three graphs like these ones below:

Is there an easy way to draw these dashed areas?

This is what I have so far:

from the following code:

\documentclass[11pt]{article}

\usepackage{tikz}

\begin{document}

Damping:\\
\begin{tikzpicture}[scale=0.6]
\draw[->] (-4.5,0) -- (1.5,0);
\draw[->] (0,-4.5) -- (0,4.5);

\foreach \x in {-4,-3,-2,-1,0,1}
\draw (\x cm,1.5pt) -- (\x cm,-1.5pt);
\foreach \y in {-4,-3,-2,-1,0,1,2,3,4}
\draw (1.5pt,\y cm) -- (-1.5pt,\y cm);

\draw[thick,red] (0,0)--(-4,4);
\draw[thick,red] (0,0)--(-4,-4);
\end{tikzpicture}

Settling Time:\\
\begin{tikzpicture}[scale=0.6]
\draw[->] (-4.5,0) -- (1.5,0);
\draw[->] (0,-4.5) -- (0,4.5);

\foreach \x in {-4,-3,-2,-1,0,1}
\draw (\x cm,1.5pt) -- (\x cm,-1.5pt);
\foreach \y in {-4,-3,-2,-1,0,1,2,3,4}
\draw (1.5pt,\y cm) -- (-1.5pt,\y cm);

\draw[thick,blue] (-1,-4)--(-1,4);
\end{tikzpicture}

Frequency:\\
\begin{tikzpicture}[scale=0.6]
\draw[->] (-4.5,0) -- (1.5,0);
\draw[->] (0,-4.5) -- (0,4.5);

\foreach \x in {-4,-3,-2,-1,0,1}
\draw (\x cm,1.5pt) -- (\x cm,-1.5pt);
\foreach \y in {-4,-3,-2,-1,0,1,2,3,4}
\draw (1.5pt,\y cm) -- (-1.5pt,\y cm);

\draw[thick,orange] (-4,4)--(1,4);
\draw[thick,orange] (-4,-4)--(1,-4);
\end{tikzpicture}

\end{document}

-

TikZ offers you a library named patterns. To use it you need \usetikzlibrary{patterns} in your preamble.

In your case for the first case you can do

\begin{tikzpicture}[scale=0.6]
\draw[->] (-4.5,0) -- (1.5,0);
\draw[->] (0,-4.5) -- (0,4.5);
\foreach \x in {-4,-3,-2,-1,0,1}
\draw (\x cm,1.5pt) -- (\x cm,-1.5pt);
\foreach \y in {-4,-3,-2,-1,0,1,2,3,4}
\draw (1.5pt,\y cm) -- (-1.5pt,\y cm);
\draw[thick,red,pattern=north east lines,pattern color=red] (-4,-4) -- (0,0)--(-4,4);
\end{tikzpicture}


So the key is to have more or less a defined surface. For case #2 and #3, \fill[pattern=north west lines] (0,1) rectangle (2,2); with adapted coordinates would work.

Of course there are more defined patterns if you refer to the manual (http://www.ctan.org/pkg/pgf).

-
Exactly what I was looking for! Thank you! – Nicolai Anton Lynnerup Jun 9 '14 at 7:17
@NicolaiAntonLynnerup if the answer is fine click on the thick to accept the answer, so that it can be closed – s__C Jun 9 '14 at 7:34