Skip to content

Commit d2d5a0e

Browse files
committed
add modify_aes
1 parent 203a7d9 commit d2d5a0e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

R/layer_entity_class.R

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,14 @@ setMethod(f = "get_preset",
273273
}
274274
)
275275

276-
# Helper function to modify aesthetics (simplified version)
276+
# Helper function to modify aesthetics using modifyList
277277
.modify_aes = function(a, b) {
278-
# This is a simplified version - in practice, this would properly merge ggplot2 aesthetics
279-
# For now, just return the first argument
280-
return(a)
278+
# Use modifyList to merge ggplot2 aesthetics
279+
# This properly handles nested aesthetic mappings
280+
if (is.null(a)) return(b)
281+
if (is.null(b)) return(a)
282+
283+
# modifyList will recursively merge the aesthetic mappings
284+
# where b takes precedence over a for overlapping elements
285+
return(modifyList(a, b))
281286
}

0 commit comments

Comments
 (0)