Python Forum
Heat Map Question
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Heat Map Question
#1
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()
Reply
#2
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()
Reply
#3
Thank you so much Yoriz. Easy when you know how. Doh Big Grin
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020