# Why does Plot leave gaps in the graph of a continuous function? [duplicate]

I have plotted the overlapping area of the UnitBox and the triangle function as:

Plot[Evaluate[
Integrate[
Piecewise[{{1, -0.5 <= x < 0.5}, {0, Not[-0.5 <= x < 0.5]}}]
Piecewise[{{x + 1 - a, -1 + a <= x <= 0 + a}, {-x + 1 + a, 0 + a <= x <= 1 + a}}],
{x, -Infinity, +Infinity}]],
{a, -2, 2}, PlotRange -> All]


However, the result has gaps as you can see in the plot:

Why is this happening if the function is continuous?

• You can use Exclusions -> None. – b.gates.you.know.what Feb 20 '13 at 12:01
• Possible duplicate: mathematica.stackexchange.com/q/4797/12 – Szabolcs Feb 20 '13 at 17:49
• – kglr Feb 21 '13 at 1:11
• Thanks for the replies. However I knew that Exclusions->None solved the problem. I wanted to know the reason for those "exclusions" and Belisarius gave it to me. – José Antonio Díaz Navas Feb 26 '13 at 18:50

Plot[] is excluding the discontinuities in the second derivative:

f[x_, a_] := Integrate[
Piecewise[{{1, -0.5 <= x < 0.5}, {0, Not[-0.5 <= x < 0.5]}}]
Piecewise[{{x + 1 - a, -1 + a <= x <= 0 + a}, {-x + 1 + a, 0 + a <= x <= 1 + a}}],
{x, -Infinity, +Infinity}]

Plot[Evaluate[D[f[x, a], a]], {a, -2, 2}]


As @b,gatessucks mentioned in a comment, using Exclusions->None solves the issue:

Plot[Evaluate[f[x, a]], {a, -2, 2}, PlotRange -> All, Exclusions -> None]


• Thanks a lot!! This is the answer I was looking for. I knew that I could "fill the gaps" with "Exclusions" Option. However, I wanted to know the reason. – José Antonio Díaz Navas Feb 26 '13 at 18:49