# Why will my plot not generate my entire plot?

I am trying to plot a sum of multiple HeavisidePi functions. A typical example would be something like this:

Plot[HeavisidePi[1/10 (-595 + x)] + HeavisidePi[1/10 (-535 + x)] +
HeavisidePi[1/10 (-425 + x)] + HeavisidePi[1/10 (-365 + x)], {x,
300, 800}, Exclusions -> None]

In this interval in the code above, I can see all four of them. However, if I were to back out to an interval of {100,800}, for instance, only two of them show up for me (the one at 595 and 425). Any idea why this would be the case?

Any help would be greatly appreciated.

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

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

2

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

There is another way to control the sample points which is effective in this case, where you know in advance where the interesting things happen. PlotPoints takes an optional second argument, which is a list of extra points to be added to the other sample points.

Since in this case we know where the function is nonzero, we can add a point from each region thus: PlotPoints -> {Automatic, {365, 425, 535, 595}}. In this way we can avoid adding unneeded sample points.

Plot[HeavisidePi[1/10 (-595 + x)] + HeavisidePi[1/10 (-535 + x)] +
HeavisidePi[1/10 (-425 + x)] + HeavisidePi[1/10 (-365 + x)],
{x, 100, 800}, Exclusions -> None,
PlotPoints -> {Automatic, {365, 425, 535, 595}}]

– Sjoerd C. de Vries
May 8 ’13 at 13:56

@SjoerdC.deVries I’m afraid I don’t recall precisely – I think a friend, who has worked with some of the developers at WRI. It’s the subject in this question.
– Michael E2
May 8 ’13 at 14:31