##
##fan
##
# empty plot
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
# add fan
fan(th.mcmc)
# coarser fan
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc, probs = seq(10, 90, 10))
# fan with no lines and text
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc, probs = seq(10, 90, 10), ln = NULL, rlab = NULL)
# black lines
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc, probs = seq(10, 90, 10), ln.col = "black")
# different colour scheme
pal <- colorRampPalette(c("royalblue", "grey", "white"))
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc, probs = seq(10, 90, 10), fan.col = pal)
# transparant fan fill to leave only percentile contor lines
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc, probs = seq(10, 90, 10), alpha=0, ln.col="black")
# prediction interval
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc, type = "interval")
# left labels too
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc, type = "interval", llab = TRUE)
# selected right labels
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc, llab=c(0.1,0.5,0.9), rlab=c(0.2,0.5,0.8))
# change prefixes of labels
plot(NULL, type = "n", xlim = c(1 - 20, 945 + 20), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc, type = "interval", llab = TRUE, rcex = 0.5,
upplab = "Upp ", lowlab = "Low ", medlab="Med")
##
## spaghetti plot
##
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc, style = "spaghetti")
# less transparency
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc, style = "spaghetti", alpha = 0.5)
# more lines, red.
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc, style = "spaghetti", ln.col = "red", n.spag = 100)
##
## boxplots
##
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc[, seq(1, 945, 21)], style = "boxplot", frequency = 1/21)
# additional arguments for boxplot
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc[, seq(1, 945, 21)], style = "boxplot", frequency = 1/21,
outline = FALSE, col = "red", notch = TRUE)
##
## boxfan
##
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc[, seq(1, 945, 21)], style = "boxfan", type = "interval", frequency = 1/21)
# more space between boxes
plot(NULL, type = "n", xlim = c(1, 945), ylim = range(th.mcmc), ylab = "Theta")
fan(th.mcmc[, seq(1, 945, 21)], style = "boxfan", type = "interval",
frequency = 1/21, space = 10)
# overlay spaghetti
fan(th.mcmc[, seq(1, 945, 21)], style = "spaghetti",
frequency = 1/21, n.spag = 50, ln.col = "red")
Run the code above in your browser using DataLab