@@ -123,16 +123,14 @@ plotly_build.plotly <- function(p) {
123123 builtData $ .plotlyTraceIndex <- Reduce(paste2 , builtData [isSplit ])
124124 }
125125 # Build the index used to determine grouping (later on, NAs are inserted
126- # via group2NA() to create the groups). This is done in 4 parts:
126+ # via group2NA() to create the groups). This is done in 3 parts:
127127 # 1. Sort data by the trace index since groups are nested within traces.
128128 # 2. Translate missing values on positional scales to a grouping variable.
129129 # If grouping isn't relevant for this trace, a warning is thrown since
130130 # NAs are removed.
131131 # 3. The grouping from (2) and any groups detected via dplyr::groups()
132132 # are combined into a single grouping variable, .plotlyGroupIndex
133- builtData <- arrange_safe(
134- builtData , c(" .plotlyTraceIndex" , if (inherits(trace , " plotly_line" )) " x" )
135- )
133+ builtData <- arrange_safe(builtData , " .plotlyTraceIndex" )
136134 isComplete <- complete.cases(builtData [names(builtData ) %in% c(" x" , " y" , " z" )])
137135 # is grouping relevant for this geometry? (e.g., grouping doesn't effect a scatterplot)
138136 hasGrp <- inherits(trace , paste0(" plotly_" , c(" segment" , " path" , " line" , " polygon" ))) ||
@@ -158,11 +156,11 @@ plotly_build.plotly <- function(p) {
158156 interaction(dat [isComplete , grps , drop = FALSE ]),
159157 builtData $ .plotlyGroupIndex %|| % " "
160158 )
161- builtData <- arrange_safe(
162- builtData , c(" .plotlyTraceIndex" , " .plotlyGroupIndex" , if (inherits(trace , " plotly_line" )) " x" )
163- )
164159 }
165160
161+ builtData <- arrange_safe(builtData ,
162+ c(" .plotlyTraceIndex" , " .plotlyGroupIndex" , if (inherits(trace , " plotly_line" )) " x" )
163+ )
166164 builtData <- train_data(builtData , trace )
167165 trace $ .plotlyVariableMapping <- names(builtData )
168166
0 commit comments