Skip to content

Resolve name conflicts: as_grob() #131

@clauswilke

Description

@clauswilke

Both cowplot and patchwork define generics as_grob(). However, cowplot exports it and patchwork does not. It seems like the easiest solution for now, to avoid any immediate problems, would be to rename the internal patchwork function. If you agree, I'm happy to prepare a PR.

Going forward, we should have a discussion of what this type of function should do and where it should live. The main difference I see is that your function doesn't open a background device for as_grob.ggplot() whereas mine does. I think both approaches are needed. When you're calling as_grob.ggplot() during the final output phase, for example as part of a ggsave() call, then opening a background device is not needed (and is actually harmful). But if you're calling as_grob.ggplot() before final output is generated, e.g. because you're aligning plots that will be output later, then not having an open background device can cause weird bugs in some settings, at least it has done so for me in the past (wilkelab/cowplot#24 wilkelab/cowplot#51 wilkelab/cowplot#73 wilkelab/cowplot#82).

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