1.中文顯示不出 2.markers是什么?從哪里的?有圖
1.label不顯示中文
?
2
for idx,c1 ?in enumerate(np.unique(y)):
plt.scatter(x=X[y == c1,0],y=X[y==c1,1],alpha=0.8,c=cmap(idx),
marker= markers[idx],label=c1)
中的markers從哪來?
1.label不顯示中文
?
2
for idx,c1 ?in enumerate(np.unique(y)):
plt.scatter(x=X[y == c1,0],y=X[y==c1,1],alpha=0.8,c=cmap(idx),
marker= markers[idx],label=c1)
中的markers從哪來?
2017-05-28
舉報
2017-06-07
回答樓主第二個問題
from matplotlib.colors import ListedColormap
def plot_decision_regions(X,y,classifier,resolution=0.02):
? ? markers=('o','x','s','v')
? ? colors=('red','blue','lightgreen','gray','cyan')
把老師寫的marker元組改成markers就可以了。
2017-09-27
中文問題在畫圖前加一句plt.rcParams['font.sans-serif'] = ['SimHei']這個?就ok