@@ -395,6 +395,7 @@ geom2trace.GeomPath <- function(data, params, p) {
395395# ' @export
396396geom2trace.GeomPoint <- function (data , params , p ) {
397397 shape <- aes2plotly(data , params , " shape" )
398+ color <- aes2plotly(data , params , " colour" )
398399 L <- list (
399400 x = data $ x ,
400401 y = data $ y ,
@@ -404,21 +405,20 @@ geom2trace.GeomPoint <- function(data, params, p) {
404405 mode = " markers" ,
405406 marker = list (
406407 autocolorscale = FALSE ,
407- color = aes2plotly( data , params , " fill " ) ,
408+ color = color ,
408409 opacity = aes2plotly(data , params , " alpha" ),
409410 size = aes2plotly(data , params , " size" ),
410411 symbol = shape ,
411412 line = list (
412413 width = aes2plotly(data , params , " stroke" ),
413- color = aes2plotly( data , params , " colour " )
414+ color = color
414415 )
415416 )
416417 )
417- # fill is irrelevant for pch %in% c(1, 15:20)
418+ # fill is only relevant for pch %in% 21:25
418419 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 ]
422422 }
423423 L
424424}
0 commit comments