plot(birth$weight)
each individual has a position in the x axis
plot(birth$sex)
par(mfrow = c(1,2)) plot(birth$head) hist(birth$head, col="grey", nclass = 30)
par(mfrow = c(1,2)) plot(birth$head) plot(birth$head, col="red")
par(mfrow = c(1,2)) plot(birth$head, cex=2) plot(birth$head, cex=0.5)
par(mfrow = c(1,2)) plot(birth$head, pch=16) plot(birth$head, pch=".")
par(mfrow = c(1,2)) plot(birth$head, type = "l") plot(birth$head, type = "o")
par(mfrow = c(1,2)) plot(birth$head, type = "l", xlim=c(1,100)) plot(birth$head, type = "o", xlim=c(1,100))
plot(birth$weight, main = "Weight at Birth", sub = "694 samples", ylab="weight [gr]")
plot(birth$head) points(birth$age, pch=2)
The first one defines the scale
plot(birth$head, type="l", ylim = c(22,55)) lines(birth$age, col="red")
plot(birth$weight[birth$sex=="M"], ylim=range(birth$weight), ylab = "weight [gr]") points(birth$weight[birth$sex=="F"], col="blue")
boys <- birth$weight[birth$sex=="M"] girls <- birth$weight[birth$sex=="F"] plot(boys, ylim=range(birth$weight), ylab = "weight [gr]") points(girls, col="blue") abline(h=median(boys)) abline(h=median(girls), col="blue") legend("topright", c("boys","girls"), fill=c("black","blue"))
abline
This command adds a straigth line in a specific position
abline(h=1)
adds a horizontal line in 1abline(v=2)
adds a vertical line in 2abline(a=3, b=4)
adds an \(a +b\cdot x\) lineplot(birth$age, birth$apgar5)
plot(jitter(birth$age), jitter(birth$apgar5))
Less precise but more informative