View source: R/gvisCoreCharts.R
gvisScatterChart | R Documentation |
The gvisScatterChart 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 actual chart is rendered by the web browser using SVG or VML.
gvisScatterChart(data, options = list(), chartid)
data |
a |
options |
list of configuration options, see: \Sexpr[results=rd]{gsub("CHARTNAME", googleChartName, readLines(file.path(".", "inst", "mansections", "GoogleChartToolsURLConfigOptions.txt")))} \Sexpr[results=rd]{paste(readLines(file.path(".", "inst", "mansections", "gvisOptions.txt")))} |
chartid |
character. If missing (default) a random chart id will be
generated based on chart type and |
returns list
of class
\Sexpr[results=rd]{paste(readLines(file.path(".", "inst",
"mansections", "gvisOutputStructure.txt")))}
Markus Gesmann markus.gesmann@gmail.com,
Diego de Castillo decastillo@gmail.com
Google Chart Tools API: \Sexpr[results=rd]{gsub("CHARTNAME", googleChartName, readLines(file.path(".", "inst", "mansections", "GoogleChartToolsURL.txt")))}
See also print.gvis
, plot.gvis
for
printing and plotting methods
## Please note that by default the googleVis plot command
## will open a browser window and requires an internet
## connection to display the visualisation.
## Scatter chart
Scatter1 <- gvisScatterChart(women)
plot(Scatter1)
## Using optional arguments
Scatter2 <- gvisScatterChart(women, options=list(legend="none",
lineWidth=2, pointSize=2,
title="Women", vAxis="{title:'weight (lbs)'}",
crosshair="{ trigger: 'both' }",
hAxis="{title:'height (in)'}", width=500, height=400))
plot(Scatter2)
df=data.frame(x=sin(1:100/3),
Circle=cos(1:100/3),
Ellipse=cos(1:100/3)*0.5)
## Plot several variables as smooth curves
Scatter3 <- gvisScatterChart(df,
options=list(curveType='function',
pointSize=0,
lineWidth=2))
plot(Scatter3)
## Two series in the same plot with different
## x-values
df <- data.frame(x=c(2,2,1,3,4),
y1=c(0,3,NA,NA,NA),
y2=c(NA,NA,0,3,2))
Scatter4 <- gvisScatterChart(df,
options=list(lineWidth=2,
pointSize=2))
plot(Scatter4)
## Customize points
M <- matrix(nrow=6,ncol=6)
M[col(M)==row(M)] <- 1:6
dat <- data.frame(X=1:6, M)
SC <- gvisScatterChart(dat,
options=list(
title="Customizing points",
legend="right",
pointSize=30,
series="{
0: { pointShape: 'circle' },
1: { pointShape: 'triangle' },
2: { pointShape: 'square' },
3: { pointShape: 'diamond' },
4: { pointShape: 'star' },
5: { pointShape: 'polygon' }
}"))
plot(SC)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.