Description Usage Arguments Value Note Author(s) References See Also Examples
The gvisMap function reads a data.frame and creates text output referring to the Google Visualisation API, which can be included into a web page, or as a stand-alone page.
The maps are the well known Google Maps.
1 2 |
data |
a |
locationvar |
column name of
|
tipvar |
column name of |
options |
list of configuration options for Google Map.
Further possible components are, taken from https://google-developers.appspot.com/chart/interactive/docs/gallery/map.html#Configuration_Options:
|
chartid |
character. If missing (default) a random chart id will be generated based on
chart type and |
gvisMap
returns list of class
"gvis
" and "list
".
An object of class "gvis
" is a list containing at least the following components:
|
Google visualisation type, here 'Map' |
|
character id of the chart object. Unique chart ids are required to place several charts on the same page. |
|
a list with the building blocks for a page
|
The Lat-Long pairs option loads maps much faster, especially with large data. We recommend that you use this option for large data sets. Please visit Google Maps API to find out how to transform your addresses to lat-long points. The map can display a maximum of 400 entries; if your data holds more than 400 rows, only the first 400 will be shown.
Markus Gesmann markus.gesmann@gmail.com,
Diego de Castillo decastillo@gmail.com
Google Map API: https://google-developers.appspot.com/chart/interactive/docs/gallery/map.html
Follow the link for Google's data policy.
See also print.gvis
, plot.gvis
for
printing and plotting methods, gvisGeoMap
and gvisIntensityMap
for an
alternative to gvisMap
.
Further the packages:
R2GoogleMaps: Provides a mechanism to generate JavaScript code from R that displays data using Google Maps, http://www.omegahat.org/R2GoogleMaps/.
RgoogleMaps: Overlays on Google map tiles in R, http://cran.r-project.org/web/packages/RgoogleMaps/index.html,
plotGoogleMaps: Plot HTML output with Google Maps API and your own data, http://cran.r-project.org/web/packages/plotGoogleMaps/.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Please note that by default the googleVis plot command
## will open a browser window and requires Internet
## connection to display the visualisation.
## Example with latitude and longitude information
## Plot Hurricane Andrew (1992) storm path:
data(Andrew)
M1 <- gvisMap(Andrew, "LatLong" , "Tip",
options=list(showTip=TRUE, showLine=TRUE, enableScrollWheel=TRUE,
mapType='hybrid', useMapTypeControl=TRUE,
width=800,height=400))
plot(M1)
## Example with address, here UK post-code and some html code in tooltip
df <- data.frame(Postcode=c("EC3M 7HA", "EC2P 2EJ"),
Tip=c("<a href='http://www.lloyds.com'>Lloyd's</a>",
"<a href='http://www.guildhall.cityoflondon.gov.uk/'>Guildhall</a>"))
M2 <- gvisMap(df, "Postcode", "Tip",
options=list(showTip=TRUE, mapType='normal',
enableScrollWheel=TRUE))
plot(M2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.