Bieu do tan xa cua dataset = mtcars

Giua 2 bien wt & mpg

library('car')
## Loading required package: carData
attach(mtcars)
scatterplot(wt~mpg | am, ylim=c(1,6), main='Scatterplot of wt by mpg', col=c('red','blue'), pch=c(16,8))

Bieu do tan xa cua dataset = iris

Giua 2 bien Sepal.Length & Sepal.Width, bien phan nhom = Species

attach(iris)
scatterplot(main='Scatterplot of Sepal.Length by Sepal.Width with factor = Species', Sepal.Length~Sepal.Width | Species)

ggplot cua dataset = iris

library('ggplot2')
## 
## Attaching package: 'ggplot2'
## The following object is masked from 'mtcars':
## 
##     mpg
z = ggplot(iris, aes(x=Sepal.Width, y=Sepal.Length))
z + geom_point(aes(col=Species)) + theme_bw() + theme(legend.position='bottom') + ggtitle('ggplot of Sepal.Length by Sepal.Width with factor Species')

THE END