ComplexHeatmap icon indicating copy to clipboard operation
ComplexHeatmap copied to clipboard

Barplot options add_numbers messes with ylim

Open thegrebe opened this issue 11 months ago • 0 comments

Hi all,

It seems adding numbers to a barplot messes with the ylim.

Normal behavior:

set.seed(123)
lt = list(a = sample(letters, 5),
          b = sample(letters, 10),
          c = sample(letters, 15))
m1 = make_comb_mat(lt)

top_ha = HeatmapAnnotation(
    "normal" = anno_barplot(comb_size(m1),
                            gp = gpar(fill = "red"),
                            height = unit(2, "cm"),
                            add_numbers=FALSE,
                            ylim=c(0,8)),
    gap = unit(2, "mm"), annotation_name_side = "left", annotation_name_rot = 0)
UpSet(m1, top_annotation = top_ha)

Image

Incorrect behavior (notice the y limits are not 0-8 but 0-11):

top_ha = HeatmapAnnotation(
    "normal" = anno_barplot(comb_size(m1),
                            gp = gpar(fill = "red"),
                            height = unit(2, "cm"),
                            add_numbers=TRUE,
                            ylim=c(0,8)),
    gap = unit(2, "mm"), annotation_name_side = "left", annotation_name_rot = 0)
UpSet(m1, top_annotation = top_ha)

Image

Cheers, Theo

Edit 1: This is with ComplexHeatmap_2.22.0 with R 4.4.2

thegrebe avatar May 28 '25 09:05 thegrebe