I have 2 arrays:
tiempos dtype='datetime64[ns]'
valores dtype=float32
I want to use plt.fill_between to color some parts of the graphic
fig = plt.figure(figsize=(14, 8))
plt.fill_between(tiempos,valores.where(valores>=0.5), 0.5, color='red', alpha=0.8)
plt.fill_between(tiempos, valores.where(valores<=-0.5), -0.5, color='blue', alpha=0.3)
plt.plot(tiempos,valores,color='black')
But when i run the code i get this error:
AttributeError: 'numpy.ndarray' object has no attribute 'where'
How can i plot this with those two arrays?
Thanks in advance.