How fill all the area under the curve?

Question:

I have the next code

plt.plot(t,w_rot)
plt.fill_between(t, w_rot, 0, w_rot>0, color='b')
plt.fill_between(t, w_rot, 0, w_rot<0, color='r')

and the plot result varies of the value of the resolution, if I have a higher resolution of data the area it’s filled completely:
enter image description here

If I have a lower resolution of data the filled area looks like this:
enter image description here

The dt variable it’s the interval between time samples in seconds, length it’s the total length of the pulse in seconds.

How can the area be completely full in both scenarios?

Asked By: John

||

Answers:

try (see example)

interpolate=True
Answered By: Chris Seeling
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.