Skip to content

improve inherit_aes #76

Description

@dxe4

vline has inherit_aes as False by default, but you can choose to override it to True.

        ggplot(df, aes(x="weight", fill="sex"))
        + geom_area(stat="bin", alpha=1)
        + geom_vline(
            data=vline_gender_quantiles,
            aes=aes(xintercept="weight", x="weight"),
            size=2,
            line_type="dashed",
            inhert_aes=True,
            alpha=0.7,
        )
        + geom_vline(
            xintercept=global_quantiles, size=2.5, line_type="solid", color="blue"
        )

in this code the first vline will pick the values from aes(x="weight", fill="sex")
but the second vline will not inherit anything.

we need to provide the same logic for other geoms.

the geom class has

    def inherit_aes(self) -> bool:
        return True

we need to provide this attr for the child geoms

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions