Skip to content

Needed: mechanism for deriving property values from other properties #3053

@mwaskom

Description

@mwaskom

We need a way to specify that a property's values should be (a function of) another property. This is most relevant for assigning the outputs of statistical operations to properties. Tt's become an acute need with the introduction of the Text mark (#3051). It's impossible to annotate statistical results (e.g. to put bar counts above the bars. It's also impossible to assign x/y to the text annotation when using Plot.pair, even without a statistical transform.

I've kicked around a few ideas for this. One would be to make this part of the stat config, e.g. through a method call like

Plot(x).add(so.Text(), so.Hist().assign(text="count"))

But that does not solve the Plot.pair problem.

Another option would be some special within the variable assignment itself, akin to ggplot's after_stat. Plot.add accepts multiple transforms, so this would need to be "after all transforms"; I think it would be too complicated to specify that a variable should be assigned in the middle of the transform pipe.

Will develop this idea further.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions