<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 About
This notebook presents plotting examples on the famous iris data set by using the Grammar of Graphics implemented in ggplot package. This package is good for those users coming from R, because of its design goal
Step1:  Data
Step2:  geom_point (scatter plot)
Using two continious variables sl and sw within the class labels in species variable, one can see whether there are class differences in the 2D space (via scatter plot).
Step3:  The plot shows that setosa class can be linearly separated from other two classes.
geom_smooth
Step4:  geom_points with subsetting
Step5:  geom_histogram with facetting
<ASSISTANT_TASK:>
Python Code:
from ggplot import *
import pandas as pd
from sklearn import datasets
Explanation: About
This notebook presents plotting examples on the famous iris data set by using the Grammar of Graphics implemented in ggplot package. This package is good for those users coming from R, because of its design goal:
The goal is to have no difference other than those necessary due to the differences between R and Python.
via github.com/yhat/ggplot/
Include
End of explanation
# import iris data
iris = datasets.load_iris()
df1 = pd.DataFrame(iris.data, columns = iris.feature_names)
df2 = pd.DataFrame(iris.target_names[iris.target])
df = pd.concat([df1, df2], axis = 1)
df.head()
df.columns = ['sl', 'sw', 'pl', 'pw', 'species']
Explanation: Data
End of explanation
p1 = ggplot(aes(x = 'sl', y = 'sw', color = 'species'), data = df) + geom_point()
p1
Explanation: geom_point (scatter plot)
Using two continious variables sl and sw within the class labels in species variable, one can see whether there are class differences in the 2D space (via scatter plot).
End of explanation
p2 = ggplot(aes(x = 'sl', y = 'sw', group = 'species', color = 'species'), data = df) + \
    geom_point() + geom_smooth(alpha = 0.5) + theme_bw()
p2
Explanation: The plot shows that setosa class can be linearly separated from other two classes.
geom_smooth
End of explanation
p3 = ggplot(aes(x = 'sl', y = 'sw', color = 'species'), data = df[df.species != 'setosa']) + \
        geom_point() + theme_538()
p3
Explanation: geom_points with subsetting
End of explanation
p3 = ggplot(aes(x = 'sl'), data = df) + geom_histogram() + facet_wrap('species', ncol = 1)
p3
Explanation: geom_histogram with facetting
End of explanation
<END_TASK>