Problem
Similar to the stacking issue fixed in #244, dodge and jitter position adjustments compute group indices from the full DataFrame without accounting for facet panels. Since facet columns are included in partition_by (via add_discrete_columns_to_partition_by), compute_group_indices sees composite groups across facet panels rather than the groups within each panel.
Dodge
compute_group_indices(&df, &layer.partition_by) in dodge.rs:161 creates composite keys from all partition_by columns including facet columns. With fill=["X","Y"] and facet=["F1","F2"], dodge computes n_groups=4 (X-F1, X-F2, Y-F1, Y-F2) instead of the correct n_groups=2 (X, Y) per panel. This makes bars too narrow and offsets incorrect.
Jitter
Same issue when dodge=true — compute_group_indices(&df, &layer.partition_by) at jitter.rs:487 inflates the group count, producing incorrect dodge offsets.
Root cause
partition_by conflates two different kinds of columns:
- Grouping columns (fill, color) — used by dodge/jitter to determine
n_groups
- Panel columns (facet1, facet2) — should reset computations per panel, not inflate group count
Related
Problem
Similar to the stacking issue fixed in #244, dodge and jitter position adjustments compute group indices from the full DataFrame without accounting for facet panels. Since facet columns are included in
partition_by(viaadd_discrete_columns_to_partition_by),compute_group_indicessees composite groups across facet panels rather than the groups within each panel.Dodge
compute_group_indices(&df, &layer.partition_by)indodge.rs:161creates composite keys from allpartition_bycolumns including facet columns. With fill=["X","Y"] and facet=["F1","F2"], dodge computesn_groups=4(X-F1, X-F2, Y-F1, Y-F2) instead of the correctn_groups=2(X, Y) per panel. This makes bars too narrow and offsets incorrect.Jitter
Same issue when
dodge=true—compute_group_indices(&df, &layer.partition_by)atjitter.rs:487inflates the group count, producing incorrect dodge offsets.Root cause
partition_byconflates two different kinds of columns:n_groupsRelated
spec.facetfor stacking groups)