Skip to content

list of key glyphs fail #6545

Closed
Closed
@m-muecke

Description

@m-muecke

I want to create a new glyph combining existing drawing functions. I would've expected adding them in a glob list would work. When implementing a custom geom and implementing the draw_key() method the same error occurs.

library(ggplot2)
library(grid)

p <- ggplot(economics, aes(date, psavert, color = "savings rate"))
p + geom_line(key_glyph = \(data, params, size) gList(draw_key_path(data, params, size)))
#> Error in `gtable_add_grob()`:
#> ! `grobs` must be a single grob or a list of grobs, not a list.
p + geom_line(key_glyph = \(data, params, size) gList(draw_key_path(data, params, size), draw_key_point(data, params, size)))
#> Error in `gtable_add_grob()`:
#> ! `grobs` must be a single grob or a list of grobs, not a list.

Created on 2025-07-06 with reprex v2.1.1

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