File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -317,7 +317,17 @@ for i in range(5):
317
317
})
318
318
h_lines.append(alt.Chart(h_line_df).mark_line(color="black").encode(x="sqft", y="price"))
319
319
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)
321
331
```
322
332
323
333
``` {code-cell} ipython3
@@ -329,7 +339,7 @@ glue("fig:07-knn5-example", nn_plot)
329
339
:::{glue: figure } fig:07-knn5-example
330
340
:name: fig:07-knn5-example
331
341
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) .
333
343
:::
334
344
335
345
+++
You can’t perform that action at this time.
0 commit comments