Skip to content

Rewrite an argument check to _check_getitem #14565

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 1 commit into from
Jul 25, 2019
Merged
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
14 changes: 4 additions & 10 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2811,21 +2811,15 @@ def ticklabel_format(self, *, axis='both', style='', scilimits=None,
m + n + 1 # check that both are numbers
except (ValueError, TypeError):
raise ValueError("scilimits must be a sequence of 2 integers")
if style[:3] == 'sci':
sb = True
elif style == 'plain':
sb = False
elif style == '':
sb = None
else:
raise ValueError("%s is not a valid style value")
STYLES = {'sci': True, 'scientific': True, 'plain': False, '': None}
is_sci_style = cbook._check_getitem(STYLES, style=style)
axis_map = {**{k: [v] for k, v in self._get_axis_map().items()},
'both': self._get_axis_list()}
axises = cbook._check_getitem(axis_map, axis=axis)
try:
for axis in axises:
if sb is not None:
axis.major.formatter.set_scientific(sb)
if is_sci_style is not None:
axis.major.formatter.set_scientific(is_sci_style)
if scilimits is not None:
axis.major.formatter.set_powerlimits(scilimits)
if useOffset is not None:
Expand Down