経時的な複数のポイントでの熱電対の値を表す一連のデータがあります。Chaco を使用して、表示する時間ステップを選択できるスライダーを使用して、熱電対の位置のヒートマップをプロットすることができました。これの目的は、データセットが時間の経過とともにどのように変化するかを比較することです。
私が抱えている問題は、画面に表示される最大値と最小値に基づいてカラーマップのスケールが変化することですが、カラーマップのスケールを所定の最小値と最大値に固定したままにしたいと考えています。Chaco と Traits を使用してこれを行う簡単な方法はありますか? Chaco のドキュメントに目を通しましたが、この状況をカバーしている例は見つかりませんでした。
簡単にするために、これは私のコードのコピーです。データを、最小値と最大値が同じ、同じ形状の生成されたデータセットに置き換えました。
import numpy as np
from enable.api import *
from chaco.shell import *
from traits.api import *
from traitsui.api import *
from chaco.api import *
from chaco.tools.api import *
## Random Data
data11 = np.ones([3,5,100])
print data11.shape
for i in range(3):
for j in range(5):
for 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 the data time
t = self.time
## Defining the data picker sources
self.data = data11[...,...,t]
def heatplotter(self): ##Making the Plots
## The 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()
書式設定の一部が奇妙または回りくどいように見える場合は、おそらく、完全なプロットにデータ セット間で選択できるデータピッカーが含まれており、HPlotContainer に 2 つのヒートマップが並んでいることが原因です。私の質問とは関係ないので削除しました。
お時間をいただきありがとうございます。