Setting the plot background to a white grid

The default plot style is a blue grid. We can change this to whitegrid with the following command:

sns.set()sns.set_style("whitegrid")sns.lmplot(x='beer_servings', y='wine_servings', data=df);

Seaborn provides a method called set_style, which we call and then pass whitegrid as the parameter. We then call our plotting method to draw our scatterplot. We are using seaborn's lmplot method for this. We then pass two column names from our dataset as x and y, and set the data parameter to our pandas DataFrame. We should now have a scatterplot with a white grid background, as shown in the following screenshot:

Get Mastering Exploratory Analysis with pandas now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.