.Purpose Graphs for DB from Fox

> plot(1:25, pch = 1:25, cex = 2, col = "red")
> lines(1:25, type = "h")

DB_Graphs-001.jpg

> plot(1:26, xlab = "letters", ylab = "", type = "n", axes = F)
> box()
> for (i in 1:26) {
+     points(i, 27 - i, pch = letters[i])
+ }

DB_Graphs-002.jpg

palette function - Specify colors using palette

> pie(rep(1, length(palette())), col = palette())

DB_Graphs-003.jpg

rainbow function - Specify colors using rainbow function

> pie(rep(1, 100), col = rainbow(100), labels = rep("", 100))

DB_Graphs-004.jpg

gray function - Specify colors using gray function

> pie(rep(1, 100), col = gray(0:100/100), labels = rep("", 100))

DB_Graphs-005.jpg

lty - Different type of lty’s present

> plot(c(1, 7), c(0, 1), type = "n", axes = F, xlab = "Line Type ",
+     ylab = "")
> box()
> axis(1, 1:6)
> for (i in 1:6) {
+     lines(c(i, i, i + 1), c(0, 0.5, 1), lty = i, lwd = 2)
+ }

DB_Graphs-006.jpg

  1. adding text generally
> plot(c(0, 1), c(0, 1), axes = F, type = "n", xlab = "", ylab = "")
> box()
> text(x = c(0.2, 0.5), y = c(0.2, 0.7), c("Radha", "Krishna"))

DB_Graphs-007.jpg

drawing a triangle

> plot(c(0, 1), c(0, 1), axes = F, type = "n")
> box()
> axis(1, seq(0, 1, 0.2))
> axis(2, seq(0, 1, 0.2))
> lines(c(0.2, 0.2, 0.8, 0.8, 0.2), c(0.2, 0.8, 0.8, 0.2, 0.2))
> segments(0.2, 0.2, 0.8, 0.8, col = "black")

DB_Graphs-008.jpg

drawing a triangle and filling a color

> plot(c(0, 1), c(0, 1), axes = F, type = "n")
> box()
> axis(1, seq(0, 1, 0.2))
> axis(2, seq(0, 1, 0.2))
> lines(c(0.2, 0.2, 0.8, 0.8, 0.2), c(0.2, 0.8, 0.8, 0.2, 0.2))
> polygon(c(0.2, 0.8, 0.8), c(0.2, 0.8, 0.2), col = "blue")

DB_Graphs-009.jpg

drawing a triangle and filling a color

> plot(c(0, 1), c(0, 1), axes = F, type = "n")
> box()
> axis(1, seq(0, 1, 0.2))
> axis(2, seq(0, 1, 0.2))
> polygon(c(0.2, 0.2, 0.8, 0.8, 0.2), c(0.2, 0.8, 0.8, 0.2, 0.2))
> polygon(c(0.2, 0.8, 0.8), c(0.2, 0.8, 0.2), col = "blue")

DB_Graphs-010.jpg

lines

> plot(c(1, 5), c(0, 1), axes = F, type = "n", xlab = "", ylab = "")
> box()
> arrows(x0 = 1:5, y0 = rep(0.1, 5), x1 = 1:5, y1 = seq(0.3, 0.9,
+     len = 5))

DB_Graphs-011.jpg

segments

> plot(c(1, 5), c(0, 1), axes = F, type = "n", xlab = "", ylab = "")
> box()
> segments(x0 = 1:5, y0 = rep(0.1, 5), x1 = 1:5, y1 = seq(0.3,
+     0.9, len = 5))

DB_Graphs-012.jpg