View source: R/functions_heatmap_with_sideplots.R
ssvHeatmap2 | R Documentation |
An upgrade to setsetvis' ssvSignalHeatmap() function accepts a standard wide matrix with some colname an rowname assumptions.
ssvHeatmap2( mat, treatment_ordering = NULL, replicate_ordering = NULL, treatment_space_size = 0.1, treatment_label_size = 8, main_heights = c(8, 1, 2, 2), main_widths = c(2, 0.1, 0.2, 0.2, 1.8), cluster_ = "cluster_id", treatment_ = "sample", replicate_ = "x", column_ = "column", row_ = "id", fill_ = "y", fill_label = fill_, fill_limits = NULL, nclust = 5, main_title = "Heatmap", main_title.x = 0.02, main_title.y = 0.98, main_title.hjust = 0, main_title.vjust = 1, side_plot_type = c("lines1", "lines2", "bars1", "bars2")[1], side_plot_FUN = NULL, side_plot_ylab = "", side_plot_ylab_width = 0.1, heatmap_colors = rev(seqsetvis::safeBrew(5, pal = "spectral")), symm_colors = TRUE, side_plot_colors = NULL )
mat |
numeric matrix with row and column names set. see details. |
treatment_ordering |
order used for columns and side plots. default NULL causes order of supplied data to be used. |
replicate_ordering |
order used for sub columns and side plots ticks. default NULL causes order of supplied data to be used. |
treatment_space_size |
numeric >=0. size of white space separating heatmap groups. Default is 0.1 |
treatment_label_size |
numeric > 0. size of text to label groups with, default is 8. |
main_heights |
numeric of length 4. controls size of heatmap body, axis ticks, group labels, and scale portion. |
main_widths |
numeric of length 5. controls size of heatmap body, spacer, cluster bars, cluster connector, and aggregate plots |
cluster_ |
variable for cluster assignment |
treatment_ |
name of conditions/treatment groups. appears in plots. |
replicate_ |
name of replicate identifier. appears in plots. |
column_ |
name of heatmap column variable - no effect if supplying mat as matrix. |
row_ |
name of heatmap row variable - no effect if supplying mat as matrix. |
fill_ |
name of heatmap fill variable - no effect if supplying mat as matrix. |
fill_label |
labl for fill legend |
fill_limits |
If not NULL, imposes limits on data. |
nclust |
numeric number of clusters |
main_title |
title appearing above assembled figure. |
main_title.x |
main title x position |
main_title.y |
main title y position |
main_title.hjust |
main title hjust |
main_title.vjust |
main title vjust |
side_plot_type |
plotting method for aggregate side plots. one of c("lines1", "lines2", "bars1", "bars2"). |
side_plot_FUN |
overrides sideplot type. supplied function is executed once per cluster and must return a ggplot. call is: side_plot_FUN(clust, i, fill_, replicate_, treatment_, cluster_, side_plot_colors) Where clust is a tidy data.table containing 4 variables_, i is cluster id. |
side_plot_ylab |
label for y-axis of side plot |
side_plot_ylab_width |
relative wide of y-lab as a fraction of 1, Default is .1 |
heatmap_colors |
colors for heatmap, default uses spectral palette from color brewer. |
symm_colors |
If TRUE, limits will be symmetrical. |
side_plot_colors |
colors for side_plot. must be same length as number of treatment groups. default uses dark2 palette from color brewer. |
colnames must contain a single "_".
Condition or treatment groups should precede the "_".
A unique replicate identifier should follow the "_". Replicate identifiers should be unique within each treatment group.
valid colnames:
A_1, A_2, B_1, B_2
A_1, A_2, A_3
A_1, B_1, C_1, C_2
rownames must be set and be unique.
a ssvH2 object. print() this object for help.
res = ssvHeatmap2(heatmap_demo_matrix) print(res) plot(res) res.lim = ssvHeatmap2(heatmap_demo_matrix, fill_limits = c(-20, 20)) plot(res.lim) res2 = ssvHeatmap2(heatmap_demo_matrix, side_plot_ylab = 'y-value') plot(res2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.