How do I fill the positive side of a graph? [duplicate]

This question already has an answer here:

Filling between boundaries

5 answers

I’m trying to plot sin(x)/x\sin(x)/x and fill the positive side. How do I achieve that? I know how to fill the entire axis. Here’s what I have:

Show[Plot[Sin[x]/x, {x, -2 π, 2 π}, Filling -> Axis],
AxesLabel -> {HoldForm[Distance from Slit], HoldForm[Amplitude]},
PlotLabel -> HoldForm[Single Slit Difraction]]

=================

=================

2 Answers
2

=================

Show[
Plot[Sin[x]/x, {x, -2 π, 2 π}],
Plot[Sin[x]/x, {x, 0, 2 π}, Filling -> Axis],
AxesLabel -> {“Distance from Slit”, “Amplitude”},
PlotLabel -> “Single Slit Difraction\n”]

Plot[
Sin[x]/x
, {x, -2 π, 2 π}
, Filling -> {1 -> {Axis, {Transparent, Automatic}}}
, AxesLabel -> {“Distance from Slit”, “Amplitude”}
, PlotLabel -> “Single Slit Difraction”
]

OR

Plot[
Sin[x]/x
, {x, -2 π, 2 π}
, Filling -> Axis
, FillingStyle -> {Transparent, LightBlue}
, AxesLabel -> {“Distance from Slit”, “Amplitude”}
, PlotLabel -> “Single Slit Difraction”
]

Documentation for Filling