essentially, in Python, I'd like to conditionally plot a series with a colour changing based on a given, generally defined, condition
import pandas as pd
import matplotlib as plt
a = pd.Series(range(0,10), index=pd.date_range('2011-1-1',periods=10)
a.plot()
# here with the standard color
BUT when a certain condition is met (say func_condition(a) > some_value
) I want my plotted series to change color in the chosen period (in this case, it is a datetime_index
). I saw some topics where scatter_plot
is used to take care of this thing but it was something very standard and with 'points'. I'd like the series to be continuos and I'd like it to be able to take general mapping functions.
Any ideas?