View source: R/jj_gg_heatmap.R
jj_gg_heatmap | R Documentation |
feature heatmap based on ggplot
jj_gg_heatmap(
df,
x_group,
y_group,
value,
y_annot = NULL,
x_annot = NULL,
order_by_annot = FALSE,
cluster_columns = TRUE,
cluster_rows = T,
show_numbers = FALSE,
size_x = 8,
size_y = 10,
col_scale = "rwb0"
)
df |
data.frame in long format |
x_group |
Group plotted in rows |
y_group |
Group plotted in columns |
value |
Continuous feature used to colour the tiles |
y_annot |
Optional group used to annotate the columns (be careful not to mix up with rows) |
x_annot |
Optional group used to annotate the rows (be careful not to mix up with columns) |
order_by_annot |
instead of clustering columns by values, cluster columns by mixedorder of y annotation |
cluster_columns |
logical, should rows be clustered |
cluster_rows |
logical, should rows be clustered |
show_numbers |
Plot the values as number in each tile |
size_x |
size of x axis labels |
size_y |
size of y axis labels |
col_scale |
Colorscale to use, one of rwb0 (red <0, white = 0, blue >0), viridis |
data('mtcars')
mtcars2 = mtcars %>% dplyr::group_by(cyl, gear) %>% dplyr::summarise(mpg = mean(mpg))
mtcars2$cyl_annot = from_to(mtcars2$cyl, c('4' = 'few', '6' = 'many', '8' = 'many'))
jj_gg_heatmap(mtcars2, x_group = 'cyl', y_group = 'gear', value='mpg', show_numbers = T, col_scale = 'viridis', x_annot = 'cyl_annot')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.