画图工具matplotlib简单实用--绘制散点图
来源:互联网 发布:bbc纪录片中国网络支付 编辑:程序博客网 时间:2024/06/06 20:59
python 中常用画图工具matplotlib.pyplot工具使用实验。
代码:
from sklearn.datasets.samples_generator import make_blobsimport matplotlib.pyplot as pltX, y = make_blobs(n_samples=100, centers=3, n_features=2,random_state=0)y=y+1;# labelplt.figure(1)ax=plt.subplot(121)plt.scatter(X[:,0],X[:,1])ax.set_title('No lable')ax=plt.subplot(122)plt.scatter(X[:,0],X[:,1],y*30,y*30)ax.set_title('Have lable')#plt.figure(2)ax=plt.subplot(111)id=(y==1)plt.scatter(X[id,0],X[id,1],s=20,color='b')id=(y==2)plt.scatter(X[id,0],X[id,1],s=50,color='r')id=(y==3)plt.scatter(X[id,0],X[id,1],s=70,color='g')plt.show()
显示结果:
fiugre1
figure2
0 0
- 画图工具matplotlib简单实用--绘制散点图
- matplotlib简单的画图
- Matplotlib 简单画图
- matplotlib绘制简单图
- Matplotlib Toolkits:地图绘制工具
- Python-Matplotlib绘制简单图像
- 安装Python的画图工具matplotlib
- Python画图工具类库matplotlib
- matplotlib 散点图绘制
- 使用matplotlib绘制散点图
- matplotlib绘制随机散点图
- matplotlib scatter( ) 绘制散点图
- 【python系列】matplotlib简单画图subplot
- 使用matplotlib画图的简单封装
- python之matplotlib画图库学习绘制常用的图
- matplotlib画图
- matplotlib画图
- matplotlib 画图
- Android开发——ProgressBar进度条进度控制
- Android中AlarmManager使用示例
- Java链接Mysql中文问号乱码解决办法
- Bootstrap—解决下拉菜单不弹出问题
- Android Volley的认识和基本使用
- 画图工具matplotlib简单实用--绘制散点图
- Remove specific element by editing the array
- test
- RocooFix源码解析
- iOS 数据请求之网络层和数据层
- 我的C语言学习之路
- 字符串翻转
- DB2行转列,listagg的使用方法
- coreseek之mmseg分词和词库拓展