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?

1 Answer 1

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)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.