Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
  • Loading branch information
mrclary and ccordoba12 committed May 29, 2024
1 parent fecd4fb commit 6b88c6d
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions spyder_kernels/console/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,17 +560,19 @@ def set_matplotlib_conf(self, conf):
'figure_formats', conf[figure_format_n]
)

rc = {}
inline_rc = {}
if resolution_n in conf:
rc.update({'figure.dpi': conf[resolution_n]})
inline_rc.update({'figure.dpi': conf[resolution_n]})
if width_n in conf and height_n in conf:
rc.update({'figure.figsize': (conf[width_n], conf[height_n])})
inline_rc.update({'figure.figsize': (conf[width_n], conf[height_n])})
if fontsize_n in conf:
rc.update({'font.size': conf[fontsize_n]})
inline_rc.update({'font.size': conf[fontsize_n]})
if bottom_n in conf:
rc.update({'figure.subplot.bottom': conf[bottom_n]})
if rc:
self._set_inline_config_option('rc', rc)
inline_rc.update({'figure.subplot.bottom': conf[bottom_n]})

# Update Inline backend parameters, if available.
if inline_rc:
self._set_inline_config_option('rc', inline_rc)

if bbox_inches_n in conf:
bbox_inches = 'tight' if conf[bbox_inches_n] else None
Expand All @@ -589,13 +591,13 @@ def set_matplotlib_conf(self, conf):
pylab_backend_o = conf.get(pylab_backend_n, current_backend)
backend_changed = current_backend != pylab_backend_o
if (
current_backend == 'inline' and rc
current_backend == 'inline' and inline_rc
and not backend_changed
and interactive_backend not in ('inline', -1)
):
self._set_mpl_backend(interactive_backend)
if (
(current_backend == 'inline' and rc) # toggle back to inline
(current_backend == 'inline' and inline_rc) # toggle back to inline
or pylab_autoload_o
or backend_changed
):
Expand Down Expand Up @@ -976,6 +978,7 @@ def _set_inline_config_option(self, option, value):
self.config['InlineBackend'].update({option: value})
else:
self.config.update({'InlineBackend': {option: value}})

value = self.config['InlineBackend'][option]

if isinstance(value, LazyConfigValue):
Expand Down

0 comments on commit 6b88c6d

Please sign in to comment.