Skip to content

Commit a4342ac

Browse files
axesoff
1 parent c4e2e19 commit a4342ac

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

src/mplfinance/plotting.py

+18-7
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ def _valid_plot_kwargs():
189189

190190
'xrotation' : { 'Default' : 45,
191191
'Validator' : lambda value: isinstance(value,(int,float)) },
192+
193+
'axesoff' : { 'Default' : False,
194+
'Validator' : lambda value: isinstance(value,bool) },
195+
196+
'axesoffdark' : { 'Default' : False,
197+
'Validator' : lambda value: isinstance(value,bool) },
192198
}
193199

194200
_validate_vkwargs_dict(vkwargs)
@@ -246,7 +252,6 @@ def plot( data, **kwargs ):
246252

247253
fmtstring = _determine_format_string( dates, config['datetime_format'] )
248254

249-
250255
ptype = config['type']
251256

252257
if config['show_nontrading']:
@@ -573,12 +578,18 @@ def plot( data, **kwargs ):
573578
if not used_axC2 and axC2 is not None:
574579
axC2.get_yaxis().set_visible(False)
575580

576-
if config['returnfig']:
577-
axlist = [axA1, axA2]
578-
if axB1: axlist.append(axB1)
579-
if axB2: axlist.append(axB2)
580-
if axC1: axlist.append(axC1)
581-
if axC2: axlist.append(axC2)
581+
axlist = [axA1, axA2]
582+
if axB1: axlist.append(axB1)
583+
if axB2: axlist.append(axB2)
584+
if axC1: axlist.append(axC1)
585+
if axC2: axlist.append(axC2)
586+
587+
if config['axesoffdark']: fig.patch.set_facecolor('black')
588+
if config['axesoff']: fig.patch.set_visible(False)
589+
if config['axesoffdark'] or config['axesoff']:
590+
for ax in axlist:
591+
ax.set_xlim(xdates[0],xdates[-1])
592+
ax.set_axis_off()
582593

583594
if config['savefig'] is not None:
584595
save = config['savefig']

0 commit comments

Comments
 (0)