Refs:

library(googleVis)
set.seed(2020)
x <- seq(0,100,by=0.5)
y <- (50-x)^2+rnorm(length(x),sd=100)
 
curvy <- data.frame(x,y) 
 
gvScat <- gvisScatterChart(curvy,
                   options=list(
                     explorer="{actions: ['dragToZoom', 'rightClickToReset'], maxZoomIn:0.05}",
                     gvis.editor="Edit me!",
                     chartArea="{width:'85%',height:'80%'}",
                     hAxis="{title: 'Click&drag for zoom region, right-click to reset', titleTextStyle: {color: '#000000'}}",
                     vAxis="{title: 'Response y',    titleTextStyle: {color: '#000000'}}",
                     backgroundColor="#EEEEEE",
                     title="Curvilinear Relationship",
                     titleTextStyle="{color:'red', fontName:'Courier', fontSize:12}",  
                     width=550, height=500,
                     legend="none"),
                     chartid="ZoomZoom")
 
print(gvScat,'chart')

More egs

df=data.frame(country=c("US", "GB", "BR"), 
               val1=c(10,13,14), 
               val2=c(23,12,32))

gvLine <- gvisLineChart(df)

print(gvLine,'chart')
gvIntensity <- gvisIntensityMap(df)

print(gvIntensity,'chart')
head(Exports)
##         Country Profit Online
## 1       Germany      3   TRUE
## 2        Brazil      4  FALSE
## 3 United States      5   TRUE
## 4        France      4   TRUE
## 5       Hungary      3  FALSE
## 6         India      2   TRUE
Geo=gvisGeoChart(Exports, locationvar="Country", 
                 colorvar="Profit",
                 options=list(projection="kavrayskiy-vii"))
print(Geo,'chart')

Merge charts:

G <- gvisGeoChart(Exports, "Country", "Profit", 
                  options=list(width=300, height=300))
T <- gvisTable(Exports, 
               options=list(width=220, height=300))

GT <- gvisMerge(G,T, horizontal=TRUE) 
print(GT,'chart')
head(Stock)
##         Date  Device  Value          Title          Annotation
## 1 2008-01-01 Pencils   3000           <NA>                <NA>
## 2 2008-01-02 Pencils  14045           <NA>                <NA>
## 3 2008-01-03 Pencils   5502           <NA>                <NA>
## 4 2008-01-04 Pencils  75284           <NA>                <NA>
## 5 2008-01-05 Pencils  41476 Bought pencils Bought 200k pencils
## 6 2008-01-06 Pencils 333222           <NA>                <NA>
gvAnno <- gvisAnnotationChart(Stock, 
                            datevar="Date",
                            numvar="Value", 
                            idvar="Device",
                            titlevar="Title", 
                            annotationvar="Annotation",
                            options=list(
                              width=600, height=350,
                              fill=10, displayExactValues=TRUE,
                              colors="['#0000ff','#00ff00']")
)
plot(gvAnno, 'chart')
AnnoTimeLine  <- gvisAnnotatedTimeLine(Stock, 
                                       datevar="Date",
                                       numvar="Value", 
                                       idvar="Device",
                                       titlevar="Title", 
                                       annotationvar="Annotation",
                                       options=list(displayAnnotations=TRUE,
                                                    width="600px", height="350px"))
plot(AnnoTimeLine, 'chart')
datSK <- data.frame(From=c(rep("A",3), rep("B", 3)),
                    To=c(rep(c("X", "Y", "Z"),2)),
                    Weight=c(5,7,6,2,9,4))

gvSankey <- gvisSankey(datSK, from="From", to="To", weight="Weight",
                     options=list(
                       sankey="{link:  { color: { fill: '#d799ae' } },
                                node:  { color: { fill: '#a61d4c' },
                                label: { color: '#871b47' } }}"))
plot(gvSankey, 'chart')

In this org chart, double-click to expand/collapse:

head(Regions)
##    Region Parent Val Fac
## 1  Global   <NA>  10   2
## 2 America Global   2   4
## 3  Europe Global  99  11
## 4    Asia Global  10   8
## 5  France Europe  71   2
## 6  Sweden Europe  89   3
gvOrg <- gvisOrgChart(Regions, 
                    options=list(width=600, height=250,
                                 size='large', allowCollapse=TRUE))
plot(gvOrg, 'chart')
head(Population[,-5])
##   Rank       Country Population % of World Population Mode       Date
## 1    1         China 1339940000                 19.50 TRUE 2010-10-09
## 2    2         India 1188650000                 17.30 TRUE 2010-10-09
## 3    3 United States  310438000                  4.52 TRUE 2010-10-09
## 4    4     Indonesia  237556363                  3.46 TRUE 2010-10-09
## 5    5        Brazil  193626000                  2.82 TRUE 2010-10-09
## 6    6      Pakistan  170745000                  2.48 TRUE 2010-10-09
PopTable <- gvisTable(Population[,-5], 
                      formats=list(Population="#,###",
                                   '% of World Population'='#.#%'),
                      options=list(page='enable'))
plot(PopTable, 'chart')
head(Andrew)
##         Date/Time UTC  Lat  Long Pressure_mb Speed_kt            Category
## 1 1992-08-16 18:00:00 10.8 -35.5        1010       25 Tropical Depression
## 2 1992-08-17 00:00:00 11.2 -37.4        1009       30 Tropical Depression
## 3 1992-08-17 06:00:00 11.7 -39.6        1008       30 Tropical Depression
## 4 1992-08-17 12:00:00 12.3 -42.0        1006       35      Tropical Storm
## 5 1992-08-17 18:00:00 13.1 -44.2        1003       35      Tropical Storm
## 6 1992-08-18 00:00:00 13.6 -46.2        1002       40      Tropical Storm
##      LatLong                                              Tip
## 1 10.8:-35.5 Tropical Depression<BR>Pressure=1010<BR>Speed=25
## 2 11.2:-37.4 Tropical Depression<BR>Pressure=1009<BR>Speed=30
## 3 11.7:-39.6 Tropical Depression<BR>Pressure=1008<BR>Speed=30
## 4   12.3:-42      Tropical Storm<BR>Pressure=1006<BR>Speed=35
## 5 13.1:-44.2      Tropical Storm<BR>Pressure=1003<BR>Speed=35
## 6 13.6:-46.2      Tropical Storm<BR>Pressure=1002<BR>Speed=40
GeoMarker <- gvisGeoChart(Andrew, "LatLong", 
                          sizevar='Speed_kt',
                          colorvar="Pressure_mb", 
                          options=list(region="US"))
plot(GeoMarker, 'chart')

Google Maps

AndrewMap <- gvisMap(Andrew, "LatLong" , "Tip", 
                     options=list(showTip=TRUE, 
                                  showLine=TRUE, 
                                  enableScrollWheel=TRUE,
                                  mapType='terrain', 
                                  useMapTypeControl=TRUE))
plot(AndrewMap, 'chart')