之前用以下代码将实验结果用matplotlib show出来

plt.plot(np.arange(len(aver_reward_list)), aver_reward_list)
plt.ylabel('Average Reward')
plt.xlabel('Episode')
plt.tight_layout()
plt.savefig("AverageReward.eps") 
plt.show()

画出的图都没什么问题,但忽然有一次数据量比较大,matplotlib开始报错,并且画出的图出现以下问题:

报错:

D:\softwares\coding\Python\Python3.6\lib\site-packages\matplotlib\figure.py:2359: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
warnings.warn("This figure includes Axes that are not compatible "

图:


看到坐标轴丢失,并且坐标都挤到一起了,先想到的会不会是数据太多轴坐标密集给挤一起了?

= = too stupid… matplotlib当然会管理好坐标密度的。

然后又看了下matplotlib画图的标准代码,才知道问题出在哪里:

    plt.figure()
plt.subplot(111)
plt.plot(np.arange(len(ep_reward_list)), ep_reward_list)
plt.xlabel('episode')
plt.ylabel('ep_reward')
plt.savefig('RL_%s.png' % MAX_EPISODES)
plt.show()

嗯,,,是没设置画布和子图= =。。。

matplotlib画图报错This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.的更多相关文章

  1. 安装matplotlib,报错ERROR: Command errored out with exit status 1:

    使用pip install matplotlib 出现报错信息: 发现这行报错 : 我是在pycharm上安装的,可是提示我去安装 Microsoft Visual C++ ,然后去百度查了下,发现只 ...

  2. matplotlib 绘图报错 RuntimeError: Invalid DISPLAY variable

    ssh 远程登录 Linux 服务器使用 matplotlib.pyplot 绘图时报错 原因: matplotlib 在 windows 下的默认 backend 是 TkAgg:在 Linux 下 ...

  3. ssh调用matplotlib绘图报错RuntimeError: Invalid DISPLAY variable

    1.问题:在本地用matplotlib绘图可以,但是在ssh远程绘图的时候会报错 RuntimeError: Invalid DISPLAY variable 2.原因:matplotlib的默认ba ...

  4. jupyter中%matplotlib inline报错

    学习matplotlib时,使用的jupyter跑代码.报错如上图.大致就是后面的注释不能被识别.我寻思着注释不用识别吧,大概是因为%后跟的语句被全部当成命令行执行了,然后命令行不识别行内注释,导致报 ...

  5. [Python]PyCharm中%matplotlib inline报错

    %matplotlib作用 是在使用jupyter notebook 或者 jupyter qtconsole的时候,才会经常用到%matplotlib,也就是说那一份代码可能就是别人使用jupyte ...

  6. matplotlib.pyplot import报错: ValueError: _getfullpathname: embedded null character in path

    Environment: Windows 10, Anaconda 3.6 matplotlib 2.0 import matplotlib.pyplot 报错: ValueError: _getfu ...

  7. scrapy爬虫程序xpath中文编码报错

    2017-03-23 问题描述: #选择出节点中“时间”二字 <h2>时间</h2> item["file_urls"]= response.xpath(& ...

  8. [sql 注入] insert 报错注入与延时盲注

    insert注入的技巧在于如何在一个字段值内构造闭合. insert 报错注入 演示案例所用的表: MariaDB [mysql]> desc test; +--------+--------- ...

  9. python安装matplotlib:python -m pip install matplotlib报错

    matplotlib是python中强大的画图模块. 首先确保已经安装python,然后用pip来安装matplotlib模块. 进入到cmd窗口下,建议执行python -m pip install ...

随机推荐

  1. background 背景图片 --css3

    background 1.设置背景平铺background-repeat round :图片会进行缩放后平铺space : 图片会进行平铺,中间留下空白空间 注:当滚动行为设为fixed,round和 ...

  2. 微信小程序 上传图片并等比列压缩到指定大小

    微信小程序官方API中  wx.chooseImage() 是可以进行图片压缩的,可惜的是不能压缩到指定大小. 实际开发中需求可能是压缩到指定大小: 原生js可以使用canvas来压缩,但由于微信小程 ...

  3. stm32位带

    #define BITBAND(addr, bitnum) ((addr & 0xF0000000)+0x2000000+((addr &0xFFFFF)<<5)+(bit ...

  4. printPreviewControl1怎么刷新文档

    printPreviewControl1.InvalidatePreview(); 调用printPreviewControl1控件的  InvalidatePreview() 这个方法即可.

  5. 用javafx webview 打造自己的浏览器

    背景 项目需要做一个客户端的壳,内置浏览器,访问指定 的url 采用技术 java 1.8 开始吧! java环境配置略 hello world import javafx.application.A ...

  6. zookeeper:3

    zoo.cfg配置文件 tickTime=2000  :zookeeper中最小的时间单位长度 (ms). initLimit=10  :follower节点启动后与leader节点完成数据同步的时间 ...

  7. c# String常用方法

  8. [Leetcode]Rotated Sorted Array问题

    LeetCode上牵扯到Rotated Sorted Array问题一共有四题,主要是求旋转数组的固定值或者最小值,都是考察二分查找的相关知识.在做二分查找有关的题目时,需要特别注重边界条件和跳出条件 ...

  9. HTTP的原理和工作机制

    HTTP到底是什么? 两种最直观的印象:①.浏览器地址栏输入地址,打开网页:②.Android中发送网络请求,返回对应的内容: HyperText Transfer Protocal 超文本传输协议. ...

  10. SQL SERVER 2008 存储过程传表参数

      最近项目使用到了存储过程传入表类型参数. --定义表类型 create type t_table_type as table ( id int, name varchar(32), sex var ...