R plotting #R #plots
test <- data.frame(var.a = c(372.4070, 302.0429), var.b = c(91.76343, 68.51852))
funProp <- function(testCol) {
test[, testCol]/max(test[, testCol])
}
test$var.a.prop <- funProp("var.a")
test$var.b.prop <- funProp("var.b")
barplot(t(as.matrix(test[, c("var.a.prop", "var.b.prop")])), beside = TRUE, yaxt = "n", xlab = "", ylab = "", col = c('black', 'red'), names.arg = c("GO", "NOGO"))
axis(2, at = seq(0, max(test$var.a.prop), length.out = 10), labels = round(seq(0, max(test$var.a), length.out = 10)))
axis(4, at = seq(0, max(test$var.b.prop), length.out = 10), labels = round(seq(0, max(test$var.b), length.out = 10), 2), col = 'red')
mtext("Correct (%)", side=4, line=-1.2, col = 'red')
mtext("Response Time (ms)", side=2, line=-1.2)
darken <- function(color, factor=1.4){
col <- col2rgb(color)
col <- col/factor
col <- rgb(t(col), maxColorValue=255)
col
}
lighten <- function(color, factor=1.4){
col <- col2rgb(color)
col <- col*factor
col <- rgb(t(col), maxColorValue=255)
col
}
makeFootnote <- function(footnoteText = format(Sys.time(), "%d %b %Y"), size = 3, color = grey(.5)) {
require(grid)
pushViewport(viewport())
grid.text(label = footnoteText ,
x = unit(1,"npc") - unit(2, "mm"),
y = unit(2, "mm"),
just = c("right", "bottom"),
gp = gpar(cex = size, col = color))
popViewport()
}