Skip to content

Barplot options add_numbers messes with ylim #1248

@SciLiciumTheo

Description

@SciLiciumTheo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions