之前用以下代码将实验结果用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. tf 2.0

    tf.function和Autograph使用指南-Part 1 "Keras之父发声:TF 2.0 + Keras 深度学习必知的12件事" Effective TensorFl ...

  2. zlog日志函数库

    在C的世界里面没有特别好的日志函数库(就像JAVA里面的的log4j,或者C++的log4cxx).C程序员都喜欢用自己的轮子.printf就是个挺好的轮子,但没办法通过配置改变日志的格式或者输出文件 ...

  3. 关于Http协议与TCP协议的一些简单理解

    TCP协议对应于传输层,而HTTP协议对应于应用层,从本质上来说,二者没有可比性.Http协议是建立在TCP协议基础之上的,当浏览器需要从服务器获取网页数据的时候,会发出一次Http请求.Http会通 ...

  4. 利用setuptools发布Python程序到PyPI,为Python添砖加瓦

    pip install的东西从哪里来的? 从PyPI (Python Package Index)来的,官网是:  https://pypi.python.org/pypi/执行pip install ...

  5. centos下关闭自动锁屏

    自己这段时间在学习Linux,选用的系统的为CentOS,在实际操作过程中遇到问题,在无任何操作情况下,系统过一段时间自动锁屏需要重新输入密码.经过多次尝试以后终于成功!解决方法如下: Setting ...

  6. C#中[STAThread]的作用

    [STAThread]STAThread:Single Thread Apartment Thread.(单一线程单元线程)[]是用来表示Attributes: [STAThread]是一种线程模型, ...

  7. javascript获取用户按了哪个键

    浏览器好像不允许js获取F5这个键的按下事件,应该屏蔽了,这个键太过特殊,猜测可能是,防止用户失去对浏览器的控制? <!DOCTYPE html> <html> <hea ...

  8. 2.session 简介

    2.session 简介 hibernate的执行流程, 创建一个配置对象Configuration,这个配置对象的作用就是用来读取配置文档Hibernate.cfg.xml 获得配置对象的目的是可以 ...

  9. 部署logstash节点

    .部署Logstash节点 1.查看系统环境: [root@Logstash ~]# hostname Logstash [root@Logstash ~]# cat /etc/redhat-rele ...

  10. 第90题:子集II

    一. 问题描述 给定一个可能包含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集). 说明:解集不能包含重复的子集. 示例: 输入: [1,2,2] 输出: [ [2], [1], [1, ...