Here is the explanation of the code:
- sns.set(style='darkgrid') sets the background style for the plot. Seaborn provides five predefined styles: dark, darkgrid, white, whitegrid, and ticks
- sns.relplot(x='Period', y='Smoothies', data=snacks_sales.query("Period < 300"), kind='line') plots the relationship between the two main variables, specified by x and y:
- Period and Smoothies are the names of two variables in the Snacks Sales dataset
- Snacks Sales is the input dataset, and query("Period < 300") applies the filter on the dataset to plot only the first 300 observations (rows), since plotting the entire dataset gets too crowded
- kind='line' means plot a line graph
- For the second plot, we will add hue='daywk' and hue_order=day_order ...