Skip to content

Commit f73ced7

Browse files
add orange highlight to nns in reg1
1 parent f12b2d1 commit f73ced7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

source/regression1.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,17 @@ for i in range(5):
317317
})
318318
h_lines.append(alt.Chart(h_line_df).mark_line(color="black").encode(x="sqft", y="price"))
319319
320-
nn_plot = alt.layer(*h_lines, small_plot, rule)
320+
# highlight the nearest neighbors in orange
321+
orange_neighbrs = alt.Chart(nearest_neighbors).mark_circle(opacity=1, color="#ff7f0e").encode(
322+
x=alt.X("sqft")
323+
.scale(zero=False)
324+
.title("House size (square feet)"),
325+
y=alt.Y("price")
326+
.axis(format="$,.0f")
327+
.title("Price (USD)")
328+
)
329+
330+
nn_plot = alt.layer(*h_lines, small_plot, orange_neighbrs, rule)
321331
```
322332

323333
```{code-cell} ipython3
@@ -329,7 +339,7 @@ glue("fig:07-knn5-example", nn_plot)
329339
:::{glue:figure} fig:07-knn5-example
330340
:name: fig:07-knn5-example
331341

332-
Scatter plot of price (USD) versus house size (square feet) with lines to 5 nearest neighbors.
342+
Scatter plot of price (USD) versus house size (square feet) with lines to 5 nearest neighbors (highlighted in orange).
333343
:::
334344

335345
+++

0 commit comments

Comments
 (0)