Description Usage Arguments Value See Also Examples
Create a bubble chart that utilizes three dimensions of data. It is a variation of the scatter plot with data points replaced with shapes ("bubbles"): x and y are bubble location and z is its size. It can optionally assign data points labels and fill shapes with colors.
1 2 3 4 5 6 7 8 9 10 11 | createBubblechart(data, x, y, z, label = z, fill = NULL, facet = NULL,
ncol = 1, facetScales = "fixed", xlim = NULL, baseSize = 12,
baseFamily = "sans", shape = 21, shapeColour = "black",
scaleSize = TRUE, shapeSizeRange = c(3, 10), shapeMaxSize = 100,
paletteValues = NULL, palette = "Set1", title = paste("Bubble Chart by",
fill), subtitle = NULL, xlab = x, ylab = y, labelSize = 5,
labelFamily = "", labelFontface = "plain", labelColour = "black",
labelVJust = 0.5, labelHJust = 0.5, labelAlpha = 1, labelAngle = 0,
legendPosition = "right", sizeGuide = FALSE, fillGuide = "colorbar",
defaultTheme = theme_tufte(base_size = baseSize, base_family = baseFamily),
themeExtra = NULL)
|
data |
data frame contains data computed for bubblechart |
x |
name of a column containing x variable values |
y |
name of a column containing y variable values |
z |
name of a column containing bubble size value |
label |
name of a column containing bubble label |
fill |
name of a column with values to use for bubble colours |
facet |
vector of 1 or 2 column names to split up data to plot the
subsets as facets. If single name then subset plots are placed next to
each other, wrapping with |
ncol |
number of facet columns (applies when single facet column supplied only
- see parameter |
facetScales |
Are scales shared across all subset plots (facets):
"fixed" - all are the same, "free_x" - vary across rows (x axis),
"free_y" - vary across columns (Y axis, default), "free" - both rows and
columns (see in |
xlim |
a vector specifying the data range for the x scale and the default order of their display in the x axis. |
baseSize |
|
baseFamily |
|
shape |
bubble shape |
shapeColour |
colour of shapes |
scaleSize |
logical if TRUE then scale the size of shape to be proportional to the value, if FALSE then scale the area. |
shapeSizeRange |
bubble size range (applies only when |
shapeMaxSize |
size of largest shape (applies only when |
paletteValues |
actual palette colours for use with |
palette |
Brewer palette name - see |
title |
plot title. |
subtitle |
plot subtitle. |
xlab |
a label for the x axis, defaults to a description of x. |
ylab |
a label for the y axis, defaults to a description of y. |
labelSize |
size of labels |
labelFamily |
label font name or family name |
labelFontface |
label font face ( |
labelColour |
color of labels |
labelVJust |
position of the anchor (0=bottom edge, 1=top edge), can go below 0 or above 1 |
labelHJust |
position of the label anchor (0=left edge, 1=right edge), can go below 0 or above 1 |
labelAlpha |
the transparency of the text label |
labelAngle |
the angle at which to draw the text label |
legendPosition |
the position of legends. ("left", "right", "bottom", "top", or two-element numeric vector). "none" is no legend. |
sizeGuide |
Name of guide object, or object itself for the |
fillGuide |
Name of guide object, or object itself for the |
defaultTheme |
plot theme settings with default value |
themeExtra |
any additional |
ggplot object
computeAggregates
computes data for the bubble chart.
1 2 3 4 5 6 7 8 9 10 11 12 13 | if(interactive()){
# initialize connection to Lahman baseball database in Aster
conn = odbcDriverConnect(connection="driver={Aster ODBC Driver};
server=<dbhost>;port=2406;database=<dbname>;uid=<user>;pwd=<pw>")
cormat = computeCorrelations(channel=conn, "pitching_enh", sqlColumns(conn, "pitching_enh"),
include = c('w','l','cg','sho','sv','ipouts','h','er','hr','bb',
'so','baopp','era','whip','ktobb','fip'),
where = "decadeid = 2000", test=FALSE)
# remove duplicate correlation values (no symmetry)
cormat = cormat[cormat$metric1 < cormat$metric2, ]
createBubblechart(cormat, "metric1", "metric2", "value", label=NULL, fill="sign")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.