Base R Graphics
Also: lattice (trellis graphics: xyplot(y ~ x | group)), grid (low-level system underlying ggplot2/lattice).
Also: lattice (trellis graphics: xyplot(y ~ x | group)), grid (low-level system underlying ggplot2/lattice).
x <- rnorm(100); y <- 2 * x + rnorm(100)
plot(x, y, main = "Scatter", xlab = "x", ylab = "y", col = "steelblue", pch = 19)
abline(lm(y ~ x), col = "red", lwd = 2)
hist(x, breaks = 20, col = "grey", main = "Histogram")
boxplot(mpg ~ cyl, data = mtcars, col = c("orange", "skyblue", "pink"))
barplot(table(mtcars$gear), main = "Gears")
lines(density(x)); points(x, y); text(0, 0, "origin"); legend("topleft", legend = "data", pch = 19)
pie(table(mtcars$cyl))
pairs(iris[, 1:4], col = iris$Species)
curve(sin, -pi, pi)
image(volcano); contour(volcano); persp(volcano, theta = 30)
par(mfrow = c(1, 2)) # 1 row, 2 plots
plot(x); hist(y)
par(mfrow = c(1, 1))
png("plot.png", width = 800, height = 600); plot(x, y); dev.off() # save
pdf("plot.pdf"); plot(x); dev.off()