1
$\begingroup$

This question already has an answer here:

I'm trying to plot $\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]]
$\endgroup$

marked as duplicate by J. M. will be back soon Feb 23 '16 at 18:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3
$\begingroup$
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"]

enter image description here

$\endgroup$
2
$\begingroup$
Plot[
 Sin[x]/x
 , {x, -2 π, 2 π}
 , Filling -> {1 -> {Axis, {Transparent, Automatic}}}
 , AxesLabel -> {"Distance from Slit", "Amplitude"}
 , PlotLabel -> "Single Slit Difraction"
 ]

Mathematica graphics

OR

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

Mathematica graphics

Documentation for Filling

Mathematica graphics

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.