TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to fill the area of a region R bounded by x=f(y), x=g(y), y=A and y=B. For example, R is bounded by x=0, x=2/y, y=1 and y=4.

share|improve this question
Does tex.stackexchange.com/questions/17517/… help? – Peter Grill Jun 22 '11 at 19:26

A solution with TikZ :


\begin{tikzpicture}[scale=2,domain=0.4:5] \draw[very thin,color=gray] (-0.1,-0.1) grid (5,5);
\draw[->] (-0.2,0) -- (5.2,0) node[right] (axex) {$x$}; \
\draw[->] (0,-0.2) -- (0,5.2) node[above] {$f(x)$};     
\draw[color=red,samples=100]    plot (\x,2/\x)  node[right] {$f(x) =\frac{2}{x}$};
\path[clip] (0,1) rectangle (5,4);    
\path[fill=gray!50,opacity=.5] (0,0)--(0,4)--plot (\x,2/\x)-|(axex)--cycle;

enter image description here

share|improve this answer
the solution can be adapted if y=1.25 \path[clip] (0,1.25) rectangle (5,4); – Alain Matthes Jun 23 '11 at 9:19

run it with xelatex





enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.