@@ -395,6 +395,7 @@ geom2trace.GeomPath <- function(data, params, p) {
395
395
# ' @export
396
396
geom2trace.GeomPoint <- function (data , params , p ) {
397
397
shape <- aes2plotly(data , params , " shape" )
398
+ color <- aes2plotly(data , params , " colour" )
398
399
L <- list (
399
400
x = data $ x ,
400
401
y = data $ y ,
@@ -404,21 +405,20 @@ geom2trace.GeomPoint <- function(data, params, p) {
404
405
mode = " markers" ,
405
406
marker = list (
406
407
autocolorscale = FALSE ,
407
- color = aes2plotly( data , params , " fill " ) ,
408
+ color = color ,
408
409
opacity = aes2plotly(data , params , " alpha" ),
409
410
size = aes2plotly(data , params , " size" ),
410
411
symbol = shape ,
411
412
line = list (
412
413
width = aes2plotly(data , params , " stroke" ),
413
- color = aes2plotly( data , params , " colour " )
414
+ color = color
414
415
)
415
416
)
416
417
)
417
- # fill is irrelevant for pch %in% c(1, 15:20)
418
+ # fill is only relevant for pch %in% 21:25
418
419
pch <- uniq(data $ shape ) %|| % params $ shape %|| % GeomPoint $ default_aes $ shape
419
- if (any(pch %in% c(1 , 15 : 20 )) ||
420
- all(grepl(" open$" , shape )) && all(L $ marker $ color %in% " transparent" )) {
421
- L $ marker $ color <- L $ marker $ line $ color
420
+ if (any(idx <- pch %in% 21 : 25 )) {
421
+ L $ marker $ color [idx ] <- aes2plotly(data , params , " fill" )[idx ]
422
422
}
423
423
L
424
424
}
0 commit comments