Home > Software engineering >  How fill all the area under the curve?
How fill all the area under the curve?

Time:07-27

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?

CodePudding user response:

try (see example)

interpolate=True
  • Related