% https://alfurka.github.io/quick-tikz/ \def \recA {(-4,-1) rectangle ++(6,3)} \def \lineA {(4,5) -- (-5,-4)} \begin{tikzpicture}[background rectangle/.style={fill=white}, show background rectangle] % Axis \draw (-5,0) -- (5,0); \draw (0,-5) -- (0,5); \draw[step=1,gray,very thin] (-4.8,-4.8) grid (4.8,4.8); % Main shapes \draw[blue] \recA; \draw[red] \lineA; % Intersection \begin{scope} \clip \recA; \draw[pattern=north west lines] \lineA -- (-5,5) -- cycle; \end{scope} \end{tikzpicture}