Skip to content

geom_bar with stat="identity" and position="stack" broken if some fields missing #141

@Vindaar

Description

@Vindaar

When using geom_bar with already computed statistics and stacking them based on some additional fill column (different groups by color), the generation of the plot can fail if not every group is present in each "stack" (has a value for each label of the fill column).

This is because in filledIdentityGeom (called due to stat = "identity") we do not call addZeroKeys as we do in filledCountGeom:
https://github.com/Vindaar/ggplotnim/blob/master/src/ggplotnim/postprocess_scales.nim#L813

Possibly the fix is as simple as adding such a call to the "stack" logic here:
https://github.com/Vindaar/ggplotnim/blob/master/src/ggplotnim/postprocess_scales.nim#L467

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