In [1]:
options(repr.plot.width = 5)
options(repr.plot.height = 5)
Here is a simple data set that is put into an R Data Frame and then plotted using R's ggplot2 library:
In [2]:
year <- c(2000 , 2001 , 2002 , 2003 , 2004)
rate <- c(9.34 , 8.50 , 7.62 , 6.93 , 6.60)
df = data.frame(year, rate)
In [3]:
head(df)
Out[3]:
In [4]:
library(ggplot2)
In [5]:
ggplot(df, aes(x=year, y=rate)) +
geom_point(shape=1) + # Use hollow circles
geom_smooth(method=lm) # Add linear regression line, with 95% confidence region
In [6]:
head(iris)
Out[6]:
In [7]:
pairs(iris[1:4], main = "Iris Data", pch = 21,
bg = c("red", "green3", "blue")[unclass(iris$Species)])