mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
check if savefig.format exists in mpl_config.py
This commit is contained in:
parent
da26f5613d
commit
0321fcd3e7
2 changed files with 7 additions and 6 deletions
|
|
@ -71,7 +71,11 @@ def _on_config_change():
|
|||
supported_formats = _config['supported_formats']
|
||||
if fmt not in supported_formats:
|
||||
raise ValueError("Unsupported format %s" %fmt)
|
||||
matplotlib.rcParams['savefig.format'] = fmt
|
||||
|
||||
if matplotlib.__version__ < '1.2.0':
|
||||
matplotlib.rcParams.update({'savefig.format': fmt})
|
||||
else:
|
||||
matplotlib.rcParams['savefig.format'] = fmt
|
||||
|
||||
# Interactive mode
|
||||
interactive = _config['interactive']
|
||||
|
|
@ -80,6 +84,8 @@ def _on_config_change():
|
|||
|
||||
def _init_config():
|
||||
dpi = matplotlib.rcParams['figure.dpi']
|
||||
if matplotlib.__version__ < '1.2.0':
|
||||
matplotlib.rcParams.update({'savefig.format': 'png'})
|
||||
fmt = matplotlib.rcParams['savefig.format']
|
||||
width, height = matplotlib.rcParams['figure.figsize']
|
||||
fontsize = matplotlib.rcParams['font.size']
|
||||
|
|
|
|||
|
|
@ -120,11 +120,6 @@ class PyZeppelinContext(dict):
|
|||
# If we don't have matplotlib installed don't bother continuing
|
||||
try:
|
||||
import matplotlib
|
||||
|
||||
#matplotlib.rcParams['savefig.format'] is only avail in version 1.2.0 and above
|
||||
from distutils.version import LooseVersion
|
||||
if LooseVersion("1.2.0") >= LooseVersion(matplotlib.__version__):
|
||||
return
|
||||
except ImportError:
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue