I am using ParametricPlot to get an X vs Y plot. I want to shade the area enclosed by the curve falling in the region where Y<0.

For example, how to shade the area enclosed by the Sin curve where Sin[x]<0?

ParametricPlot[{x, Sin[x]}, {x, 0, 10}]


• If you're just plotting $y=f(x)$, it's simpler to use Plot[] with its Filling option... Commented Aug 28, 2012 at 5:25

 ParametricPlot[{ u, If[Sin[u] < 0, v, 1] Sin[u]},
{u, -2 Pi, 2 Pi}, {v, 0, 1},
AspectRatio -> 1, Mesh -> False,
PlotStyle -> Directive[Red, Opacity[.8]]]


ParametricPlot[{ u, If[Sin[u] < 0, v, 1] Sin[u]},
{u, -2 Pi, 2 Pi}, {v, 0, 1},
Mesh -> False, AspectRatio -> 1,
ColorFunction -> Function[{x, y, u, v}, Hue[v]],
PlotPoints -> 100]


Update: Few alternatives that use {u, v Sin[u]} as the first argument of ParametricPlot:

Using ColorFunction:

ParametricPlot[{ u, v Sin[u]}, {u, -2 Pi, 2 Pi}, {v, 0, 1},
AspectRatio -> 1, Mesh -> False,
ColorFunction -> (If[Sin[#1] > 0, White, Red] &),
ColorFunctionScaling -> False,
PlotPoints -> 100]


Using Mesh, MeshFunctions and MeshStyle:

ParametricPlot[{u, v Sin[u]}, {u, -2 Pi, 2 Pi}, {v, 0, 1},
AspectRatio -> 1,
Mesh -> {{0.}},
MeshFunctions -> {Function[{x, y, u, v}, y]},
PlotPoints -> 100]

• All these solutions are extremely slow in case if you have a time-consuming function instead of Sin[u]. Timing is much smaller if the second variable v is dropped and no filling is made. Commented Jan 31, 2023 at 4:54

You could do:

ParametricPlot[{{x, Sin[x]}, {x, y}}, {x, 0, 2 Pi}, {y, 0, Min[0, Sin@x]},
Mesh -> None, PlotPoints -> 50, PlotRange -> {{0, 2 Pi}}]


Edit

Using Plot[] is much easier

Plot[Sin@x, {x, 0, 2 Pi}, Filling -> {1 -> {Axis, {Yellow, None}}}]


• As always, credit to Heike for her torn[] magic, and to Szabolcs for his super-hyper image uploader palette Commented Aug 28, 2012 at 6:18
• torn[] - tearing apart all context and courtesy by unasked for boldness, since no idea when! Thank you for the visual harassment I guess ^^ Commented Nov 24, 2014 at 2:33

Evaluation is faster than Verde's solution plus this little deviation close to the intersection is gone: Make a second plot of y Min[Sin[x],0.0] with y as an additional variable, so you can use the mesh to fill the area.

ParametricPlot[{{x, Sin[x]}, {x,y Min[Sin[x],0.0]}},
{x, 0, 2 Pi }, {y, 0, 1}, PlotRange -> All, AspectRatio -> 1, Mesh -> False]


But it does not work perfectly, e.g. for a filling sin(x)<0.1.

• Sadly I don't have enough reputation to post an image. Commented Aug 28, 2012 at 6:06
• I did it for you ... now you have some rep Commented Aug 28, 2012 at 6:08
• Hi! welcome to Mathematica.SE! Please consider registering your account so that any upvotes you get on this answer are added to those you might get on future questions and answers. That way, over time you will be able to do more on the site (post graphics, edit things, etc). Commented Aug 28, 2012 at 6:11
• Thanks a lot. I will try to collect some more points now :) Commented Aug 28, 2012 at 8:08