Split up init_backend to init_matplotlib

This commit is contained in:
Anne de Jong 2018-10-11 08:16:51 +02:00 committed by J.A. de Jong - ASCEE
parent 31243bcc6f
commit be3310285e

View File

@ -11,13 +11,11 @@ _report_quality = False
_init = False _init = False
def init_backend(report_quality=False): def init_matplotlib(report_quality=False):
global _init global _init
if not _init: if not _init:
print('Initializing matplotlib...')
_init = True _init = True
import matplotlib print('Initializing matplotlib...')
matplotlib.use('Qt5Agg')
preamble = [ preamble = [
r'\usepackage{libertine-type1}' r'\usepackage{libertine-type1}'
r'\usepackage[libertine]{newtxmath}' r'\usepackage[libertine]{newtxmath}'
@ -32,9 +30,19 @@ def init_backend(report_quality=False):
'pgf.texsystem': 'pdflatex', 'pgf.texsystem': 'pdflatex',
'pgf.preamble': preamble, 'pgf.preamble': preamble,
} }
import matplotlib
matplotlib.rcParams.update(params) matplotlib.rcParams.update(params)
global _report_quality global _report_quality
_report_quality = report_quality _report_quality = report_quality
def init_backend(report_quality=False):
global _init
if not _init:
_init = True
import matplotlib
matplotlib.use('Qt5Agg')
init_matplotlib(report_quality)
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
plt.ion() plt.ion()