# Filling without boundaries

How to fill the area between two curves, but without plotting those curves?

For example,

Plot[Sin[x], {x, 0, 2 Pi}, Filling -> {1 -> 0.5}]

gives a plot like this (0.5 without any marked boundary = form required for a generalization)

but Plot[Sin[x], {x, 0, 2 Pi}, Filling -> {1 -> (Sin[x] - 0.5)}]

draws a plot without filling or even gives an error

• PlotStyle -> None?
– Kuba
Dec 1, 2017 at 12:58
• wow, thank you @Kuba Dec 1, 2017 at 13:18

In addition to using PlotStyle->None as suggested by @Kuba, you can also do:

Post-process to remove the Line primitives:

Plot[Sin[x], {x, 0, 2 Pi}, Filling -> {1 -> 0.5}] /. _Line :> Sequence[] Plot[{Sin[x], Sin[x] - 0.5}, {x, 0, 2 Pi}, Filling -> {1 -> {2}}] /. _Line :> Sequence[] Use ParametricPlot with options BoundaryStyle -> None and Mesh -> None:

ParametricPlot[{x, t Sin[x] + (1 - t) .5}, {x, 0, 2 Pi}, {t, 0, 1},
BoundaryStyle -> None, Mesh -> None, AspectRatio -> 1/GoldenRatio, Frame -> False] ParametricPlot[{x, t Sin[x] + (1 - t) (Sin[x] - 0.5)}, {x, 0, 2 Pi}, {t, 0, 1},
BoundaryStyle -> None, Mesh -> None, AspectRatio -> 1/GoldenRatio, Frame -> False] • Would there is a reason for RuleDelayed here /. _Line :> Sequence[] instead of just Rule?
– hana
Mar 9, 2022 at 11:24
• @hana, no reason (just habitual use of :> when there is a pattern on the LHS)
– kglr
Mar 10, 2022 at 0:11