gvisIntensityMap
gvisIntensityMap(data, locationvar = "", numvar = "", options = list(), chartid)data.frame. The data has to have at least two columns
with location name (locationvar) and any number of numeric columns
(numvar) to be mapped.data with the geo locations to be
analysed. The location has to contain country ISO codes or USA state codes.data with the numeric values to be
displayed.https://developers.google.com/chart/interactive/docs/gallery/intensitymap#Configuration_Options
The parameters can be set via a named list. The parameters have to map those of the Google documentation.
TRUE or FALSE, using the R syntax.
options=list(width=200, height=300).
Exceptions to this rule are the width and height options for
gvisAnnotatedTimeLine and gvisAnnotationChart.
For those two functions, width and height must be character strings of the
format "Xpx", where X is a number, or "automatic".
For example,
options=list(width="200px", height="300px").
options=list(colors="['#cbb69d', '#603913', '#c69c6e']")
'true' or 'false'.
For example the Google documentaion states the formating options for the
vertical axis and states the parameter as vAxis.format.
Then this paramter can be set in R as:options=list(vAxis="{format:'#,###%'}").
titleTextStyle.color, titleTextStyle.fontName and
titleTextStyle.fontSize, then those can be combined in one list item
such as:
options=list(titleTextStyle="{color:'red', fontName:'Courier', fontSize:16}")
options=list(vAxes="[{title:'val1'}, {title:'val2'}]")
gvis.editor a character label for an
on-page button that opens an in-page dialog box enabling
users to edit, change and customise the chart. By default no
value is given and therefore no button is displayed.
For more details see the Google API documentation and the R examples below.
tempfileclass
"gvis" and "list".
An object of class "gvis" is a list containing at least the
following components:
typechartidhtmlheader...,chartjsHeader tag and
reference to Google's JavaScript library.
jsDatadata as a JSON object.
jsDrawChartjsDisplayChartjsFooter.
jsChartjsDisplayChart function.
divChart container to embed the chart
into the page.
captionfooter..., including the used R and googleVis version
and link to Google's Terms of Use.
print.gvis, plot.gvis for printing and
plotting methods, gvisMap and gvisGeoMap for an
alternative to gvisIntensityMap.
## Please note that by default the googleVis plot command
## will open a browser window and requires Internet
## connection to display the visualisation.
df=data.frame(country=c("US", "GB", "BR"), val1=c(1,3,4), val2=c(23,12,32))
Intensity1 <- gvisIntensityMap(df, locationvar="country", numvar=c("val1", "val2"))
plot(Intensity1)
## Set colours for each tab
Intensity2 <- gvisIntensityMap(df,
options=list(colors="['#4682b4', '#0073CF']"))
plot(Intensity2)
Run the code above in your browser using DataLab