#!/usr/bin/env python # coding: utf-8 # In[1]: get_ipython().run_line_magic('load_ext', 'rpy2.ipython') get_ipython().run_line_magic('matplotlib', 'inline') # In[2]: 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() # In[3]: df.plot(kind="scatter", x="length", y="width") # In[5]: get_ipython().run_cell_magic('R', '-i df', "# may need to install.packages ggplot2\nlibrary('ggplot2')\nggplot(df, aes(x=df$width, y=df$length)) + geom_point()\n") # In[ ]: