matplotlib.pyplot 画图相关
2018-01-04 20:40
676 查看
matplotlib.pyplot 画图相关
本文主要介绍使用matplotlib.pyplot进行简单图像绘制:matplotlib.pyplot是python中的绘图模块
from sklearn import datasets import matplotlib.pyplot as plt import pandas as pd import sys reload(sys) sys.setdefaultencoding('utf-8') scikit_iris = datasets.load_iris() iris = pd.DataFrame(data=np.c_[scikit_iris['data'],scikit_iris['target']],columns=np.append(scikit_iris.feature_names,['y'])) x = iris.index.values y = iris['petal length (cm)'].values plt.plot(x,y,'--') plt.bar(x,y) 画柱状图 plt.scatter(x,y) 画散点图 plt.hsit(y) 画分布图 plt.boxplot(y) 画箱图 plt.loglog(x,y) 画对数图 plt.show() plt.imwrite() 保存图片 #画圆 theta = np.arange(0, 2 * np.pi + 0.1,2 * np.pi / 1000) x = np.cos(theta) y = np.sin(theta) v = 5 x = v * x y = v * y plt.plot(x, y, color='red') plt.show()
x,y都是np.array类型的数据 dataframe中通过df.values 可以得到相应的数据
相关文章推荐
- 画图认识--matplotlib.pyplot
- Python应用matplotlib.pyplot画图总结
- matplotlib.pyplot画图 图片的二进制流的获取方法
- matplotlib.pyplot画图报QT错误
- matplotlib画图实例:pyplot、pylab模块及作图參数
- Python中用matplotlib.pyplot画图总结
- python matplotlib.pyplot画图设置刻度
- scikit-learn:matplotlib.pyplot常用画图功能总结(2)——多子图绘制
- scikit-learn:matplotlib.pyplot常用画图功能总结(1)
- python matplotlib画图
- 数据可视化——matplotlib.pyplot
- matplotlib字体大小相关设置
- python+matplot+pyplot画图
- matplotlib.pyplot.savefig(*args, **kwargs)保存图片$close()关闭图片
- 使用matplotlib时pyplot.show()不显示图像的问题
- 六、matplotlib系列---pyplot基础图表函数概述
- matplotlib画图不显示
- matplotlib.pyplot.subplot
- python matplotlib 画图
- matplotlib热图绘制——inshow()相关用法