Skip to content

Recent changes to geom_label() #5419

Closed
Closed
@aphalo

Description

@aphalo

@teunbrand
This is just a quick question, to help me debug why two geometries in 'ggpp' (geom_label_s() and geom_label_pairwise()), based on code similar to that in the old version of geom_label() are silently failing to display the grobs for the text and box of the label under the current 'ggplot2' under development. Has anything changed in 'ggplot2' in how grobs (a grobTree in this case) are added? Second question, is there already some schedule for the release of 'ggplot2' 3.5.0?
Ideally, there would be solution to this problem, that would work with 3.4.0 and earlier as well as 3.5.0.

Thanks in advance.

Of the plots below, the one at the top is with 'ggplot' installed a couple of hours ago from GitHub. (954924b). The plot at the bottom is with 'ggplot2' 3.4.3 installed from CRAN. This example is from the documentation.

library(ggpp)
my.cars <- mtcars
my.cars$name <- rownames(my.cars)
p1 <- ggplot(my.cars, aes(factor(cyl), mpg)) +
          geom_boxplot(width = 0.33)

# With a factor mapped to x, highlight pairs

my.pairs <-
   data.frame(A = 1:2, B = 2:3, bar.height = c(12, 30),
                     p.value = c(0.01, 0.05678))
p1 +
   geom_label_pairwise(data = my.pairs,
                       aes(xmin = A, xmax = B,
                           y = bar.height,
                           label = sprintf("italic(P)~`=`~%.2f", p.value)),
                       colour = "red", size = 2.75,
                       arrow = grid::arrow(angle = 30,
                                           length = unit(1.5, "mm"),
                                           ends = "both"),
                       parse = TRUE)

image

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions