Using the ‘tips’ dataset, plot a grid of scatter plots with ‘total_bill’ on the x-axis and ‘tip’ on the y-axis, separated by the time of day (Lunch/Dinner).
Example Output:
Utilize sns.FacetGrid along with the map function to generate scatter plots.
import seaborn as sns
import matplotlib.pyplot as plt
def plot_facet_grid():
tips_data = sns.load_dataset('tips')
g = sns.FacetGrid(tips_data, col="time")
g.map(plt.scatter, "total_bill", "tip")
plt.show()
plot_facet_grid()
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.