plt.plot() 无法使用参数ax
问题参考 TypeError: inner() got multiple values for keyword argument 'ax'
fig, ax=plt.subplots(2,1)
plt.plot(a, b, 'go-', label='line 1', linewidth=2, ax=ax) # 会报错
这时因为ax不是plt.plot()的一个有效的参数。原因是plt.plot()会调用当前活跃的axes的plot方法,和plt.gca().plot()是相同的。因此在调用时axes就被给定了。
Solution: Don't use ax as argument to plt.plot(). Instead,
- call
plt.plot(...)to plot to the current axes. Set the current axes withplt.sca(), or - directly call the
plot()method of the axes.ax.plot(...)
Mind that in the example from the question, ax is not an axes. If this is confusing, name it differently,
fig, ax_arr = plt.subplots(2,1)
ax_arr[0].plot(a, b, 'go-', label='line 1', linewidth=2)
ax_arr[0].set_xticks(a)
ax_arr[0].set_xticklabels(list(map(str,a)))
df.plot(kind='bar', ax=ax_arr[1])
plt.plot() 无法使用参数ax的更多相关文章
- matplotlib中 plt.plot() 函数中**kwargs的参数形式
plt.plot(x, y, **kwargs) **kwargs的参数大致有如下几种: color: 颜色 linestyle: 线条样式 marker: 标记风格 markerfacecolor: ...
- 4.3Python数据处理篇之Matplotlib系列(三)---plt.plot()折线图
目录 前言 (一)plt.plot()函数的本质 ==1.说明== ==2.源代码== ==3.展示效果== (二)plt.plot()函数缺省x时 ==1.说明== ==2.源代码== ==3.展示 ...
- Python的知识点 plt.plot()函数细节
1.plt.plot(x,y,format_string,**kwargs) 转自点击打开链接x轴数据,y轴数据,format_string控制曲线的格式字串 format_string 由颜色字符, ...
- plt.figure()的使用,plt.plot(),plt.subplot(),plt.subplots()和图中图
参考:https://blog.csdn.net/m0_37362454/article/details/81511427 matplotlib官方文档:https://matplotlib.org/ ...
- Python中plt.plot()、plt.scatter()和plt.legend函数的用法示例
参考:http://www.cppcns.com/jiaoben/python/471948.html https://blog.csdn.net/weixin_44825185/article/de ...
- Matlab中plot函数参数解析
功能 二维曲线绘图 语法 plot(Y) plot(X1,Y1,...) plot(X1,Y1,LineSpec,...) plot(...,'PropertyName',PropertyValue, ...
- R语言plot函数参数合集
最近用R语言画图,plot 函数是用的最多的函数,而他的参数非常繁多,由此总结一下,以供后续方便查阅. plot(x, y = NULL, type = "p", xlim = N ...
- [ZT] matlab中plot画图参数的设置
一.Matlab绘图中用到的直线属性包括: (1)LineStyle:线形 (2)LineWidth:线宽 (3)Color:颜色 (4)MarkerType:标记点的形状 (5)MarkerSize ...
- matlab中plot画图参数的设置
原文链接:http://blog.sciencenet.cn/blog-281551-573856.html 一.Matlab绘图中用到的直线属性包括: (1)LineStyle:线形 (2)Line ...
随机推荐
- Hive 教程(一)-安装与配置解析
安装就安装 ,不扯其他的 hive 依赖 在 hive 安装前必须具备如下条件 1. 一个可连接的关系型数据库,如 Mysql,postgresql 等,用于存储元数据 2. hadoop,并启动 h ...
- Elasticsearch6.2集群搭建, centos7
原文地址,转载请注明出处:https://blog.csdn.net/qq_34021712/article/details/79330028 ©王赛超 环境介绍 服务器 是否可以成为主节点 是否 ...
- 屏幕的遮挡层,js得到屏幕宽高、页面宽高 (window.screen.availHeight)等--
window.screen.availWidth 返回当前屏幕宽度(空白空间) ------当手机有输入法的时候,要注意................window.screen.availHeigh ...
- TensorFlow入门——安装
由于实验室新配了电脑,旧的电脑就淘汰下来不用,闲来无事,就讲旧的电脑作为个人的工作站来使用. 由于在旧电脑上安装的是Ubuntu 16.04 64bit系统,系统自带的是Python 2.7,版本选择 ...
- 查询服务商的当月提审限额和加急次数(Quota) 调用遇到问题的来说说是什么情况{"errcode":-1,"errmsg":"system error hint: [_KbPJA05231543]"}
感觉完全是按照微信官方的要求来的,还是提示错误.大家有遇到吗?在微信开发者社区里搜索相关问题,也是有人遇到这样的错误. 还是根据社区里说的,换过用开放平台的component accesstoken ...
- OpenSSL源码简介
1.X.509标准 x509是由国际电信联盟(ITU-T)制定的数字证书标准:包含公钥和用户标志符.CA等: x509是数字证书的规范,P7和P12是两种封装形式:X.509是常见通用的证书格式.所有 ...
- List的Select 和Select().tolist()
List<Person> delp = new List<Person> { ,Name=,Sign= }, ,Name= ,Sign=}, }; delp.Select(u ...
- (转)FPS游戏服务器设计的问题
FPS游戏服务器设计的问题出处:http://www.byteedu.com/thread-20-1-1.html一.追溯 去gameloft笔试,有一个题目是说: 叫你去设计一个FPS(第一人称射击 ...
- Java的clone方法
现在有User类:(Getter和Setter省略) public class User implements Cloneable { private String name; private int ...
- CISCO运维记录之4507设备升级IOS(Version 03.03.02.SG版本存在bug)
CISCO运维记录之3650堆叠设备升级IOS(Version 03.03.02.SG版本存在bug) 1. 问题详情 思科45系列交换机使用Catalyst 4500 L3 Switch Softw ...