In [16]:
import pandas as pd
import seaborn as sns
%matplotlib inline
sns.set_style('darkgrid')

def pipe(self, func, *args, **kwargs):
    if hasattr(func, 'pipe_arg'):
        kwargs[func.pipe_arg] = self
        return func(*args, **kwargs)
    return func(self, *args, **kwargs)

pd.DataFrame.pipe = pipe
sns.violinplot.pipe_arg = 'data'
In [17]:
iris = sns.load_dataset('iris') 
In [18]:
sns.violinplot(x='species', y='sepal_width', data=iris)
Out[18]:
<matplotlib.axes._subplots.AxesSubplot at 0x11047ec10>
In [19]:
sns.violinplot('species', 'sepal_width', data=iris)
Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x110813050>
In [20]:
iris.pipe(sns.violinplot, 'species', 'sepal_width')
Out[20]:
<matplotlib.axes._subplots.AxesSubplot at 0x110aed890>
In [21]:
iris.pipe(sns.violinplot, x='species', y='sepal_width')
Out[21]:
<matplotlib.axes._subplots.AxesSubplot at 0x110bc4a50>