matplotlib画图报错This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
之前用以下代码将实验结果用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.的更多相关文章
- 安装matplotlib,报错ERROR: Command errored out with exit status 1:
使用pip install matplotlib 出现报错信息: 发现这行报错 : 我是在pycharm上安装的,可是提示我去安装 Microsoft Visual C++ ,然后去百度查了下,发现只 ...
- matplotlib 绘图报错 RuntimeError: Invalid DISPLAY variable
ssh 远程登录 Linux 服务器使用 matplotlib.pyplot 绘图时报错 原因: matplotlib 在 windows 下的默认 backend 是 TkAgg:在 Linux 下 ...
- ssh调用matplotlib绘图报错RuntimeError: Invalid DISPLAY variable
1.问题:在本地用matplotlib绘图可以,但是在ssh远程绘图的时候会报错 RuntimeError: Invalid DISPLAY variable 2.原因:matplotlib的默认ba ...
- jupyter中%matplotlib inline报错
学习matplotlib时,使用的jupyter跑代码.报错如上图.大致就是后面的注释不能被识别.我寻思着注释不用识别吧,大概是因为%后跟的语句被全部当成命令行执行了,然后命令行不识别行内注释,导致报 ...
- [Python]PyCharm中%matplotlib inline报错
%matplotlib作用 是在使用jupyter notebook 或者 jupyter qtconsole的时候,才会经常用到%matplotlib,也就是说那一份代码可能就是别人使用jupyte ...
- matplotlib.pyplot import报错: ValueError: _getfullpathname: embedded null character in path
Environment: Windows 10, Anaconda 3.6 matplotlib 2.0 import matplotlib.pyplot 报错: ValueError: _getfu ...
- scrapy爬虫程序xpath中文编码报错
2017-03-23 问题描述: #选择出节点中“时间”二字 <h2>时间</h2> item["file_urls"]= response.xpath(& ...
- [sql 注入] insert 报错注入与延时盲注
insert注入的技巧在于如何在一个字段值内构造闭合. insert 报错注入 演示案例所用的表: MariaDB [mysql]> desc test; +--------+--------- ...
- python安装matplotlib:python -m pip install matplotlib报错
matplotlib是python中强大的画图模块. 首先确保已经安装python,然后用pip来安装matplotlib模块. 进入到cmd窗口下,建议执行python -m pip install ...
随机推荐
- Eclipse 设置代码模板
checkstyle插件 安装 从 http://sourceforge.jp/projects/sfnet_eclipse-cs/releases/ 下载 net.sf.eclipsecs-upda ...
- Framework7 - 入门教程(安装、配置、创建一个H5应用)
1,Framework7介绍 (1)Framework7 是一个开源免费的框架.可以用来开发混合移动应用(原生和 HTML 混合)或者开发 iOS & Android 风格的 WEB APP. ...
- undefined reference to `udev_device_get_action'
/usr/lib/gcc/i686-linux-gnu/4.8/../../../i386-linux-gnu/libusb-1.0.a(libusb_1_0_la-linux_udev.o): In ...
- C#基础 类及常用函数【string 、Math 、DiteTime 、TimeSpan】
一 string 类型 string str = "abcdefg"; str.Length - 字符串长度,返回int类型 str.TrimStart() ...
- 猫眼 top_100 爬取 ___只完成了第一页
# python 3.7 from urllib.request import Request,urlopen import time,re,csv class Maoyan(object): def ...
- golang使用sftp连接服务器远程上传、下载文件
安装github.com/pkg/sftp 我们之前介绍了,golang如何通过ssh连接服务器执行命令,下面我们来如何上传文件,上传文件同样需要之前的ssh,但是除此之外还需要一个模块,直接使用go ...
- 服务器CPU架构演变过程
第一阶段: 单CPU,没啥好说的.和我们今天打游戏的台式机差不多. 第二阶段: 双CPU 或者 多CPU的SMP架构 或者 AMP架构.参考:http://www.lauterbach.com/smp ...
- js中的分页
分页是前端经常会用到的一个非常实用的一个知识点,今天闲来没事,做了一个小demo,虽然样子,比较丑,哈哈哈,但是这是分页的核心思想都在,希望能给某个小伙伴一些启发.可直接复制在编辑器中运行. < ...
- FormCollection使用
FormCollection用来在controller中获取页面表单元素的数据.它是表单元素的集合,包括<input type="submit" />元素. 用法举例: ...
- Java并发包--LinkedBlockingDeque
转载请注明出处:http://www.cnblogs.com/skywang12345/p/3503480.html LinkedBlockingDeque介绍 LinkedBlockingDeque ...