Skip to content

Commit 8bf4874

Browse files
more kwarg descriptions for mpf.plot()
1 parent da0b6bc commit 8bf4874

File tree

1 file changed

+40
-16
lines changed

1 file changed

+40
-16
lines changed

src/mplfinance/plotting.py

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -133,19 +133,21 @@ def _valid_plot_kwargs():
133133
'Validator' : lambda value: _kwarg_not_implemented(value) },
134134

135135
'marketcolor_overrides' : { 'Default' : None,
136-
'Description' : '',
136+
'Description' : 'sequence of color objects to override market colors.'+
137+
'sequence must be same length as ohlc(v) DataFrame. Each'+
138+
'color object may be a color, marketcolor object, or None.',
137139
'Validator' : _mco_validator },
138140

139141
'mco_faceonly' : { 'Default' : False, # If True: Override only the face of the candle
140-
'Description' : '',
142+
'Description' : 'True/False marketcolor_overrides only apply to face of candle.',
141143
'Validator' : lambda value: isinstance(value,bool) },
142144

143145
'no_xgaps' : { 'Default' : True, # None means follow default logic below:
144146
'Description' : '',
145147
'Validator' : lambda value: _warn_no_xgaps_deprecated(value) },
146148

147149
'show_nontrading' : { 'Default' : False,
148-
'Description' : '',
150+
'Description' : 'True/False show spaces for non-trading days/periods',
149151
'Validator' : lambda value: isinstance(value,bool) },
150152

151153
'figscale' : { 'Default' : None, # scale base figure size up or down.
@@ -184,31 +186,34 @@ def _valid_plot_kwargs():
184186
'Validator' : lambda value: isinstance(value,(str,dict)) },
185187

186188
'ylabel' : { 'Default' : 'Price', # y-axis label
187-
'Description' : '',
189+
'Description' : 'label for y-axis of main plot',
188190
'Validator' : lambda value: isinstance(value,str) },
189191

190192
'ylabel_lower' : { 'Default' : None, # y-axis label default logic below
191-
'Description' : '',
193+
'Description' : 'label for y-axis of volume',
192194
'Validator' : lambda value: isinstance(value,str) },
193195

194196
'addplot' : { 'Default' : None,
195-
'Description' : '',
197+
'Description' : 'addplot object or sequence of addplot objects (from `mpf.make_addplot()`)',
196198
'Validator' : lambda value: isinstance(value,dict) or (isinstance(value,list) and all([isinstance(d,dict) for d in value])) },
197199

198200
'savefig' : { 'Default' : None,
199-
'Description' : '',
201+
'Description' : 'file name, or BytesIO, or dict with key `fname` plus other keys allowed as '+
202+
' kwargs to matplotlib `Figure.savefig()`',
200203
'Validator' : lambda value: isinstance(value,dict) or isinstance(value,str) or isinstance(value, io.BytesIO) or isinstance(value, os.PathLike) },
201204

202205
'block' : { 'Default' : None,
203-
'Description' : '',
206+
'Description' : 'True/False wait for figure to be closed before returning',
204207
'Validator' : lambda value: isinstance(value,bool) },
205208

206209
'returnfig' : { 'Default' : False,
207-
'Description' : '',
210+
'Description' : 'return Figure and list of Axes objects created by mplfinance;'+
211+
' user must display plot when ready, usually by calling `mpf.show()`',
208212
'Validator' : lambda value: isinstance(value,bool) },
209213

210214
'return_calculated_values' : { 'Default' : None,
211-
'Description' : '',
215+
'Description' : 'set to a variable containing an empty dict; `mpf.plot()` will fill'+
216+
' the dict with various mplfinance calculated values',
212217
'Validator' : lambda value: isinstance(value, dict) and len(value) == 0},
213218

214219
'set_ylim' : { 'Default' : None,
@@ -221,7 +226,7 @@ def _valid_plot_kwargs():
221226
and all([isinstance(v,(int,float)) for v in value])},
222227

223228
'xlim' : { 'Default' : None,
224-
'Description' : 'Limits for x-axis as tuple (min, max), i.e. (left,right)',
229+
'Description' : 'Limits for x-axis as tuple (min,max), i.e. (left,right)',
225230
'Validator' : lambda value: _xlim_validator(value) },
226231

227232
'set_ylim_panelB' : { 'Default' : None,
@@ -230,23 +235,42 @@ def _valid_plot_kwargs():
230235

231236
'hlines' : { 'Default' : None,
232237
'Description' : '',
238+
'Description' : 'Draw one or more HORIZONTAL LINES across entire plot, by'+
239+
' specifying a price, or sequence of prices. May also be a dict'+
240+
' with key `hlines` specifying a price or sequence of prices, plus'+
241+
' one or more of the following keys: `colors`, `linestyle`,'+
242+
' `linewidths`, `alpha`.',
233243
'Validator' : lambda value: _hlines_validator(value) },
234244

235245
'vlines' : { 'Default' : None,
236-
'Description' : '',
246+
'Description' : 'Draw one or more VERTICAL LINES across entire plot, by'+
247+
' specifying a date[time], or sequence of date[time]. May also'+
248+
' be a dict with key `vlines` specifying a date[time] or sequence'+
249+
' of date[time], plus one or more of the following keys:'+
250+
' `colors`, `linestyle`, `linewidths`, `alpha`.',
237251
'Validator' : lambda value: _vlines_validator(value) },
238252

239253
'alines' : { 'Default' : None,
240-
'Description' : '',
254+
'Description' : 'Draw one or more ARBITRARY LINES anywhere on the plot, by'+
255+
' specifying a sequence of two or more date/price pairs, or by'+
256+
' specifying a sequence of sequences of two or more date/price pairs.'+
257+
' May also be a dict with key `alines` (as date/price pairs described above),'+
258+
' plus one or more of the following keys:'+
259+
' `colors`, `linestyle`, `linewidths`, `alpha`.',
241260
'Validator' : lambda value: _alines_validator(value) },
242261

243262
'tlines' : { 'Default' : None,
244-
'Description' : '',
263+
'Description' : 'Draw one or more TREND LINES by specifying one or more pairs of date[times]'+
264+
' between which each trend line should be drawn. May also be a dict with key'+
265+
' `tlines` as just described, plus one or more of the following keys:'+
266+
' `colors`, `linestyle`, `linewidths`, `alpha`, `tline_use`,`tline_method`.',
245267
'Validator' : lambda value: _tlines_validator(value) },
246268

247269
'panel_ratios' : { 'Default' : None,
248-
'Description' : '',
249-
'Validator' : lambda value: isinstance(value,(tuple,list)) and len(value) <= 10 and
270+
'Description' : 'sequence of numbers indicating relative sizes of panels; sequence len'+
271+
' must be same as number of panels, or len 2 where first entry is for'+
272+
' main panel, and second entry is for all other panels',
273+
'Validator' : lambda value: isinstance(value,(tuple,list)) and len(value) <= 32 and
250274
all([isinstance(v,(int,float)) for v in value]) },
251275

252276
'main_panel' : { 'Default' : 0,

0 commit comments

Comments
 (0)