Description Usage Arguments Details Value Author(s) Examples
This function returns a geom_tile graph with color indicating positive/negative and shading indicating the magnitude of the value.
1 | heatmap_no_black(df, xvar, yvar, zvar, pvar, p)
|
df |
A dataframe containing the information to be graphed with variable names in the column names. |
xvar |
Column name of variable to graph on the x axis. |
yvar |
Column name of variable to graph on the y axis. |
zvar |
Column name of variable that defines the shading |
pvar |
Column name of the p.value column. |
p |
The maximum p.value for one of the yvar variables to be colored on the graph. All other yvar varibles will occur white in the graph. |
no additional details
the output is a tile-graph with zvar defining the magnitude/direction of the tile colors.
atomczik
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (df, xvar, yvar, zvar, pvar, p)
{
df <- df[, c(xvar, yvar, zvar, pvar)]
names(df) <- c("xvar", "yvar", "value", "p.value")
subset <- as.data.frame(subset(df, df$p.value <= p))
neg <- subset(subset, subset$value <= 0)
neg$value <- abs(neg$value)
pos <- subset(subset, subset$value > 0)
heat <- ggplot(df, aes(xvar, yvar)) + geom_tile(data = neg,
fill = "red", alpha = neg$value) + geom_tile(data = pos,
fill = "blue", alpha = pos$value) + xlab(xvar) + ylab(yvar) +
theme_bw()
return(heat)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.