Skip to content

Commit 72c1580

Browse files
authored
Fix global mappings being silently dropped for stat geom aesthetics (#284)
1 parent 7007f67 commit 72c1580

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/execute/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,21 @@ fn merge_global_mappings_into_layers(specs: &mut [Plot], layer_schemas: &[Schema
174174
}
175175

176176
let supported = layer.geom.aesthetics().supported();
177+
let all_names = layer.geom.aesthetics().names();
177178
let schema_columns: HashSet<&str> = schema.iter().map(|c| c.name.as_str()).collect();
178179

179180
// 1. First merge explicit global aesthetics (layer overrides global)
180181
// Note: "color"/"colour" are accepted even though not in supported,
181182
// because split_color_aesthetic will convert them to fill/stroke later
182183
// Note: facet aesthetics (panel, row, column) are also accepted,
183184
// as they apply to all layers regardless of geom support
185+
// Note: Use all_names (not supported) so that Delayed aesthetics like
186+
// pos2 on histogram can be targeted by explicit global mappings, matching
187+
// the behavior of layer-level MAPPING
184188
for (aesthetic, value) in &spec.global_mappings.aesthetics {
185189
let is_color_alias = matches!(aesthetic.as_str(), "color" | "colour");
186190
let is_facet_aesthetic = crate::plot::scale::is_facet_aesthetic(aesthetic.as_str());
187-
if supported.contains(&aesthetic.as_str()) || is_color_alias || is_facet_aesthetic {
191+
if all_names.contains(&aesthetic.as_str()) || is_color_alias || is_facet_aesthetic {
188192
layer
189193
.mappings
190194
.aesthetics

0 commit comments

Comments
 (0)