Python Forum

Full Version: Heat Map Question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hope this is OK but as I didn't receive replies to my previous thread, thought i'd try to make the question simpler.
The following code creates a 64x64 grayscale heatmap.
Question - how do i refer to a particular element in the heatmap?
So if I want to make element (15,17) always white, how could I do that?

Thanks in Advance



import matplotlib.pyplot as plt
from pylab import *
import numpy as np
 
c = 0 
a = np.random.random((64, 64))
  
plt.figure('My First GUI')
plt.imshow(a, cmap='gray', interpolation='nearest')
 

plt.show()

Set (15, 17) to white a[15][17] = 1

import matplotlib.pyplot as plt
import numpy as np
  
c = 0 
a = np.random.random((64, 64))
a[15][17] = 1
   
plt.figure('My First GUI')
plt.imshow(a, cmap='gray', interpolation='nearest')
  
 
plt.show()
Thank you so much Yoriz. Easy when you know how. Doh Big Grin