推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
kingmo888
V2EX  ›  Python

matplotlib 绘图问题,这个问题实在给跪了 - -!

  •  
  •   kingmo888 · Jan 5, 2017 · 3307 views
    This topic created in 3550 days ago, the information mentioned may be changed or developed.

    各位大咖,谁对 matplotlib 比较熟悉呀?遇到一个问题,

    在 spyder 的 IDE 下执行时,图形显示正常,但是执行 fig.save 后,保存的图片就少了一半,这是咋回事?

    在 Spyder 下默认运行:

    执行个 fig.show()

    5 replies  •  2017-01-05 20:45:41 +08:00
    sivacohan
        1
    sivacohan  
       Jan 5, 2017 via Android
    你是不是没设置图片摆放顺序啊
    就 demo 里面最开始设置的的 211 111 什么的
    kingmo888
        2
    kingmo888  
    OP
       Jan 5, 2017
    @sivacohan 我没有设置呀。没有使用 fig.add_subplot ,而是用的:

    ax1 = fig.add_axes([0, 1, 1, 1])
    ax2 = fig.add_axes([0, 0.35, 1, 0.5], axis_bgcolor='w')
    ArcherFeel
        3
    ArcherFeel  
       Jan 5, 2017
    没太看懂题目说什么, 不过两个图得用 subplot
    kingmo888
        4
    kingmo888  
    OP
       Jan 5, 2017
    @ArcherFeel 就是, spyder 下跑的代码直接在 console 里的执行结果(图 1 )和保存下来的执行结果( 2 )完全不一样呢。

    两个图我是用 add_axes 的方式来画的
    luobuda
        5
    luobuda  
       Jan 5, 2017
    bbox_inches 看看有没有这个属性
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2581 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 12:38 · PVG 20:38 · LAX 05:38 · JFK 08:38
    ♥ Do have faith in what you're doing.