4
$\begingroup$

I recently answered a question on the stats SE site which involved a $\text{Sinc}^2$ distribution with pdf:

f = (Sin[x]^2)/(Pi x^2)

... defined on the real line. Plotting it with code such as:

Plot[f, {x, -15, 15}, PlotRange -> All, AxesLabel -> {"x", "f"}]

yields:


(source: tri.org.au)

Another user commented that the plot seems to have a visual aberration ... it appears as though the pdf becomes negative each time it hits the $x$-axis (which it cannot actually do). Perhaps this is because the plotted curve is thicker than $x$-axis curve --- using PlotStyle -> Thin seems to alleviate the problem. On the other hand, the problem becomes worse if I generate the picture, and then re-size it to be smaller, or use say ImageSize -> 300.

I am wondering to what extent this is a visual aberration or a Mma plotting aberration? Is Mma actually plotting the curve below the axis - because that is how it appears?

$\endgroup$
  • 2
    $\begingroup$ It's visual - a combination of the interpolation and thickness of the line. When I have a plot where this artifact happens and it bugs me, I just add an appropriately tiny y offset to the function. $\endgroup$ – ciao Jun 7 '16 at 5:33
  • $\begingroup$ Does AxesStyle -> Thick satisfy you? $\endgroup$ – thedude Jun 7 '16 at 5:36
  • 1
    $\begingroup$ Go with Frame->True $\endgroup$ – user9660 Jun 7 '16 at 5:46
  • 1
    $\begingroup$ I am using MMA 10.4.0 on Win7-64, and my system produces a graph that just seems to be touching the horizontal axis, rather than going past it towards negative values (example). Perhaps this behavior is version / OS / graphics dependent. $\endgroup$ – MarcoB Jun 7 '16 at 16:02
  • $\begingroup$ I am also not seeing this behavior on Win7-64 with MMa 10.4.1. BTW is there a reason for not using something like Sinc2Distribution = ProbabilityDistribution[ f[x], {x, -Infinity, Infinity}] and then using PDF[Sinc2Distribution][x] within the Plot? $\endgroup$ – gwr Jun 28 '16 at 11:32
2
$\begingroup$

If I force the axes to cross at the origin with AxesOrigin -> {0, 0}, I see only the expected tangencies:

Plot[Sinc[x]^2/π, {x, -15, 15}, AxesOrigin -> {0, 0}, PlotRange -> All]

plot

$\endgroup$
  • $\begingroup$ And also all should be double real roots. $\endgroup$ – Narasimham May 1 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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