Skip to content

Commit

Permalink
Feature Update Without Color matplotlib#625
Browse files Browse the repository at this point in the history
Feature Update Without Color matplotlib#625
  • Loading branch information
DrChandrakant committed Jun 9, 2023
1 parent 485d434 commit 64585ce
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/mplfinance/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,8 @@ def _plot_mav(ax,config,xdates,prices,apmav=None,apwidth=None):

mavc = config['_ma_color_cycle']

list_ploted_mav =[]

for idx,mav in enumerate(mavgs):
mean = pd.Series(prices).rolling(mav).mean()
if shift is not None:
Expand All @@ -1204,9 +1206,14 @@ def _plot_mav(ax,config,xdates,prices,apmav=None,apwidth=None):
lw = config['_width_config']['line_width']
if mavc:
ax.plot(xdates, mavprices, linewidth=lw, color=next(mavc))
list_ploted_mav.append(mean.values[-1].round(1))
else:
ax.plot(xdates, mavprices, linewidth=lw)
list_ploted_mav.append(mean.values[-1].round(1))
mavp_list.append(mavprices)
yticks = [*ax.get_yticks()] + list_ploted_mav
yticklabels = [*ax.get_yticklabels()]+list_ploted_mav
ax.set_yticks(yticks, labels=yticklabels)
return mavp_list


Expand Down

0 comments on commit 64585ce

Please sign in to comment.