python matplotlib的一些基础操作
2018-05-19 15:13
281 查看
#matplotlib是一款科学绘图神器 import matplotlib.pyplot as plt import numpy as np ''' #读取和显示图片 image = plt.imread('figures/img_1.jpg') plt.imshow(image) plt.show() ''' #关闭显示x, y轴上的数字 image = plt.imread('figures/img_1.jpg') plt.imshow(image) plt.axis('off') plt.show() #plt.imread()读入的是一个矩阵,跟opencv一样,但彩色图读进的是RGB,与opencv不一样 print(image.shape) #(h, w, c) print(image.size) # h*w*c print(image.dtype) #unit8 print(image) #数组 im_r = image[:,:,0] #红色通道 plt.imshow(im_r) plt.show() #输出为热量图,不是灰度图,可以通过添加camp参数来解决 plt.imshow(im_r, cmap='Greys_r') plt.show()阅读更多
相关文章推荐
- Python使用matplotlib和pandas实现的画图操作【经典示例】
- Matplotlib 入门(一):基础操作
- Python高级数据处理与可视化(二)---Matplotlib绘图基础
- python matplotlib阶段性总结——word转txt、绘图、文件操作
- python matplotlib 基础
- matplotlib python画图 的一些参考资源
- PyQt5+OpenCV+Matplotlib 基础操作教程代码
- python之matplotlib基础------曲线图
- 【备忘】2017年最新北风网零基础学习机器学习(Python语言、算法、Numpy库、MatplotLib)视频教程)
- Python——matplotlib基础绘图函数示例
- Python之matplotlib基础
- python基础(Numpy,Pandas,Matplotlib,
- python之matplotlib基础------散点图
- [Python]Matplotlib绘图基础
- python数据图形化—— matplotlib 基础应用
- Python-matplotlib入门--基础图表的绘制
- Python3.绘图基础matplotlib.pyplot
- Python数据可视化之Matplotlib基础
- 『python工作』matplotlib 库的一些注意点
- python、numpy、scipy、matplotlib的一些小技巧