@@ -687,7 +687,7 @@ def plot( data, **kwargs ):
687
687
aptype = apdict ['type' ]
688
688
if aptype == 'ohlc' or aptype == 'candle' :
689
689
ax = _addplot_collections (panid ,panels ,apdict ,xdates ,config )
690
- _addplot_apply_supplements (ax ,apdict )
690
+ _addplot_apply_supplements (ax ,apdict , xdates )
691
691
else :
692
692
apdata = apdict ['data' ]
693
693
if isinstance (apdata ,list ) and not isinstance (apdata [0 ],(float ,int )):
@@ -700,7 +700,7 @@ def plot( data, **kwargs ):
700
700
for column in apdata :
701
701
ydata = apdata .loc [:,column ] if havedf else column
702
702
ax = _addplot_columns (panid ,panels ,ydata ,apdict ,xdates ,config )
703
- _addplot_apply_supplements (ax ,apdict )
703
+ _addplot_apply_supplements (ax ,apdict , xdates )
704
704
705
705
# fill_between is NOT supported for external_axes_mode
706
706
# (caller can easily call ax.fill_between() themselves).
@@ -1045,7 +1045,7 @@ def _addplot_columns(panid,panels,ydata,apdict,xdates,config):
1045
1045
1046
1046
return ax
1047
1047
1048
- def _addplot_apply_supplements (ax ,apdict ):
1048
+ def _addplot_apply_supplements (ax ,apdict , xdates ):
1049
1049
if (apdict ['ylabel' ] is not None ):
1050
1050
ax .set_ylabel (apdict ['ylabel' ])
1051
1051
if apdict ['ylim' ] is not None :
@@ -1059,6 +1059,11 @@ def _addplot_apply_supplements(ax,apdict):
1059
1059
ax .set_yscale (yscale ,** ysd )
1060
1060
elif isinstance (ysd ,str ):
1061
1061
ax .set_yscale (ysd )
1062
+ # added by Wen
1063
+ if "fill_between" in apdict and apdict ['fill_between' ] is not None :
1064
+ fb = apdict ['fill_between' ]
1065
+ fb ['x' ] = xdates
1066
+ ax .fill_between (** fb )
1062
1067
1063
1068
def _set_ylabels_side (ax_pri ,ax_sec ,primary_on_right ):
1064
1069
# put the primary axis on one side,
@@ -1234,6 +1239,10 @@ def _valid_addplot_kwargs():
1234
1239
" style\' s marketcolors). For addplot `type='ohlc'`" +
1235
1240
" and type='candle'" ,
1236
1241
'Validator' : lambda value : _is_marketcolor_object (value ) },
1242
+ 'fill_between' : { 'Default' : None , # added by Wen
1243
+ 'Description' : " fill region" ,
1244
+ 'Validator' : lambda value : isinstance (value ,dict ) },
1245
+
1237
1246
}
1238
1247
1239
1248
_validate_vkwargs_dict (vkwargs )
0 commit comments