jupyter notebook读取导出图片 jupyter notebook读取/导出文件/图片实例(IT技术) | 您所在的位置:网站首页 › jupyter导出excel › jupyter notebook读取导出图片 jupyter notebook读取/导出文件/图片实例(IT技术) |
我就废话不多说,看代码! import numpy as np import matplotlib.pyplot as plt import pandas as pd from pandas import Series,DataFrame # 如果不添加该行,则每次显示图片都需要加上plt.show %matplotlib inline读入文件:pd.read_csv('./test.csv') 读入图片:plt.imread('./d.jpg') 导出文件 保存图片 plt.savefig('./66.png') 以上直接保存的方式打开图片呈现空白,解决方案:使用fig=plt.gcf()保存当前图片 s=np.random.randint(0,255,(300,400,3),dtype = np.uint8) '''画图的时候获取当前图像(这一点非常类似于 Matlab 的句柄的概念)''' # gcf: Get Current Figure fig=plt.gcf() plt.imshow(s) fig.savefig('./666.jpg') fig.savefig('./666.png')补充知识:Jupyter notebook如何打印多个结果 from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity='all' 输入上面代码,才能让Jupyter notebook 打印多个结果,否则只会打印最后一个结果过 以上这篇jupyter notebook读取/导出文件/图片实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。 相关文章jupyternotebook撤销删除 jupyternotebook 撤销删除的操作方式jupyter notebook恢复误删单元格 jupyter notebook 恢复误删单元格或python 读取表格数据 使用 Python 读取电子表格中的数据实例详解Jupyter导入module 解决Jupyter无法导入已安装的 module问题Python读取excel公式的值 Python读取excel文件中带公式的值的实现pyecharts读取csv可视化 利用pyecharts读取csv并进行数据统计可视化jupyter notebook矩阵 jupyter notebook中美观显示矩阵实例unity生成图片灰白图 Unity实现图片生成灰白图的方法SpringBoot载容器 SpringBoot怎样在普通类加载Sprinpython matplotlib画图导入word 使用python matplot |
CopyRight 2018-2019 实验室设备网 版权所有 |