@@ -100,6 +100,8 @@ aesConverters <-
100
100
toRGB(col )
101
101
},size = identity ,alpha = identity ,shape = function (pch ){
102
102
pch2symbol [as.character(pch )]
103
+ }, barmode = function (bm ) {
104
+ position2barmode [bm ][[1 ]]
103
105
})
104
106
105
107
toBasic <-
@@ -170,7 +172,10 @@ geom2trace <-
170
172
list (x = data $ x ,
171
173
y = data $ y ,
172
174
name = params $ name ,
173
- type = " bar" )
175
+ text = data $ text ,
176
+ type = " bar" ,
177
+ # barmode=paramORdefault(...),
178
+ fillcolor = toRGB(params $ fill ))
174
179
}
175
180
)
176
181
@@ -184,7 +189,7 @@ markLegends <-
184
189
list (point = c(" colour" , " fill" , " shape" ),
185
190
path = c(" linetype" , " size" , " colour" ),
186
191
polygon = c(" colour" , " fill" , " linetype" , " size" , " group" ),
187
- bar = c(" fill" ))
192
+ bar = c(" fill" , " barmode " ))
188
193
189
194
markUnique <- as.character(unique(unlist(markLegends )))
190
195
@@ -373,6 +378,8 @@ gg2list <- function(p){
373
378
layout $ margin $ r <- 10
374
379
layout $ legend <- list (bordercolor = " transparent" , x = 100 , y = 1 / 2 )
375
380
381
+ # # Barmode.
382
+ # layout$barmode <- position2barmode[...][[1]]
376
383
trace.list $ kwargs <- list (layout = layout )
377
384
trace.list
378
385
}
@@ -572,3 +579,7 @@ toRGB <- function(x){
572
579
ifelse(is.na(x ), " none" , rgb.css )
573
580
}
574
581
582
+ # ' Convert R position to plotly barmode
583
+ position2barmode <- c(" stack" = " stack" ,
584
+ " dodge" = " group" ,
585
+ " identity" = " overlay" )
0 commit comments