0

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?

skyline
  • 1
  • 2

1 Answers1

0

ok I solved. I just needed a more thourough research (Plot Multicolored line based on conditional in python). Sorry. Free to delete this (or at least mark as duplicate in order to redirect to the other answer)

Community
  • 1
  • 1
skyline
  • 1
  • 2