## Please note that by default the googleVis plot command
## will open a browser window and requires Internet
## connection to display the visualisation.
## Regions examples
## The regions style fills entire regions (typically countries) with
## colors corresponding to the values that you assign
G1a <- gvisGeoChart(Exports, locationvar='Country', colorvar='Profit')
plot(G1a)
## Change projection
G1b <- gvisGeoChart(Exports, locationvar='Country', colorvar='Profit',
options=list(projection="kavrayskiy-vii"))
plot(G1b)
## Plot only Europe
G2 <- gvisGeoChart(Exports, "Country", "Profit",
options=list(region="150"))
plot(G2)
## Example showing US data by state
require(datasets)
states <- data.frame(state.name, state.x77)
G3 <- gvisGeoChart(states, "state.name", "Illiteracy",
options=list(region="US", displayMode="regions",
resolution="provinces",
width=600, height=400))
plot(G3)
G4 <- gvisGeoChart(Andrew, "LatLong", colorvar='Speed_kt',
options=list(region="US"))
plot(G4)
G5 <- gvisGeoChart(Andrew, "LatLong", sizevar='Speed_kt',
colorvar="Pressure_mb", options=list(region="US"))
plot(G5)
## Create lat:long values and plot a map of Oceania
## Set background colour to light-blue
require(stats)
data(quakes)
head(quakes)
quakes$latlong<-paste(quakes$lat, quakes$long, sep=":")
G6 <- gvisGeoChart(quakes, "latlong", "depth", "mag",
options=list(displayMode="Markers", region="009",
colorAxis="{colors:['red', 'grey']}",
backgroundColor="lightblue"))
plot(G6)
Run the code above in your browser using DataLab