Skip to content

Commit 79e9d49

Browse files
cpsievertclaude
andcommitted
Fix identity scales incorrectly splitting traces
Identity scales (guide = "none") should not cause trace splitting since they don't represent categorical groupings - they use raw values directly. This fixes a regression introduced by the #2467 fix where scales with multiple aesthetics were properly registered, but identity scales were incorrectly included. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent ab65f8e commit 79e9d49

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

R/layers2traces.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ layers2traces <- function(data, prestats_data, layout, p) {
8181
# Register each aesthetic separately for proper legend matching (fixes #2467)
8282
# When a scale has multiple aesthetics (e.g., c("colour", "fill")), we need
8383
# individual entries so "colour_plotlyDomain" matches discreteScales[["colour"]]
84+
# Skip identity scales (guide = "none") as they don't produce legends or trace splitting
8485
discreteScales <- list()
8586
for (sc in p$scales$non_position_scales()$scales) {
86-
if (sc$is_discrete()) {
87+
if (sc$is_discrete() && !identical(sc$guide, "none")) {
8788
for (aes_name in sc$aesthetics) {
8889
discreteScales[[aes_name]] <- sc
8990
}

0 commit comments

Comments
 (0)