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 ...
随机推荐
- mongoose整理笔记
一:参考学习网址 npm: https://www.npmjs.com/package/mongoose 官网API:http://mongoosejs.com/docs/guide.html 二:在 ...
- Vue子父组件方法互调
讲干货,不啰嗦,大家在做vue开发过程中经常遇到父组件需要调用子组件方法或者子组件需要调用父组件的方法的情况,现做一下总结,希望对大家有所帮助. 父组件调用子组件方法: 1.设置子组件的ref,父组件 ...
- 使用cakewalk将工程速度与音频速度对齐(扒带参考)
题外话.cakewalk bandlab版免费 西贝柳斯打谱软件 fisrt版本 免费 (好像限制只能写4个声部) 1选中音频轨中的音频,按住alt+a调出audiosnap. 2点击 根据剪 ...
- jquery操作select下拉框:取值,赋值,删除
1.jQuery对select的取值 <select id="test"> <option value ="1">测试1</opt ...
- IMSI-catcher:可发现附近手机敏感信息的工具
严正声明:该工具主要是为了让大家更好的了解GSM网络的工作原理而设计开发的,请不要用于恶意目的! 前言 IMSI-catcher是一个可以帮助你发现附近手机的IMSI号码,国家,品牌和运营商等信息 ...
- 将excel表格数据转换为sql语句
今天刚从经理那学到的,迫不及待写下来,以后肯定用得上 1.首先是将excel文件另存为csv格式文件 2.在当前行的最后新增一列,输入下面函数(其中表字段因人而异) =CONCATENATE(&quo ...
- 早上好,我是 Istio 1.1
1性能增强 虽然Istio1.0的目标是生产可用,但从去年7月份发布以来,在性能和稳定性上并不能让用户满意.社区的Performance and Scalability工作组在Istio v1.1中做 ...
- 【shell】ping加时间戳回复
ping 192.168.2.1 -c 10 | awk '{ print $0"\t" strftime("%H:%M:%S",systime()) } ' ...
- c多线程不加锁demo
// // Created by gxf on 2019/12/13. // #include <stdio.h> #include <stdlib.h> #include & ...
- Python跨文件全局变量的使用
尽管某些书籍上总是说避免使用全局变量,但是在实际的需求不断变化中,往往定义一个全局变量是最可靠的方法,但是又必须要避免变量名覆盖. Python 中 global 关键字可以定义一个变量为全局变量,但 ...