0
hl = [(1,109),(12,212),(21,23)]
highlightc = np.zeros([N, N])
c = len(highlightc)
colour = [0.21]*c
test = len(number_list) -c

this = [0.21]*test
colour.extend(this)
colour = np.array(colour)
colour = np.array(colour)
print len(number_list)
print colour

for x, y in hl:
    highlightc[x, y] = 1##set so binary matrix knows where to plot
h=ax.imshow(highlightc*colour), interpolation='nearest',cmap=plt.cm.spectral_r)
fig.canvas.draw()

プロットが異なる色のバイナリマトリックスを作成しようとしています。ただし、現時点では、配列が同じ形状ではないため、色がプロットされないという問題があります。operands could not be broadcast together with shapes (160,160) (241) (160*160) がマトリックスのサイズで、241 がカラー配列のサイズであると推測しているエラーが表示 されます。バイナリ配列に変換した座標の配列がありhighlightcます。これは正常にプロットされます。ただし、色を使用して座標配列のサイズを取得し、それを使用して配列にデータを入力して色を作成しました。これは明らかに間違っています。基本的に私が欲しいのは、ある量は be0.21で、残りは be1.0です。(160,160)では、取得した配列を正しい色で正しいプロットに色付けするために、どのように形状を変えることができますか

4

1 に答える 1