Description Usage Arguments Value Warning Author(s) References See Also Examples
The gvisBubbleChart 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.
A bubble chart is used to visualize a data set with 2 to 4 dimensions. The first two dimensions are visualized as coordinates, the 3rd as color and the 4th as size.
The bubble chart is rendered within the browser using SVG or VML and displays tips when hovering over points.
1 2 3 | gvisBubbleChart(data, idvar = "", xvar = "", yvar = "",
colorvar = "", sizevar = "",
options = list(), chartid)
|
data |
a |
idvar |
column name of |
xvar |
column name of a numerical vector in |
yvar |
column name of a numerical vector in |
colorvar |
column name of data that identifies bubbles in the same
series. Use the same value to identify all bubbles that belong to the
same series; bubbles in the same series will be assigned the same
color. Series can be configured using the |
sizevar |
values in this column are mapped to actual pixel values
using the |
options |
list of configuration options for Google Bubble Chart.
Further possible components are, taken from https://google-developers.appspot.com/chart/interactive/docs/gallery/bubblechart.html#Configuration_Options:
|
chartid |
character. If missing (default) a random chart id will be generated based on
chart type and |
gvisBubbleChart
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 'BubbleChart' |
|
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
|
Google Visualisation API: You cannot load both bubblechart and corechart packages at the same time on the same page.
Markus Gesmann markus.gesmann@gmail.com,
Diego de Castillo decastillo@gmail.com
Google Bubble Chart API: http://code.google.com/apis/chart/interactive/docs/gallery/bubblechart.html
Follow the link for Google's data policy.
See also gvisMotionChart
for a moving bubble chart over
time, and print.gvis
, plot.gvis
for
printing and plotting methods.
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 29 30 | bubble1 <- gvisBubbleChart(Fruits, idvar="Fruit", xvar="Sales", yvar="Expenses")
plot(bubble1)
## Set color and size
bubble2 <- gvisBubbleChart(Fruits, idvar="Fruit", xvar="Sales", yvar="Expenses",
colorvar="Location", sizevar="Profit",
options=list(hAxis='{minValue:75, maxValue:125}'))
plot(bubble2)
## Use year to color the bubbles
bubble3 <- gvisBubbleChart(Fruits, idvar="Fruit", xvar="Sales", yvar="Expenses",
colorvar="Year", sizevar="Profit",
options=list(hAxis='{minValue:75, maxValue:125}'))
plot(bubble3)
## Gradient colour example
bubble4 <- gvisBubbleChart(Fruits, idvar="Fruit", xvar="Sales", yvar="Expenses",
sizevar="Profit",
options=list(hAxis='{minValue:75, maxValue:125}',
colorAxis="{colors: ['lightblue', 'blue']}"))
plot(bubble4)
## Not run:
## Moving bubble chart over time, aka motion chart
M <- gvisMotionChart(Fruits, Fruit, Year)
plot(M)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.