def __init__(self, **traits): super(MandelbrotDemo, self).__init__(**traits) self.data = ArrayPlotData(image=np.zeros((1, 1))) self.plot = Plot(self.data, padding=0) imgplot = self.plot.img_plot("image", colormap=reverse(Blues), interpolation="bilinear")[0] imgplot.tools.append( MandelbrotController(imgplot, application=self) ) self.imgplot = imgplot self.plot.x_axis.visible = False self.plot.y_axis.visible = False
def change_color_map(self): try: cmap_func = getattr(cmaps, self.current_map) if self.reverse_map: cmap_func = reverse(cmap_func) self.imgplot.color_mapper = cmap_func(DataRange1D(self.imgplot.value)) self.plot.request_redraw() except: print "Cannot set color map:%s" % self.current_map