• matplotlib_200730系列---8、image图片


    matplotlib_200730系列---8、image图片

    一、总结

    一句话总结:

    plt.imshow(data) 将数值转成颜色
    plt.colorbar() 显示颜色基准条
    data=np.random.uniform(0,1.0,9).reshape((3,3))
    
    # plt.imshow(data,interpolation='nearest',cmap='bone',origin='upper')
    plt.imshow(data)
    # color缩小为原来的90%
    plt.colorbar(shrink=0.9)

    二、image图片

    博客对应课程的视频位置:

    import matplotlib.pyplot as plt 
    import numpy as np 
    
    data=np.random.uniform(0,1.0,9).reshape((3,3))
    print(data)
    data
    """
    for the value of"interpolation",check this:
    http://matplotlib.org/examples/images_contours_and_fields/interpolation_methods.html
    """
    
    # plt.imshow(data,interpolation='nearest',cmap='bone',origin='upper')
    plt.imshow(data)
    # color缩小为原来的90%
    plt.colorbar(shrink=0.9)
    
    plt.xticks(())
    plt.yticks(())
    plt.show()

    结果:

    [[0.50867287 0.16963109 0.87560028]
     [0.19614212 0.94408617 0.18405361]
     [0.50226809 0.00187141 0.58463625]]

    我的旨在学过的东西不再忘记(主要使用艾宾浩斯遗忘曲线算法及其它智能学习复习算法)的偏公益性质的完全免费的编程视频学习网站: fanrenyi.com;有各种前端、后端、算法、大数据、人工智能等课程。
    博主25岁,前端后端算法大数据人工智能都有兴趣。
    大家有啥都可以加博主联系方式(qq404006308,微信fan404006308)互相交流。工作、生活、心境,可以互相启迪。
    聊技术,交朋友,修心境,qq404006308,微信fan404006308
    26岁,真心找女朋友,非诚勿扰,微信fan404006308,qq404006308
    人工智能群:939687837

    作者相关推荐

  • 相关阅读:
    mall
    将UNICODE编码转换为中文
    460. LFU Cache
    957. Prison Cells After N Days
    455. Assign Cookies
    453. Minimum Moves to Equal Array Elements
    434. Number of Segments in a String
    1203. Sort Items by Groups Respecting Dependencies
    641. Design Circular Deque
    441. Arranging Coins
  • 原文地址:https://www.cnblogs.com/Renyi-Fan/p/13406800.html
Copyright © 2020-2023  润新知