[plotting] cleanup first commit, this cleans the plotting library and adds plotting tests

This commit is contained in:
mzwiessele 2015-10-02 18:26:17 +01:00
parent fee2f3f727
commit b9bfd0fc6d
10 changed files with 200 additions and 690 deletions

View file

@ -2,11 +2,30 @@
# Licensed under the BSD 3-clause license (see LICENSE.txt)
try:
import matplotlib
from . import matplot_dep
from ..util.config import config
lib = config.get('plotting', 'library')
if lib == 'matplotlib':
import matplotlib
from . import matplot_dep as plotting_library
except (ImportError, NameError):
# Matplotlib not available
import warnings
warnings.warn(ImportWarning("Matplotlib not available, install newest version of Matplotlib for plotting"))
#sys.modules['matplotlib'] =
#sys.modules[__name__+'.matplot_dep'] = ImportWarning("Matplotlib not available, install newest version of Matplotlib for plotting")
warnings.warn(ImportWarning("{} not available, install newest version of {} for plotting").format(lib, lib))
config.set('plotting', 'library', 'none')
if config.get('plotting', 'library') is not 'none':
# Inject the plots into classes here:
# Already converted to new style:
from . import gpy_plot
from ..core import GP
GP.plot_data = gpy_plot.data_plots.plot_data
# Still to convert to new style:
GP.plot = plotting_library.models_plots.plot_fit
GP.plot_f = plotting_library.models_plots.plot_fit_f
GP.plot_density = plotting_library.models_plots.plot_density
GP.plot_errorbars_trainset = plotting_library.models_plots.plot_errorbars_trainset
GP.plot_magnification = plotting_library.dim_reduction_plots.plot_magnification