I used the following code to draw a picture. I want to make the region insde (0,7), (0,11),(3,8),(3,4) to be red, and the region above it to be gray, but I don't know how to do this.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}[scale=0.5]
\draw (1.05cm,2pt) node[above];
% {$\displaystyle\int_0^{3/2} \!\!x^2\mathrm{d}x$};
\draw[style=help lines] (0,0) grid (3.9,11.9);
% [step=0.25cm] (1,2) grid +(1,1);
\draw[->] (-1,0) -- (4,0) node[right] {$i$};
\draw[->] (0,-1) -- (0,12) node[above] {$j$};
\foreach \x/\xtext in {1/1, 2/2, 3/3}
\draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$};
\foreach \y/\ytext in {1/, 2/, 3/,4/,5/,6/,7/7,8/, 9/, 10/, 11/11}
\draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
\draw {(0,11) -- (3,8)} node[below right] ;
\draw {(0,7) -- (3,4)} node[below right] ;
\draw {(3,8) -- (3,4)} node[below right] ;
\end{tikzpicture}
\end{document}
Best Answer
For the red shape you could try this. I am not sure what you mean by "above" in this case.
Instead of
nearly transparent
you use theopacity
key, for exampleopacity=0.3
. See pgfmanual Ch. 20.2 for more details.