plot handling greatly improved for latent space visualizations

This commit is contained in:
Max Zwiessele 2014-01-10 09:58:28 +00:00
parent feb34a7c98
commit 0b4471a7cd
2 changed files with 9 additions and 7 deletions

View file

@ -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)

View file

@ -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)