python - How to make chaco plots use predefined colormap scale? -
i have set of data represents thermocouple values @ multiple points on time. using chaco have managed plot heatmap of thermocouple locations, slider lets me pick time step want displayed. purpose of compare how dataset changes on time.
the problem having colormap scale changes based on max , min values shown on screen, colormap scale stay fixed predetermined min , max. there easy way using chaco , traits? have looked through chaco documentation, none of examples have found cover situation.
for simplicity, here pared down copy of code. have replaced data generated dataset of same shape, same value min , max.
import numpy np enable.api import * chaco.shell import * traits.api import * traitsui.api import * chaco.api import * chaco.tools.api import * ## random data data11 = np.ones([3,5,100]) print data11.shape in range(3): j in range(5): k in range(100): data11[i,j,k] = np.random.random_integers(1100) class heatplots(hastraits): plot = instance(plot) time = range(1,99) traits_view = view(item('time'), item('plot', editor=componenteditor()), width=1000, height=600, resizable=true, title='heatmap') def datamaker(self): ## setting data time t = self.time ## defining data picker sources self.data = data11[...,...,t] def heatplotter(self): ##making plots ## first heatmap self.plotdata1 = arrayplotdata(hm1 = self.data) plot1 = plot(self.plotdata1) plot1.img_plot("hm1", colormap=hot) self.plot = plot1 #_heatplotter() @on_trait_change('time') def _new_time(self): self.datamaker() self.heatplotter() def start(self): self._new_time() self.configure_traits() thing = heatplots() thing.start()
if of formating seems odd or round-about because complete plot includes datapicker can pick between data sets, , has 2 heatmaps side-by-side in hplotcontainer. have removed because not relevant question.
thank time.
Comments
Post a Comment