Since Seaborn version 0.12, Seaborn objects have been introduced. These provide a powerful alternative to the original plotting functions. The objects are inspired by R’s ggplot2.
Let’s take a simple example. First, we import the objects as follows:
import seaborn.objects as so
The way plots are built with objects is specific. A single function is used to create plots:
so.Plot()
We then specify the data we are going to use:
so.Plot(tips,x=”total_bill”)
Here, tips is Seaborn’s built-in tips dataset.
Once the data is specified, we decide what to do with it using add(), here an histogram:
so.Plot(tips,x=”total_bill”).add(so.Bar(),so.Hist()).show()
And here is the result:
