Skip to content

Removed if (plottype not in _valid_types_all) ... and also num_panels = config['num_panels'] #507

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

Merged
merged 6 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/mplfinance/_arg_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,9 @@ def _get_valid_plot_types(plottype=None):

if plottype is None:
return _valid_types_all

if plottype not in _valid_types_all:
return None
elif plottype in _alias_types:
return _alias_types[plottype]
else:
return plottype
return plottype


def _mav_validator(mav_value):
Expand Down
12 changes: 6 additions & 6 deletions src/mplfinance/_panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ def _build_panels( figure, config ):
------
The following items are used from `config`:

num_panels : integer (0-9) or None
num_panels : integer (0-31) or None
number of panels to create

addplot : dict or None
value for the `addplot=` kwarg passed into `mplfinance.plot()`

volume_panel : integer (0-9) or None
volume_panel : integer (0-31) or None
panel id (0-number_of_panels)

main_panel : integer (0-9) or None
main_panel : integer (0-31) or None
panel id (0-number_of_panels)

panel_ratios : sequence or None
Expand Down Expand Up @@ -68,7 +68,7 @@ def _build_panels( figure, config ):
panel_ratios = config['panel_ratios']

if not _valid_panel_id(main_panel):
raise ValueError('main_panel id must be integer 0 to 9, but is '+str(main_panel))
raise ValueError('main_panel id must be integer 0 to 31, but is '+str(main_panel))

if num_panels is None: # then infer the number of panels:
pset = {0} # start with a set including only panel zero
Expand All @@ -85,12 +85,12 @@ def _build_panels( figure, config ):
if panel in backwards_panel_compatibility:
panel = backwards_panel_compatibility[panel]
if not _valid_panel_id(panel):
raise ValueError('addplot panel must be integer 0 to 9, but is "'+str(panel)+'"')
raise ValueError('addplot panel must be integer 0 to 31, but is "'+str(panel)+'"')
pset.add(panel)

if volume is True:
if not _valid_panel_id(volume_panel):
raise ValueError('volume_panel must be integer 0 to 9, but is "'+str(volume_panel)+'"')
raise ValueError('volume_panel must be integer 0 to 31, but is "'+str(volume_panel)+'"')
pset.add(volume_panel)

pset.add(main_panel)
Expand Down
2 changes: 1 addition & 1 deletion src/mplfinance/_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

version_info = (0, 12, 8, 'beta', 9)
version_info = (0, 12, 8, 'beta', 10)

_specifier_ = {'alpha': 'a','beta': 'b','candidate': 'rc','final': ''}

Expand Down
10 changes: 5 additions & 5 deletions src/mplfinance/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,18 +855,18 @@ def plot( data, **kwargs ):
save = config['savefig']
if isinstance(save,dict):
if config['tight_layout'] and 'bbox_inches' not in save:
plt.savefig(**save,bbox_inches='tight')
fig.savefig(**save,bbox_inches='tight')
else:
plt.savefig(**save)
fig.savefig(**save)
else:
if config['tight_layout']:
plt.savefig(save,bbox_inches='tight')
fig.savefig(save,bbox_inches='tight')
else:
plt.savefig(save)
fig.savefig(save)
if config['closefig']: # True or 'auto'
plt.close(fig)
elif not config['returnfig']:
plt.show(block=config['block']) # https://stackoverflow.com/a/13361748/1639359
plt.show(block=config['block']) # https://stackoverflow.com/a/13361748/1639359
if config['closefig'] == True or (config['block'] and config['closefig']):
plt.close(fig)

Expand Down