%load_ext rpy2.ipython
%matplotlib inline
import pandas as pd
from sklearn import datasets
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="white", color_codes=True)
iris = datasets.load_iris()
df = pd.DataFrame(data= np.c_[iris['data'], iris['target']],
columns= iris['feature_names'] + ['target'])
df.rename(columns={'sepal length (cm)': 'length', 'sepal width (cm)': 'width'}, inplace=True)
df.head()
length | width | petal length (cm) | petal width (cm) | target | |
---|---|---|---|---|---|
0 | 5.1 | 3.5 | 1.4 | 0.2 | 0.0 |
1 | 4.9 | 3.0 | 1.4 | 0.2 | 0.0 |
2 | 4.7 | 3.2 | 1.3 | 0.2 | 0.0 |
3 | 4.6 | 3.1 | 1.5 | 0.2 | 0.0 |
4 | 5.0 | 3.6 | 1.4 | 0.2 | 0.0 |
df.plot(kind="scatter", x="length", y="width")
<matplotlib.axes._subplots.AxesSubplot at 0x10cbf2898>
%%R -i df
# may need to install.packages ggplot2
library('ggplot2')
ggplot(df, aes(x=df$width, y=df$length)) + geom_point()