Plotting with restricted fills

The function defined here allows the creation of plots with control of the domain of the fill. To use the function it is necessary to load two packages.

Essential packages

Needs["Graphics`FilledPlot`"];Needs["Utilities`FilterOptions`"];

The function

RestrictedFillPlot[func_,{var_,varmin_,varmax_},fillrng_,opts___?OptionQ]:= 
Module[{plt1,plt2},
fn[tt_]:= If[Head[func]===Symbol&&func=!=var,func[tt],func/.var->tt];
showfunc = DisplayFunction ->( DisplayFunction/.{opts}/.DisplayFunction -> $DisplayFunction);
plt1 = FilledPlot[fn[tt],Flatten[{tt,fillrng}],DisplayFunction -> Identity,opts];
plt2= Plot[fn[var],{var,varmin,varmax},DisplayFunction -> Identity,Evaluate[FilterOptions[Plot,{opts}]]];
Show[{plt1,plt2},showfunc]
]

An example

The third argument to RestrictedFillPlot specifies the domain of the fill. The function takes all options available to Plot or FilledPlot.

RestrictedFillPlot[(x^2),{x,-1,3},{1,2},PlotStyle -> Hue[.95]]