当前位置:网站首页>PyCharm调用matplotlib绘图时图像弹出问题怎么解决
PyCharm调用matplotlib绘图时图像弹出问题怎么解决
2022-07-01 23:35:00 【亿速云】
PyCharm调用matplotlib绘图时图像弹出问题怎么解决
今天小编给大家分享一下PyCharm调用matplotlib绘图时图像弹出问题怎么解决的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。
问题描述
在PyCharm中调用matplotlib绘制图像时,默认图像会在控制台输出(如图),当绘制图像较多时,控制台输出方式很不直观。

问题解决
希望在PyCharm中调用matplotlib绘制图像时,可以直接弹出Figure 窗口。
点击 菜单栏中的File→Settings→Python Scientific,右侧出现的复选框,若勾选则会在控制台输出(默认),不勾选则会直接弹出图像。


补充注意plt.show()
博主在开始系统学习Matplotlib 时,由于是在Jupyter Notebook 上查看学习资料,代码中并未(也没有必要(Jupyter Notebook默认输出最后一行命令))输入plt.show()

粗心马虎的博主就照葫芦画瓢在PyCharm中输入相同代码,运行后,没有报错,但一直没有图像输出。
基于此,博主搜索查找了很多关于 调用matplotlib进行绘图时没有图像弹出的解决方式,用各种方式操作解决,一顿操作猛如虎,毫无效果。
最后无意中恍然发现,憨憨博主忘记最后的 plt.show() 命令了…
import matplotlib.pyplot as pltimport matplotlib as mplfig, ax = plt.subplots() # 创建一个包含一个axes的figureax.plot([1, 2, 3, 4], [1, 4, 2, 3]) # 绘制图像plt.show()
以上就是“PyCharm调用matplotlib绘图时图像弹出问题怎么解决”这篇文章的所有内容,感谢各位的阅读!相信大家阅读完这篇文章都有很大的收获,小编每天都会为大家更新不同的知识,如果还想学习更多的知识,请关注亿速云行业资讯频道。
边栏推荐
- Is it safe to choose mobile phone for stock trading account opening in Shanghai?
- Postgresql随手记(10)动态执行EXECUTING语法解析过程
- 深度学习 | 三个概念:Epoch, Batch, Iteration
- 距离度量 —— 汉明距离(Hamming Distance)
- Matplotlib common charts
- The third part of the construction of the defense system of offensive and defensive exercises is the establishment of a practical security system
- [swoole Series 1] what will you learn in the world of swoole?
- 2021 robocom world robot developer competition - preliminary competition of higher vocational group
- SWT / anr problem - SWT causes kernel fuse deadlock
- How to display real-time 2D map after rviz is opened
猜你喜欢

2021 RoboCom 世界机器人开发者大赛-本科组初赛

Door level modeling - after class exercises

使用uni-simple-router,动态传参 TypeError: Cannot convert undefined or null to object

What is mosaic?

ARP message header format and request flow

认识--Matplotlib

纪念成为首个DAYUs200三方demo贡献者

Redis RDB快照

algolia 搜索需求,做的快自闭了...

【必会】BM41 输出二叉树的右视图【中等+】
随机推荐
The essence of software architecture
What are the common types of points mall games?
神经网络物联网的未来趋势与发展
Matplotlib常用图表
上海炒股开户选择手机办理安全吗?
algolia 搜索需求,做的快自闭了...
Linux基础 —— CentOS7 离线安装 MySQL
门级建模—课后习题
Y53. Chapter III kubernetes from introduction to mastery -- ingress (26)
[micro service sentinel] @sentinelresource details
Similarities and differences between the defined identity execution function authid determiner and PostgreSQL in Oracle
Is there a piece of code that makes you convinced by human wisdom
常见的积分商城游戏类型有哪些?
物联网现状及未来发展趋势
cookie、session、tooken
有没有一段代码,让你为人类的智慧所折服
Redis AOF日志
Notblank and notempty
2022 safety officer-c certificate examination question simulation examination question bank and simulation examination
Postgresql源码(57)HOT更新为什么性能差距那么大?