Python 绘制散点图

from sklearn.cluster import AffinityPropagation
#导入AP算法包
from sklearn import metrics
from sklearn.datasets.samples_generator import make_blobs
import numpy as np
centers = [[2, 2], [-2, -2], [2, -2]]
import matplotlib.pyplot as plt
Xn, labels_true = make_blobs(n_samples=150, centers=centers, cluster_std=0.5,
                            random_state=0)
plt.scatter(Xn[:,0],Xn[:,1],marker = 'x',color = 'red', s = 10)
#                                   记号形状       颜色 点的大小
#为了能够清楚的看出散点的模样,我们使用scatter函数将这个图画出来
发布了21 篇原创文章 · 获赞 0 · 访问量 510

猜你喜欢

转载自blog.csdn.net/huatianxue/article/details/105142742