report_quality to init_backend.
This commit is contained in:
parent
38d1cfe435
commit
31243bcc6f
@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
from .config import report_quality
|
||||
from .report_tools import *
|
||||
from .config import init_backend
|
||||
from lasp.lasp_common import FreqWeighting, TimeWeighting
|
||||
__all__ = ['report_quality', 'PSPlot', 'LevelBars', 'Levels', 'close',
|
||||
__all__ = ['init_backend',
|
||||
'FreqWeighting', 'TimeWeighting']
|
||||
|
@ -5,26 +5,19 @@ Author: J.A. de Jong - ASCEE
|
||||
|
||||
Description:
|
||||
"""
|
||||
__all__ = ['report_quality', 'getReportQuality']
|
||||
__all__ = ['init_backend', 'getReportQuality']
|
||||
|
||||
_report_quality = False
|
||||
_init = False
|
||||
|
||||
|
||||
def getReportQuality():
|
||||
global _report_quality
|
||||
return _report_quality
|
||||
|
||||
|
||||
def report_quality():
|
||||
import matplotlib as mpl
|
||||
# mpl.use('Qt5Agg')
|
||||
global _report_quality
|
||||
# mpl.use("pgf")
|
||||
# rc('font',**{'family':'serif','serif':['Libertine']})
|
||||
# for Palatino and other serif fonts use:
|
||||
# rc('font',**{'family':'serif','serif':['Palatino']})
|
||||
# rc('text', usetex=True)
|
||||
# TeX preamble
|
||||
def init_backend(report_quality=False):
|
||||
global _init
|
||||
if not _init:
|
||||
print('Initializing matplotlib...')
|
||||
_init = True
|
||||
import matplotlib
|
||||
matplotlib.use('Qt5Agg')
|
||||
preamble = [
|
||||
r'\usepackage{libertine-type1}'
|
||||
r'\usepackage[libertine]{newtxmath}'
|
||||
@ -39,6 +32,13 @@ def report_quality():
|
||||
'pgf.texsystem': 'pdflatex',
|
||||
'pgf.preamble': preamble,
|
||||
}
|
||||
mpl.rcParams.update(params)
|
||||
matplotlib.rcParams.update(params)
|
||||
global _report_quality
|
||||
_report_quality = report_quality
|
||||
import matplotlib.pyplot as plt
|
||||
plt.ion()
|
||||
|
||||
_report_quality = True
|
||||
|
||||
def getReportQuality():
|
||||
global _report_quality
|
||||
return _report_quality
|
||||
|
@ -15,9 +15,6 @@ from lasp.lasp_common import (PLOT_COLORS_LIST, PLOT_NOCOLORS_LIST,
|
||||
DEFAULT_FIGSIZE_H, DEFAULT_FIGSIZE_W)
|
||||
|
||||
|
||||
def close():
|
||||
plt.close('all')
|
||||
|
||||
|
||||
class Figure:
|
||||
def __init__(self, **kwargs):
|
||||
@ -43,7 +40,8 @@ class Figure:
|
||||
|
||||
linewidths = cycler(linewidth=[1, 2, 1, 2, 2, 3, 2, 1])
|
||||
|
||||
linestyles = cycler(linestyle=['-', '-', '--', ':', '-', '--', ':', '-.', ])
|
||||
linestyles = cycler(
|
||||
linestyle=['-', '-', '--', ':', '-', '--', ':', '-.', ])
|
||||
|
||||
self._ax = []
|
||||
self._legend = {}
|
||||
@ -75,8 +73,7 @@ class Figure:
|
||||
for ax in self._ax:
|
||||
ax.grid(True, 'both')
|
||||
self._zorder -= 1
|
||||
if not getReportQuality():
|
||||
self._f.show()
|
||||
self.fig.show()
|
||||
|
||||
def vline(self, x):
|
||||
self._ax[0].axvline(x)
|
||||
@ -121,7 +118,7 @@ class Figure:
|
||||
self._cur_ax.legend(self._legend[self._cur_col][self._cur_col])
|
||||
|
||||
def savefig(self, *args, **kwargs):
|
||||
self._f.savefig(*args, **kwargs)
|
||||
self.fig.savefig(*args, **kwargs)
|
||||
|
||||
def xlim(self, *args, **kwargs):
|
||||
all_ax = kwargs.pop('all_ax', False)
|
||||
|
Loading…
Reference in New Issue
Block a user