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")
plt.show()
plot_multiple_regression()
NOTEOwing to browser caching, any code input into the Trinket IDE might carry over across page refreshes or when transitioning between different questions. To commence with a clean slate, either click on the 'Reset Button' found within the IDE's Hamburger icon (☰) menu or resort to using Chrome's Incognito Mode.