二维曲线:

```py
from matplotlib import pyplot as plt
import matplotlib
matplotlib.use('TkAgg')
import numpy as np

x = np.arange(10)
y = x ** 2

plt.plot(x, y)
plt.show()
```

三维构图:

```py
import numpy as np
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_score
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
matplotlib.use('TkAgg')

colo = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
x = 50 * np.random.rand(100, 3)  # 3 表示3个特征,即3维

fig = plt.figure(figsize=(12, 8))
# ax = Axes3D(fig,  elev=30, azim=20)# 原代码
ax = fig.add_axes(Axes3D(fig, elev=30, azim=20))  # 新代码

shape = x.shape
sse = []
score = []
K = 4  # 分为K类
for k in [K]:
    clf = KMeans(n_clusters=k)
    clf.fit(x)
    sse.append(clf.inertia_)
    lab = clf.fit_predict(x)
    score.append(silhouette_score(x, clf.labels_, metric='euclidean'))
    for i in range(shape[0]):
        plt.xlabel('x')
        plt.ylabel('y')
        plt.title('k=' + str(k))
        ax.scatter(x[i, 0], x[i, 1], x[i, -1], c=colo[lab[i]])
    plt.show()

```

贡献者:陈文杰

以礼待人,德行兼一,实现没有剥削,没有压迫,人人平等,共同富裕,人民当家作主的共产主义社会!