Description Usage Arguments Value See Also Examples
Create heat map visualization of 2D matrix from the data frame data
pre-computed with computeHeatmap
.
1 2 3 4 5 6 7 8 9 10 | createHeatmap(data, x, y, fill, facet = NULL, ncol = 1, baseSize = 12,
baseFamily = "sans", thresholdValue = NULL, thresholdName = fill,
text = FALSE, textFill = fill, percent = FALSE,
digits = ifelse(percent, 2, 4), divergingColourGradient = FALSE,
lowGradient = ifelse(divergingColourGradient, muted("red"), "#56B1F7"),
midGradient = "white", highGradient = ifelse(divergingColourGradient,
muted("blue"), "#132B43"), title = paste("Heatmap by", fill),
subtitle = NULL, xlab = x, ylab = y, legendPosition = "right",
fillGuide = "colorbar", defaultTheme = theme_tufte(base_size = baseSize,
base_family = baseFamily), themeExtra = NULL)
|
data |
data frame contains data computed for heatmap |
x |
name of a column containing x variable values (1st or horizontal dimenstion) in 2D matrix |
y |
name of a column containing y variable values (2d or vertical dimension) in 2D matrix |
fill |
name of a column with values to map to heatmap gradient colors ( |
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 |
baseSize |
|
baseFamily |
|
thresholdValue |
threshold to use to display data in heatmap (if NULL then do not use threshold) |
thresholdName |
name of data attribute from |
text |
if TRUE then display values in heatmap table (default: FALSE) |
textFill |
text to display (applies only when |
percent |
format text as percent |
digits |
number of digits to use in text |
divergingColourGradient |
logical diverging colour gradient places emphasize on both low and high leaving middle neutral. Use when both end grandient colours represent critical values such as negative and positive extremes (e.g. temprature, outliers, etc.). |
lowGradient |
colour for low end of gradient. |
midGradient |
colour for mid point. |
highGradient |
colour for high end of gradient. |
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. |
legendPosition |
the position of legends. ("left", "right", "bottom", "top", or two-element numeric vector). "none" is no legend. |
fillGuide |
Name of guide object, or object itself for the |
defaultTheme |
plot theme settings with default value |
themeExtra |
any additional |
ggplot object
computeHeatmap
for computing data for heat map
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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>")
hm = computeHeatmap(conn, "teams_enh", 'franchid', 'decadeid', 'avg(w) w',
where="decadeid >= 1950")
hm$decadeid = factor(hm$decadeid)
createHeatmap(hm, 'decadeid', 'franchid', 'w')
# with diverging color gradient
hm = computeHeatmap(conn, "teams_enh", 'franchid', 'decadeid', 'avg(w-l) wl',
where="decadeid >= 1950")
hm$decadeid = factor(hm$decadeid)
createHeatmap(hm, 'decadeid', 'franchid', 'wl', divergingColourGradient = TRUE)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.