Interactive Graph in R using RStudio and googleVis package
library(googleVis)
op <- options(gvis.plot.tag = "chart")
Combo Chart
CityPopularity$Mean = mean(CityPopularity$Popularity)
CC <- gvisComboChart(CityPopularity, xvar = "City", yvar = c("Mean", "Popularity"),
options = list(seriesType = "bars", width = 450, height = 300, title = "City Popularity",
series = "{1:{type:\"line\"}}"))
plot(CC)
Table with pages
PopTable <- gvisTable(Population, options = list(width = 600, height = 300,
page = "enable"))
plot(PopTable)
Place two charts next to each other
Geo <- gvisGeoChart(Exports, locationvar = "Country", colorvar = "Profit", options = list(height = 300,
width = 400))
Tbl <- gvisTable(Exports, options = list(height = 300, width = 200))
plot(gvisMerge(Geo, Tbl, horizontal = TRUE))
Hurricane Andrew(1992) storm track
GeoMarker <- gvisGeoChart(Andrew, "LatLong", sizevar = "Speed_kt", colorvar = "Pressure_mb",
options = list(region = "US"))
plot(GeoMarker)
Google maps
AndrewMap <- gvisMap(Andrew, "LatLong", "Tip", options = list(showTip = TRUE,
showLine = TRUE, enableScrollWheel = TRUE, mapType = "terrain", useMapTypeControl = TRUE))
plot(AndrewMap)
Calendar Chart
Interactive Graph
M <- gvisMotionChart(Fruits, "Fruit", "Year", options = list(width = 500, height = 450))
T <- gvisTable(Fruits, options = list(width = 500, height = 300))
MT <- gvisMerge(M, T, horizontal = FALSE)
plot(MT)