A scatter plot places each observation by two numeric values: one on the x axis and one on the y axis. It is a quick way to inspect the shape of a relationship, including whether values tend to rise together, fall in opposite directions, or show no clear pattern. section 11.12 section 13.3
With pandas, select the two DataFrame columns by name in `plot.scatter`. Longitude and latitude for populous US cities produce a recognizable map-like distribution, showing that the same technique can reveal spatial structure as well as statistical relationships. section 11.2
Use a scatter plot to explore a focused question before drawing conclusions:
- Filter implausible or unwanted values first, as with taxi trips whose distance or total amount is outside a chosen range. section 11.12
- Compare the visual pattern with `corr()` when correlation strength matters; the numeric result can be clearer than the plotted points alone. section 11.14
- Treat an apparent association as a prompt for explanation, not proof that one measurement causes the other. section 11.14
- Extend pairwise inspection to a scatter matrix when several numeric columns may be related. section 11.14
Color a taxi relationship by group
For a large taxi dataset, take a random 1% sample, then plot `trip_distance` on x and `total_amount` on y. With Seaborn, `hue='passenger_count'` colors points by passenger count, adding a third variable without changing the two axes. section 11.18
(
institutions_df
.plot.scatter(x='TUITIONFEE_OUT',
y='ADM_RATE',
c='MD_EARN_WNE_P10',
colormap='Spectral')
)
Plot tuition against admission rate and color each point by median graduate earnings with the Spectral colormap. section 13.3
Seaborn’s `relplot` is organized around relationships among numeric columns and draws a scatter plot by default. Use `x`, `y`, and `data`; then distinguish groups with `hue` and marker `style`, or split views into rows. section 11.16







