XX, YY = np.mgrid[x_min:x_max:200j, y_min:y_max:200j]
# np.c_,类似于np.vstack的功能,画网格
Z = clf.decision_function(np.c_[XX.ravel(), YY.ravel()]).reshape(XX.shape)#ravel降维
# 填充等高线不同区域的颜色
ax.pcolormesh(XX, YY, Z > 0, shading='auto',cmap=plt.cm.Paired)
# 绘制等高线
ax.contour(XX, YY, Z, colors=['k', 'k', 'k'], linestyles=['--', '-', '--'],
出现错误:MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3. Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading']. This will become an error two minor releases later.
ax.pcolormesh(XX, YY, Z > 0,cmap=plt.cm.Paired)
将代码ax.pcolormesh(XX, YY, Z > 0, shading='auto',cmap=plt.cm.Paired)改成这个后,仍然无法显示子图