In [1]:
%matplotlib inline
In [2]:
import pandas_ml as pdml
In [3]:
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (4, 3)
In [4]:
import seaborn as sns
titanic = sns.load_dataset("titanic")
titanic = pdml.ModelFrame(titanic, target='survived')
titanic.head()
Out[4]:
In [5]:
tips = sns.load_dataset("tips")
tips = pdml.ModelFrame(tips, target='total_bill')
tips.head()
Out[5]:
In [6]:
iris = sns.load_dataset("iris")
iris = pdml.ModelFrame(iris, target='species')
iris.head()
Out[6]:
In [7]:
tips.sns.stripplot();
Specifying x
keyword vertically plots target
values categorized by x
values.
In [8]:
tips.sns.stripplot(x="day");
Specifying y
keyword horizontally plots target
values categorized by y
values.
In [9]:
tips.sns.stripplot(y="day");
You can specify both x
and y
to show intended plots.
In [10]:
tips.sns.stripplot(x="day", y='tip');
In [11]:
tips.sns.stripplot(x="day", hue="time");
In [12]:
tips.sort_values("size").sns.stripplot(x="size");
In [13]:
tips.sns.stripplot(y="day", hue="time");
In [14]:
tips.sns.stripplot(x='tip', y="day", hue="time");
In [15]:
tips.sns.boxplot(x="day", hue="time");
In [16]:
tips.sns.violinplot(y="day", hue="time");
In [17]:
tips.sns.violinplot(y="day", hue="time", bw=.1,
scale="count", scale_hue=False);
In [18]:
tips.sns.violinplot(x="day", hue="sex", split=True);
In [19]:
tips.sns.violinplot(x="day", hue="sex", split=True,
inner="stick", palette="Set3");
In [20]:
tips.sns.violinplot(x="day", inner=None)
tips.sns.stripplot(x="day", jitter=True, size=4);
In [21]:
titanic.sns.barplot(x="sex", hue="class");
In [22]:
titanic.sns.countplot(x='deck', palette="Greens_d");
In [23]:
titanic.sns.countplot(palette="Greens_d");
In [24]:
titanic.sns.countplot(y="deck", hue="class", palette="Greens_d");
In [25]:
titanic.sns.pointplot(x="sex", hue="class");
In [26]:
titanic.sns.pointplot(x="class", hue="sex",
palette={"male": "g", "female": "m"},
markers=["^", "o"], linestyles=["-", "--"]);
In [27]:
iris.sns.boxplot(orient="h");
In [28]:
iris.sns.violinplot(x='species', y='sepal_length');
In [29]:
iris.sns.violinplot(y='sepal_length');
In [30]:
titanic.sns.countplot(y="deck", color="c");
In [31]:
tips.sns.factorplot(x="day", hue="smoker");
In [32]:
tips.sns.factorplot(x="day", hue="smoker", kind="bar");
In [33]:
tips.sns.factorplot(x="day", hue="smoker", col="time", kind="bar");
In [34]:
tips.sns.factorplot(x="time", hue="smoker", col="day",
kind="box", size=4, aspect=.5);
In [35]:
g = tips.sns.PairGrid(x_vars=["smoker", "time", "sex"],
y_vars=["total_bill", "tip"],
aspect=.75, size=3.5)
g.map(sns.violinplot, palette="pastel");