googleVisの利用例

縦と横の棒グラフ

d <- ddply(iris, .(Species), colwise(mean))
p1 <- gvisBarChart(d)
p2 <- gvisColumnChart(d)
p <- gvisMerge(p1, p2, horizontal = FALSE, chartid = "chart01")
print(p, tag = "chart")

ゲージチャート

p <- gvisGauge(d, chartid = "chart02")
print(p, tag = "chart")

入れ子の棒グラフ

library(reshape2)
d <- dcast(as.data.frame(HairEyeColor), Hair~Eye, fun.aggregate=mean)
## Using Freq as value column: use value.var to override.
p <- gvisBarChart(d, options = list(vAxis = "{title: \"Hair\"}"), chartid = "chart03")
print(p, tag = "chart")

エリアチャート、2軸の線グラフ

d <- data.frame(x = paste(2001:2010), y1 = runif(10), y2 = runif(10)*10, y3 = runif(10))
p1 <- gvisAreaChart(d, options = list(isStacked = TRUE))
p2 <- gvisLineChart(d, xvar = "x", yvar = c("y1", "y2"), 
  options = list(series="[{targetAxisIndex: 0}, {targetAxisIndex:1}]"))
p <- gvisMerge(p1, p2, horizontal = TRUE, chartid = "chart04")
print(p, tag = "chart")

p <- gvisTable(iris, chartid = "chart05")
print(p, tag = "chart")