Skip to content

Feature request: type stability in internals, specifically at unlist() operations #3688

Closed
@teunbrand

Description

@teunbrand

I was experimenting with having S3 classes based on the vctrs package as xy coordinates and extending the scales to support these alternative coordinates (link to specific use case ). However, I ran into the problem that unlist operations in ggplot code drop relevant attributes and recursively flatten the data. This would be preventable if unlist operations on S3 classes preserve type stability.

One of the pieces of code that I'm struggling with, is updating/training limits, which needs to go through the scale_apply() function, wherein data is unlisted.

I've asked a question on stackoverflow to try and get around this from the vctrs end that illustrates my struggle with unlist and vctrs classes. I'm also aware that the vctrs package has its own syntax for unlist operations.

I think that type stability in general would be a good thing, and would allow for a richer set of ggplot extensions that support vctrs-based S3 classes. Therefore, I'd like to propose more type stable equivalents of unlist() in the ggplot internals.

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