df = load_test_df()
plot_timeseries(df.Low, df.Close, df.High, add_legend=True)
def plot_two_color_line(
s:Series, # Data to plot as a pd.Series with DateTimeIndex
cond:pandas.Series | numpy.ndarray, # boolean condition defining the colors to apply (same length as s)
cond_labels:tuple=('Up', 'Down'), # labels for the condition to be used in the legend
ax:matplotlib.axes._axes.Axes | None=None, # ax where to plot; if None, a new figure and ax will be created and shown
linestyle:str='-', # '-' or 'solid'; '--' or 'dashed'; ':' or 'dotted'; '-.' or 'dashdot'
figsize:tuple=(10, 6), colors:tuple=('#0D8821', '#D13F05')
):

It is also possible to add a conditional line to an existing axes
df = load_test_df()
df['R'] = df.Close.pct_change()
cond = df['R'] > 0
fig, ax = plt.subplots(figsize=(10, 6))
plot_two_color_line(df['Close'], cond, ax=ax)
plot_two_color_line(df['Open'], cond, ax=ax, linestyle=':')
plot_two_color_line(df['High'], cond, ax=ax, linestyle='--')
plot_two_color_line(df['Low'], cond, ax=ax, linestyle='-.')
plt.show()