-
Notifications
You must be signed in to change notification settings - Fork 660
Un identified legends #497
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
Comments
It appears to me that, in addition to the moving averages, I have, in the past, spent some time looking into supporting legends in mplfinance. It seems to be that generally one does not want legends for the candles themselves, but only for moving averages, and/or for There is a PR (#277) for something along these lines, but upon testing it I found it incomplete and not correctly handling all cases, so for now I have not merged the code. When I, or someone else, has time to go through it and make the code more complete, handling all All the best. P.S. I have posted to discourse.matplotlib.org to see if there is an easy way around this. |
Your post on at posted to discourse.matplotlib.org , response from the other forum helped. mav_titles = ['_not wanted','_not wanted','9 SMA' ,'50 SMA', '200 SMA' ] Solving issue with a user warning message. test.py:11: UserWarning: The handle <matplotlib.collections.LineCollection object at 0x7f692ca5eee0> has a label of '_not wanted' which cannot be automatically added to the legend. |
As per https://matplotlib.org/stable/tutorials/intermediate/legend_guide.html "Those artists with an empty string as label or with a label starting with "_" will be ignored." |
Hi,
Can someone help me in identifying, new legends displayed on the plot. I'm adding 2 empty entries in mav_titles to match SMA colors
mav_titles = ['','','9 SMA' ,'50 SMA', '200 SMA' ]

fig, axes = mpf.plot(df,type='candle',mav=(9,50,200),volume=True,returnfig=True, style='yahoo')
axes[0].legend(mav_titles)
axes[0].set_title(ticker)
Thank you.
The text was updated successfully, but these errors were encountered: