diff --git a/GPy/plotting/matplot_dep/plot_definitions.py b/GPy/plotting/matplot_dep/plot_definitions.py index 34f32ac5f..41b9e883c 100644 --- a/GPy/plotting/matplot_dep/plot_definitions.py +++ b/GPy/plotting/matplot_dep/plot_definitions.py @@ -90,7 +90,7 @@ def add_to_canvas(self, ax, plots, legend=False, title=None, **kwargs): #ax.legend(prop=fontdict) legend_ontop(ax, ncol=legend, fontdict=fontdict) if title is not None: ax.figure.suptitle(title) - return plots + return ax def show_canvas(self, ax, **kwargs): ax.figure.canvas.draw() diff --git a/GPy/testing/plotting_tests.py b/GPy/testing/plotting_tests.py index 90dceab08..d68e56554 100644 --- a/GPy/testing/plotting_tests.py +++ b/GPy/testing/plotting_tests.py @@ -298,6 +298,23 @@ def test_plot(): 'samples', 'in_error']], extensions=extensions): yield (do_test, ) + +def test_show(): + np.random.seed(111) + import matplotlib + matplotlib.rcParams.update(matplotlib.rcParamsDefault) + matplotlib.rcParams[u'text.usetex'] = False + import warnings + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + X = np.random.uniform(-3.,3.,(20,1)) + Y = np.sin(X) + np.random.randn(20,1)*0.05 + kernel = GPy.kern.RBF(input_dim=1, variance=1., lengthscale=1.) + m = GPy.models.GPRegression(X,Y,kernel) + fig = m.plot() + GPy.plotting.show(fig, filename='show fig test') + + def test_twod(): np.random.seed(11111) import matplotlib