Skip to content

Allow expressions in facet formulas #1596

Closed
@dgrtwo

Description

@dgrtwo

I'd like to be able to put expressions in faceted formulae instead of just column names.

For example, I'd like to be able to facet by a "cut" of a column:

ggplot(mtcars, aes(qsec, mpg)) +
  geom_point() +
  facet_wrap(~ cut(wt, c(0, 2, 4, 6)))

rather than needing to do something like:

mtcars$cut <- cut(mtcars$wt, c(0, 2, 4, 6))

ggplot(mtcars, aes(qsec, mpg)) +
  geom_point() +
  facet_wrap(~ cut)

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions