Qin*_*ing 5 scatter matplotlib
我想通过使用 2 个索引 [ChildrenHeight, ParentHeight] 作为分类变量:[性别] 来绘制散点图。然而,我已经厌倦了许多绘制具有不同边缘颜色的空圆的方法。
我努力了:
plt.scatter(X[:, 0], X[:, 1], c=y, marker = 'o',facecolors='none', cmap=plt.cm.Set1)
Run Code Online (Sandbox Code Playgroud)
但它只是给了我一个完整的循环:
不要以cmap这种方式使用,请尝试fillstyle = 'none'命令:https ://matplotlib.org/gallery/lines_bars_and_markers/marker_fillstyle_reference.html
例如,
x = np.random.randint(100, size=100)
y = np.random.randint(100, size=100)
plt.plot(x,y,lw=0, marker='o', fillstyle='none')
plt.show()
Run Code Online (Sandbox Code Playgroud)
或者,如果你想使用plt.scatter:
plt.scatter(x,y,marker='o', facecolors='none', edgecolors='r')
plt.show()
Run Code Online (Sandbox Code Playgroud)