Adds a line plot summarizing the values across columns
# S4 method for Iheatmap
add_col_summary(
p,
groups = NULL,
heatmap_name = NULL,
colors = NULL,
tracename = "Col Summary",
showlegend = FALSE,
side = c("top", "bottom"),
layout = list(),
size = 0.3,
buffer = 0.02,
xname = current_xaxis(p),
yname = NULL,
type = c("scatter", "bar"),
summary_function = c("mean", "median", "sd", "var", "mad", "max", "min", "sum"),
...
)
Iheatmap-class
object, which can be printed to generate
an interactive graphic
Iheatmap-class
object
vector of group labels, name of groups colorbar, or TRUE -- see Details
name of a heatmap within the plot
vector of colors or RColorBrewer palette name
name of trace
show legend?
side of plot on which to add subplot
xaxis layout list
relative size of subplot relative to main heatmap
amount of space to leave empty before this plot, relative to size of first heatmap
internal name of xaxis
internal name of yaxis
scatter or bar?
summary function to use, default is mean, options are mean, median, sd, var, mad, max, min, and sum
additional arguments to add_col_plot
or
add_col_barplot
Alicia Schep
If adding the column summary to a vertically oriented heatmap, the summary will be based on the topmost heatmap if side is "top" and based on the bottom heatmap if side is "bottom" unless a "heatmap_name" is specified. The heatmap_name should match the "pname" argument given to a previously added heatmap.
The column summary is based on specific rows if a "groups" argument
is given. The groups argument can either be a vector of group assignments for
each row, the "pname" for an existing set of groups incorporated into the
plot using add_row_groups
, add_row_annotation
,
add_row_clusters
, or add_row_clustering
. If
groups is set to TRUE, then the function will use an existing set of row
groups added to the plot.
add_row_summary
, iheatmap
,
add_col_plot
mat <- matrix(rnorm(20), ncol = 5, nrow = 4)
hm1 <- iheatmap(mat) %>% add_col_summary()
hm2 <- iheatmap(mat) %>% add_col_summary(groups = c("A","A","B","B"))
# Print heatmap if interactive session
if (interactive()) hm1
if (interactive()) hm2
Run the code above in your browser using DataLab