diff --git a/GPy/util/latent_space_visualizations/controllers/axis_event_controller.py b/GPy/util/latent_space_visualizations/controllers/axis_event_controller.py index acb1ac8d..afc92ab0 100644 --- a/GPy/util/latent_space_visualizations/controllers/axis_event_controller.py +++ b/GPy/util/latent_space_visualizations/controllers/axis_event_controller.py @@ -28,14 +28,15 @@ class AxisChangedController(AxisEventController): ''' _changing = False - def __init__(self, ax, update_lim=None): + def __init__(self, ax, plot_limits=None, update_lim=None): ''' Constructor ''' super(AxisChangedController, self).__init__(ax) self._lim_ratio_threshold = update_lim or .8 - self._x_lim = self.ax.get_xlim() - self._y_lim = self.ax.get_ylim() + if plot_limits is not None: + self._x_lim = [plot_limits[0], plot_limits[2]] + self._y_lim = [plot_limits[0], plot_limits[2]] def update(self, ax): pass @@ -89,10 +90,11 @@ class BufferedAxisChangedController(AxisChangedController): :param kwargs: additional kwargs are for pyplot.imshow(**kwargs) """ - super(BufferedAxisChangedController, self).__init__(ax, update_lim=update_lim) + super(BufferedAxisChangedController, self).__init__(ax, plot_limits, update_lim=update_lim) self.plot_function = plot_function - xmin, xmax = self._x_lim # self._compute_buffered(*self._x_lim) - ymin, ymax = self._y_lim # self._compute_buffered(*self._y_lim) + #xmin, xmax = self._x_lim # self._compute_buffered(*self._x_lim) + #ymin, ymax = self._y_lim # self._compute_buffered(*self._y_lim) + xmin, ymin, xmax, ymax = plot_limits self.resolution = resolution self._not_init = False self.view = self._init_view(self.ax, self.recompute_X(), xmin, xmax, ymin, ymax, **kwargs) diff --git a/GPy/util/latent_space_visualizations/controllers/imshow_controller.py b/GPy/util/latent_space_visualizations/controllers/imshow_controller.py index fa6682e9..f0ede360 100644 --- a/GPy/util/latent_space_visualizations/controllers/imshow_controller.py +++ b/GPy/util/latent_space_visualizations/controllers/imshow_controller.py @@ -9,7 +9,7 @@ import numpy class ImshowController(BufferedAxisChangedController): - def __init__(self, ax, plot_function, plot_limits, resolution=50, update_lim=.5, **kwargs): + def __init__(self, ax, plot_function, plot_limits, resolution=50, update_lim=.8, **kwargs): """ :param plot_function: function to use for creating image for plotting (return ndarray-like)