当前位置:网站首页>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绘图时图像弹出问题怎么解决”这篇文章的所有内容,感谢各位的阅读!相信大家阅读完这篇文章都有很大的收获,小编每天都会为大家更新不同的知识,如果还想学习更多的知识,请关注亿速云行业资讯频道。
边栏推荐
猜你喜欢
What is mosaic?
Matplotlib common charts
Linux基础 —— CentOS7 离线安装 MySQL
2022 R1 fast opening pressure vessel operation test questions and answers
Matplotlib常用设置
2022年最佳智能家居开源系统:Alexa、Home Assistant、HomeKit生态系统介绍
Matplotlib常用設置
2021 robocom world robot developer competition - preliminary competition of undergraduate group
Stm32f030f4 drives tim1637 nixie tube chip
Zero foundation tutorial of Internet of things development
随机推荐
物联网开发零基础教程
2022 crane driver (limited to bridge crane) examination questions and simulation examination
cookie、session、tooken
2022年最佳智能家居开源系统:Alexa、Home Assistant、HomeKit生态系统介绍
ARP报文头部格式和请求流程
notBlank 和 notEmpty
使用uni-simple-router,动态传参 TypeError: Cannot convert undefined or null to object
Win 10 mstsc connect RemoteApp
2022-07-01: at the annual meeting of a company, everyone is going to play a game of giving bonuses. There are a total of N employees. Each employee has construction points and trouble points. They nee
Practical application and extension of plain framework
SWT/ANR问题--SWT 导致 kernel fuse deadlock
Depth first search and breadth first search of graph traversal
2021 RoboCom 世界机器人开发者大赛-本科组初赛
问题随记 —— file /usr/share/mysql/charsets/README from install of MySQL-server-5.1.73-1.glibc23.x86_64 c
ADO.NET之sqlCommand对象
Y53. Chapter III kubernetes from introduction to mastery -- ingress (26)
物联网应用技术专业是属于什么类
Create Ca and issue certificate through go language
[understanding of opportunity-35]: Guiguzi - flying clamp - the art of remote connection, remote control and remote testing
Future trend and development of neural network Internet of things