Hi all,

Just trying to understand how the value of the matrix fed to imshow()
function determines the intensity of the pixel in grey scale mode.
Consider the example code:

import random
import matplotlib.pyplot as plt
import matplotlib.cm as cm

def pixels(n=3):
    pixel_data = []
    for _ in range(n):
        row = []
        for _ in range(n):
            row.append(random.randint(1, 10))
        pixel_data.append(row)
    return pixel_data

if __name__ == '__main__':
    pixel_data = pixels()
    print(pixel_data)
    plt.imshow(pixel_data, origin='lower', cmap=cm.Greys_r)
    plt.show()


The pixel_data here is the 3*3 "matrix":
[[7, 4, 6], [7, 7, 6], [4, 7, 9]]

How does the values here determine what shade of grey I see in the image?

Thank you in advance.

Best,
Amit.


-- 
http://echorand.me

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to