Skip to content

Commit 23cc505

Browse files
committed
FIG Larger marker sizes
1 parent beee4ef commit 23cc505

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

ch02/figure1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# Use a different marker/color for each class `t`
2323
for t, marker, c in zip(range(3), ">ox", "rgb"):
2424
ax.scatter(features[target == t, p0], features[
25-
target == t, p1], marker=marker, c=c)
25+
target == t, p1], marker=marker, c=c, s=40)
2626
ax.set_xlabel(feature_names[p0])
2727
ax.set_ylabel(feature_names[p1])
2828
ax.set_xticks([])

ch02/figure2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
ax.plot([t, t], [y0, y1], 'k--', lw=2)
4848
ax.plot([t - .1, t - .1], [y0, y1], 'k:', lw=2)
4949
ax.scatter(features[is_virginica, f0],
50-
features[is_virginica, f1], c='b', marker='o')
50+
features[is_virginica, f1], c='b', marker='o', s=32)
5151
ax.scatter(features[~is_virginica, f0],
52-
features[~is_virginica, f1], c='r', marker='x')
52+
features[~is_virginica, f1], c='r', marker='x', s=32)
5353
ax.set_ylim(y0, y1)
5454
ax.set_xlim(x0, x1)
5555
ax.set_xlabel(feature_names[f0])

ch02/figure4_5_sklearn.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def plot_decision(features, labels, num_neighbors=1):
4747
model.fit(features[:, (0,2)], labels)
4848
C = model.predict(np.vstack([X.ravel(), Y.ravel()]).T).reshape(X.shape)
4949
if COLOUR_FIGURE:
50-
cmap = ListedColormap([(1., .6, .6), (.6, 1., .6), (.6, .6, 1.)])
50+
cmap = ListedColormap([(1., .7, .7), (.7, 1., .7), (.7, .7, 1.)])
5151
else:
5252
cmap = ListedColormap([(1., 1., 1.), (.2, .2, .2), (.6, .6, .6)])
5353
fig,ax = plt.subplots()
@@ -57,12 +57,12 @@ def plot_decision(features, labels, num_neighbors=1):
5757
ax.set_ylabel(feature_names[2])
5858
ax.pcolormesh(X, Y, C, cmap=cmap)
5959
if COLOUR_FIGURE:
60-
cmap = ListedColormap([(1., .0, .0), (.0, 1., .0), (.0, .0, 1.)])
61-
ax.scatter(features[:, 0], features[:, 2], c=labels, cmap=cmap)
60+
cmap = ListedColormap([(1., .0, .0), (.1, .6, .1), (.0, .0, 1.)])
61+
ax.scatter(features[:, 0], features[:, 2], c=labels, cmap=cmap, s=40)
6262
else:
6363
for lab, ma in zip(range(3), "Do^"):
6464
ax.plot(features[labels == lab, 0], features[
65-
labels == lab, 2], ma, c=(1., 1., 1.))
65+
labels == lab, 2], ma, c=(1., 1., 1.), ms=8)
6666
return fig,ax
6767

6868

0 commit comments

Comments
 (0)