# [Tex/LaTex] How to draw areas between curves of the form $x=f(y)$ and $x=g(y)$

fillbetweenpgfplots

I want to shade the region between two curves whose equations are of the form $x=f(y)$ and $x=g(y)$, where $f(y)\leq g(y)$ for all $y\in [c,d]$. I heard that pgfplots can be used. Also, the fillbetween library doesn't load in my Mac. Can you help me with this, guys? I want something like this one:

I used GeoGebra to generate the image. Thanks a lot!

Here is a suggestion using the fillbetween library and soft clip to domain y:

\addplot[thick,name path=P] ({.5*(x-2)^2+.5},{x})node[pos=0.92,above]{x=f(y)};
\addplot[red!80!black!40] fill between [of=P and Q, soft clip={domain y=\C:\D},reverse=true];


Code:

\documentclass[margin=5mm]{standalone}

\usepackage{lmodern}
\usepackage{pgfplots}
\pgfplotsset{compat=1.10}% version 1.10 of pgfplots is needed
\usepgfplotslibrary{fillbetween}

\newcommand\C{}
\newcommand\D{}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=-.5,xmax=3,
axis lines*=middle,
xtick=\empty,
ytick=\empty,
height=10cm,
samples=200,
]
\def\C{1}
\def\D{3}