Setting the plot background to dark

We will now look at how to set the plot background to dark and with no grid. To do this, we set the style to dark with the following command:

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

You may have noticed that we have another line of code at the start, which is sns.set(). By calling this, we are resetting the plot aesthetics to the default before making any changes. We do this to make sure the changes we made previously do not impact our grand plot, as follows:

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.