Complex Heatmap - correlation matrix - how to have exact same annotation with same colors for rows and columns?
0
0
Entering edit mode
תום • 0
@cf7bd952
Last seen 19 months ago
Israel

Hi, I'm trying to find an easy way to have a shared annotation for rows and columns. right now i'm just creating the same data.frame for both of them.


ComplexHeatmap::Heatmap(correlation mat, cluster_rows = F, cluster_columns = F, col = viridis::viridis(n = 100,option = 'C'),
left_annotation =  ComplexHeatmap::rowAnnotation(df = data.frame(
cell_type = clst_cell_type,
size = clst_sizes,
col=annot_colors),
top_annotation =  ComplexHeatmap::columnAnnotation(df = data.frame(
cell_type = clst_cell_type,
size = clst_sizes,
col = annot_colors),
show_legend=c(F,F,F)),
)
R heatmaps ComplexHeatmap Heatma • 1.4k views
ADD COMMENT
0
Entering edit mode

Yes, you have to set them separately.

If you want to get rid of repeated coding, you can save the annotation data frame into an object first.

df = data.frame(
    cell_type = clst_cell_type,
    size = clst_sizes,
    col=annot_colors
)

Heatmap(correlation mat, cluster_rows = F, cluster_columns = F, col = viridis::viridis(n = 100,option = 'C'),
    left_annotation =  rowAnnotation(df = df),
    top_annotation =  columnAnnotation(df = df, show_legend=c(F,F,F)),
)
ADD REPLY

Login before adding your answer.

Traffic: 832 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6