zoukankan      html  css  js  c++  java
  • python使用matplotlib的savefig保存时图片保存不清晰以及不完整的问题

    图片不清晰,需要指定dpi,
    图片保存大小问题,设置bbox_inches=‘tight’

    (bbox_inches:可选bbox英寸。只保存图形的给定部分。如果“紧”,试着找出数字的紧框。如果没有,请使用savefig.bbox)

    plt.savefig("data/temp.png",dpi=500,bbox_inches = 'tight')#解决图片不清晰,不完整的问题

    https://blog.csdn.net/qq_31648921/article/details/88560191

    plt.colse()

    保存图像时去除图像边缘的空白区域

    plt.axis('off')
    plt.gcf().set_size_inches(512 / 100, 512 / 100)
    plt.gca().xaxis.set_major_locator(plt.NullLocator())
    plt.gca().yaxis.set_major_locator(plt.NullLocator())
    plt.subplots_adjust(top=1, bottom=0, right=0.93, left=0, hspace=0, wspace=0)
    plt.margins(0, 0)
    plt.savefig('image.png')
    

     

    很多资料中都只是单纯的用了subplots_adjusts()或者margins(),需要将两个函数都用上才能完全地去除空白边框。

    https://blog.csdn.net/qq_24185239/article/details/90679614

  • 相关阅读:
    动态字节码技术Javassist
    自己实现简单版的注解Mybatis
    AOP实现事务和记录日志
    自己实现简单版SpringMVC
    静态变量
    docker安装nginx , 安装mysql5.6,安装redis3.2
    Worker Thread模式
    linux 安装jdk
    dockfile构建自己的tomcat
    docker使用2
  • 原文地址:https://www.cnblogs.com/Allen-rg/p/12091602.html
Copyright © 2011-2022 走看看