Question: I'm trying to draw this region of the plane

*D* = {(*x,y*) ∈ ℝ2 : *x* ∈ [*a,b*], −x2 +*x* ≤ y ≤ −*x*3+2*x*; 0 ≤ *x* ≤ 1}

this is what I've at the moment

```
\documentclass[preview, convert={size=598x414,outext=.png}]{standalone}
\usepackage{pgfplots,tikz}
\pgfplotsset{compat=1.12}
\begin{document}
            \begin{tikzpicture}
            \begin{axis} [xlabel = x, ylabel = y, axis lines=center]
                \addplot [domain=0:1, smooth] {2*x-x^3};
                \addplot [domain=0:1, smooth] {x-x^2};
        \draw [thick] (1,0) -- (1,1);
            \end{axis}
        \end{tikzpicture}
\end{document}

```

[![enter image description here](https://i.stack.imgur.com/eXj4R.png)](https://i.stack.imgur.com/eXj4R.png)

I need a way to shade the region D and also I'd like to place the label for `x` under the x-axis.

Answer: 
All you need are some minor tweaks to your code.

```
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\pgfplotsset{compat=1.18}
\begin{document}
        \begin{tikzpicture}
            \begin{axis}[ 
                xmax=1.1,
                axis lines=center,
                xlabel=$x$,
                xlabel style={at={(axis description cs:1.01,0.0)},anchor=north},
                ymax=1.1,
                ylabel = $y$
                ]
                \addplot [name path=A,domain=0:1, smooth] {2*x-x^3};
                \addplot [name path=B,domain=0:1, smooth] {x-x^2};
                \addplot [gray!20] fill between[of=A and B];
                \addplot [black] coordinates {(1,0) (1,1)};
            \end{axis}
        \end{tikzpicture}
\end{document}

```

[![enter image description here](https://i.stack.imgur.com/tlNEd.png)](https://i.stack.imgur.com/tlNEd.png)
A way of doing it with MetaPost,included in a LuaLaTeX program, for whom it may interest, using the `buildcycle` macro of Plain MetaPost.

```
\documentclass[border=2mm]{standalone}
\usepackage{luamplib}
    \mplibsetformat{metafun}
    \mplibnumbersystem{decimal}
    \mplibtextextlabel{enable}

\begin{document}
\begin{mplibcode}
    vardef function(expr xmin, xmax, xstep)(text f_x) =
        save x; x := xmin;
        (x, f_x)
        forever: hide(x := x + xstep) exitif x > xmax;
            .. (x, f_x)
        endfor
        if x - xstep < xmax: hide(x := xmax) .. (x, f_x) fi
    enddef;

    vardef f(expr x) = x - x**2 enddef;
    vardef g(expr x) = 2x - x**3 enddef;

    u = v = 8cm; path area; len := 2bp;
    area = buildcycle(
        function(0, 1, .05)(f(x)), 
        (1, f(1)) -- (1, g(1)), 
        function(0, 1, .05)(g(x))
    ) xyscaled (u,v);

    beginfig(1);
        fill area withcolor .8white; draw area; 
        drawarrow origin -- (1.1u, 0); drawarrow origin -- (0,1.1v);
        for i = 0.2 step .2 until 1: 
            draw (i*u, -len) -- (i*u, len); 
            label.bot("$" & decimal i & "$", (i*u, 0));
            draw (-len , i*v) -- (len, i*v); 
            label.lft("$" & decimal i & "$", (0, i*v));
        endfor;
    endfig;
\end{mplibcode}
\end{document}

```

[![enter image description here](https://i.stack.imgur.com/FilUA.png)](https://i.stack.imgur.com/FilUA.png)