Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to use a condition to color "fill_between" clouds #382

Open
gabrsafwat opened this issue Nov 9, 2022 · 2 comments
Open
Labels
bug Something isn't working

Comments

@gabrsafwat
Copy link

I tried to use the "fill_between" like I used to use it with matplotlib.pyplot:

fplt.fill_between(ma09_line, ma20_line, where=ma09>ma20, color='green')
fplt.fill_between(ma09_line, ma20_line, where=ma09<ma20, color='red')

but it seems like there is no "where" keyword argument defined in the source code.
How can I color the cloud based on a condition?

@gabrsafwat gabrsafwat added the bug Something isn't working label Nov 9, 2022
@highfestiva
Copy link
Owner

See #267.

@gabrsafwat
Copy link
Author

similar question;
is there a way to color the plotted line based on a value?
in my case, I want to plot the line segment with "spread > 0" with a color and "spread <= 0" with another color

fast_ema = df.Close.ewm(span=3).mean()
slow_ema = df.Close.ewm(span=8).mean()
spread = (fast_ema - slow_ema) * 1.001
ax.set_visible(ygrid=True)
#The code below didn't work
color = '#ff2d00' if spread.all() < 0 else '#20932d'
fplt.plot(spread, ax=ax, legend='AK-Trend', color=color)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants