Scatter Plot with Dual Regression Lines

For the ‘tips’ dataset, visualize a scatter plot of ‘total_bill’ against ‘tip’, drawing two regression lines – one for Lunch and one for Dinner.

Example Output:

Use sns.lmplot and play with the hue parameter.

import seaborn as sns
import matplotlib.pyplot as plt

def plot_multiple_regression():
    tips_data = sns.load_dataset('tips')
    sns.lmplot(x="total_bill", y="tip", data=tips_data, hue="time")



© Let’s Data Science


Unlock AI & Data Science treasures. Log in!