In [1]:
from ggplot import *
%matplotlib inline
In [2]:
pigeons.head()
Out[2]:
In [3]:
ggplot(pigeons, aes(x='pos', y='speed')) + \
geom_point() + \
geom_abline()
Out[3]:
In [4]:
ggplot(pigeons, aes(x='pos', y='speed')) + \
geom_point() + \
geom_abline(slope=-1)
Out[4]:
In [5]:
ggplot(pigeons, aes(x='pos', y='speed')) + \
geom_point() + \
geom_abline(slope=(180.-80.)/(-100-400), color='DodgerBlue')
Out[5]:
In [6]:
ggplot(pigeons, aes(x='pos', y='speed')) + \
geom_point() + \
geom_abline(slope=(180.-80.)/(-100-400), intercept=170, color='DodgerBlue')
Out[6]:
In [7]:
ggplot(mtcars, aes(x='wt', y='mpg', color='factor(cyl)')) + \
geom_point() + \
geom_abline(slope=-8, intercept=45)
Out[7]:
In [8]:
ggplot(diamonds, aes(x='carat', y='price')) + geom_point()
Out[8]:
In [9]:
ggplot(diamonds, aes(x='carat', y='price')) + \
geom_point(color='PapayaWhip') + \
geom_abline(slope=5000)
Out[9]:
In [10]:
ggplot(diamonds, aes(x='carat', y='price')) + \
geom_point(color='PeachPuff') + \
geom_abline(slope=5000, color='OliveDrab') + \
geom_abline(slope=6000, color='Tomato') + \
geom_abline(slope=7000, color='SaddleBrown')
Out[10]:
In [ ]: