
> options(prompt = "R> ", continue = "+  ")

> library("colorspace")

> library("vcd")
Loading required package: grid

> library("mvtnorm")

> library("kernlab")

> library("KernSmooth")
KernSmooth 2.23 loaded
Copyright M. P. Wand 1997-2009

> pal <- function(col, border = "light gray", ...) {
+     n <- length(col)
+     plot(0, 0, type = "n", xlim = c(0, 1), ylim = c(0, 1), axes = FALSE, .... [TRUNCATED] 

> par(mfrow = c(2, 2), mar = c(0, 0, 3, 0))

> pal(rainbow_hcl(4, start = 30, end = 300), main = "dynamic")

> pal(rainbow_hcl(4, start = 60, end = 240), main = "harmonic")

> pal(rainbow_hcl(4, start = 270, end = 150), main = "cold")

> pal(rainbow_hcl(4, start = 90, end = -30), main = "warm")

> par(mfrow = c(5, 1), mar = c(0, 0, 0, 0))

> pal(sequential_hcl(12, c = 0, power = 2.2))

> pal(sequential_hcl(12, power = 2.2))

> pal(heat_hcl(12, c = c(80, 30), l = c(30, 90), power = c(1/5, 
+     2)))

> pal(terrain_hcl(12, c = c(65, 0), l = c(45, 90), power = c(1/2, 
+     1.5)))

> pal(rev(heat_hcl(12, h = c(0, -100), c = c(40, 80), 
+     l = c(75, 40), power = 1)))

> par(mfrow = c(4, 1), mar = c(0, 0, 0, 0))

> pal(diverging_hcl(7))

> pal(diverging_hcl(7, c = 100, l = c(50, 90), power = 1))

> pal(diverging_hcl(7, h = c(130, 43), c = 100, l = c(70, 
+     90)))

> pal(diverging_hcl(7, h = c(180, 330), c = 59, l = c(75, 
+     95)))

> seats <- setNames(c(226, 61, 54, 51, 222), c("CDU/CSU", 
+     "FDP", "Linke", "Gruene", "SPD"))

> seats
CDU/CSU     FDP   Linke  Gruene     SPD 
    226      61      54      51     222 

> parties <- rainbow_hcl(6, c = 60, l = 75)[c(5, 2, 
+     6, 3, 1)]

> names(parties) <- names(seats)

> par(mar = rep(0.8, 4))

> pie(seats, clockwise = TRUE, col = parties, radius = 1)

> data("Bundestag2005", package = "vcd")

> votes <- Bundestag2005[c(1, 3:5, 9, 11, 13:16, 2, 
+     6:8, 10, 12), c("CDU/CSU", "FDP", "SPD", "Gruene", "Linke")]

> mosaic(votes, gp = gpar(fill = parties[colnames(votes)]), 
+     spacing = spacing_highlighting, labeling = labeling_left, 
+     labeling_args = li .... [TRUNCATED] 

> library("KernSmooth")

> data("geyser", package = "MASS")

> dens <- bkde2D(geyser[, 2:1], bandwidth = c(0.2, 3), 
+     gridsize = c(201, 201))

> par(mfrow = c(1, 2))

> image(dens$x1, dens$x2, dens$fhat, xlab = "duration", 
+     ylab = "waiting time", col = rev(heat_hcl(33, c = 0, l = c(30, 
+         90), power =  .... [TRUNCATED] 

> box()

> image(dens$x1, dens$x2, dens$fhat, xlab = "duration", 
+     ylab = "waiting time", col = rev(heat_hcl(33, c = c(80, 30), 
+         l = c(30, 90),  .... [TRUNCATED] 

> box()

> library("KernSmooth")

> geyser2 <- cbind(geyser$duration[-299], geyser$waiting[-1])

> dens2 <- bkde2D(geyser2, bandwidth = c(0.2, 3), gridsize = c(201, 
+     201))

> par(mfrow = c(1, 2))

> image(dens2$x1, dens2$x2, dens2$fhat, xlab = "duration", 
+     ylab = "waiting time", col = rev(heat_hcl(33, c = 0, l = c(30, 
+         90), power .... [TRUNCATED] 

> box()

> image(dens2$x1, dens2$x2, dens2$fhat, xlab = "duration", 
+     ylab = "waiting time", col = rev(heat_hcl(33, c = c(80, 30), 
+         l = c(30, 90 .... [TRUNCATED] 

> box()

> art <- xtabs(~Treatment + Improved, data = Arthritis, 
+     subset = Sex == "Female")

> set.seed(1071)

> mosaic(art, gp = shading_max, gp_args = list(n = 5000))

> library("mvtnorm")

> set.seed(123)

> x1 <- rmvnorm(75, mean = c(1.5, 1.5), sigma = matrix(c(1, 
+     0.8, 0.8, 1), ncol = 2))

> x2 <- rmvnorm(75, mean = c(-1, -1), sigma = matrix(c(1, 
+     -0.3, -0.3, 1), ncol = 2))

> X <- rbind(x1, x2)

> ex1 <- data.frame(class = factor(c(rep("a", 75), rep("b", 
+     75))), x1 = X[, 1], x2 = X[, 2])

> library("kernlab")

> fm <- ksvm(class ~ ., data = ex1, C = 0.5)

> suppressWarnings(plot(fm, data = ex1))

 *** Run successfully completed ***
> proc.time()
   user  system elapsed 
  2.264   0.108   2.363 
