作者:Zuguang Gu8
    编译:Steven Shen
    原文:Vertical concatenation


    Heatmaps and annotations (now it is column annotation) can be concatenated vertically by the %v% operator. All the relatated settings and adjustments are very similar as the horizontal concatenation. Please check following examples.

    1. mat1t = t(mat1)
    2. mat2t = t(mat2)
    3. ht1 = Heatmap(mat1t, name = "rnorm", col = col_rnorm, row_title = "rnorm")
    4. ht2 = Heatmap(mat2t, name = "runif", col = col_runif, row_title = "runif")
    5. ht3 = Heatmap(rbind(letters = le), name = "letters", col = col_letters)
    6. ht_list = ht1 %v% ht2 %v% ht3
    7. draw(ht_list)

    4.9 垂直连接 - 图1

    1. draw(ht_list, column_km = 2)

    4.9 垂直连接 - 图2

    1. ha = HeatmapAnnotation(foo = anno_barplot(1:12, height = unit(2, "cm")))
    2. ht_list = ht1 %v% ha %v% ht2 %v% ht3
    3. draw(ht_list, column_km = 2)

    4.9 垂直连接 - 图3

    1. ht1 = Heatmap(mat1t, name = "rnorm", col = col_rnorm, row_km = 2)
    2. ht2 = Heatmap(mat2t, name = "runif", col = col_runif, row_km = 2)
    3. ht3 = Heatmap(rbind(letters = le), name = "letters", col = col_letters)
    4. ha = HeatmapAnnotation(foo = anno_barplot(1:12, height = unit(2, "cm")))
    5. ht_list = ht1 %v% ha %v% ht2 %v% ht3
    6. draw(ht_list, column_km = 2)

    4.9 垂直连接 - 图4

    For the vertical heatmap list, now row annotations should be the heatmap components (by right_annotation and left_annotation) and they are adjusted just like column annotations for the horizontal heatmap list.

    1. ht1 = Heatmap(mat1t, name = "rnorm", col = col_rnorm, row_km = 2,
    2. left_annotation = rowAnnotation(foo1 = 1:10, bar1 = anno_barplot(1:10)))
    3. ha = HeatmapAnnotation(foo = anno_barplot(1:12, height = unit(2, "cm"),
    4. axis_param = list(side = "right")))
    5. ht2 = Heatmap(mat2t, name = "runif", col = col_runif, row_km = 2,
    6. left_annotation = rowAnnotation(foo2 = 1:10))
    7. ht3 = Heatmap(rbind(letters = le), name = "letters", col = col_letters)
    8. ht_list = ht1 %v% ha %v% ht2 %v% ht3
    9. draw(ht_list, column_km = 2)

    4.9 垂直连接 - 图5

    Since rowAnnotation() allows arbitary number of annotations, the way showed above is the only way to expand the heatmap list horizontally and vertically at the same time.