liveBook · Manning

Relplot

As explained in Pandas Workout: 200 exercises to make you a stronger data analyst

relplot is a Seaborn function for visualizing relationships between variables, including numeric variables with scatter or line plots.

relplot is Seaborn’s relationship-visualization function for numeric columns. It defaults to a scatter plot and accepts x, y, and data as core arguments. section 11.16 section 11.18

Compare weather measurements

Use sns.relplot(x='max_temp', y='min_temp', data=df) to compare temperatures. Add hue='city' to distinguish cities, style='city' to vary markers, or row='city' to create separate panels. Switch to kind='line' for trends, and use ci=None to remove confidence intervals. section 11.16 section 11.18

Explore taxi data

For a large taxi dataset, first work with a one-percent sample. Plot trip_distance against total_amount and color points by passenger_count. Then plot day against trip_distance with kind='line' and hue='month' to compare monthly patterns. section 11.18

sns.relplot(x='max_temp',
            y='min_temp',
            data=df.loc[df['city'] == 'Chicago'])

Open the executable weather scatter-plot example using filtered Chicago data. section 11.16

sns.relplot(x='trip_distance',
            y='total_amount',
            data=df,
            hue='passenger_count')

Open the executable taxi scatter-plot example comparing trip distance and fare. section 11.18

How Pandas Workout: 200 exercises to make you a stronger data analyst covers it

How deep it goes
Defines required arguments and demonstrates scatter, line, grouping, faceting, sampling, and confidence-interval control without covering plotting internals.
Examples
Uses Chicago weather temperatures, city and state encodings, and sampled New York taxi trips across days and months.
What it assumes
Assumes familiarity with pandas data frames, columns, filtering, grouping, and basic plotting concepts.
What you can do after
Apply it via Seaborn to build numeric relationship plots and compare groups with color, markers, lines, or separate panels.
How it connects
Connects scatter plots, line plots, categorical plotting, data frames, grouping, faceting, and confidence intervals.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pandas Workout: 200 exercises to make you a stronger data analyst. The section links point to the parts of the book it draws on.