user1419224 user1419224 - 1 year ago 119
Python Question

How can I display a np.array with pylab.imshow()

the np.array that results from this loop has 4383 lines and 6 columns. I have tried without success to use pylab.imshow () from matplotlib(pylab) to display the array. The objective is to creat an image of the array, in wich the colors gradient represent the magnitude of the array values.
Each row of the array represents the variation in depth of a lake temperature in each day (4383 days). Thus the objective is to find diferences in lake temperatures in depth and with time. Thank you


for i in xrange(N):

np.savetxt('test.out', TempLake, delimiter=',')
np.savetxt('test1.out', Q, delimiter=',')


Answer Source

You can use imshow as follows:

import pylab as plt
import numpy as np

im = plt.imshow(Z, cmap='hot')
plt.colorbar(im, orientation='horizontal')

enter image description here

In your case can you check the output of TempLake.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download