File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ plotly_build.plotly <- function(p, registerFrames = TRUE) {
137
137
# verify orientation of boxes/bars
138
138
trace <- verify_orientation(trace )
139
139
# supply sensible defaults based on trace type
140
- trace <- coerce_attr_defaults(trace )
140
+ trace <- coerce_attr_defaults(trace , p $ x $ layout )
141
141
142
142
143
143
@@ -1025,9 +1025,13 @@ has_fill <- function(trace) {
1025
1025
1026
1026
# ensure we've set a sensible trace defaults
1027
1027
# based on the trace type
1028
- coerce_attr_defaults <- function (trace ) {
1029
- if (identical(trace [[" type" ]], " sunburst" )) {
1030
- trace $ stroke <- trace [[" stroke" ]] %|| % I(" white" )
1028
+ coerce_attr_defaults <- function (trace , layout ) {
1029
+ if (trace [[" type" ]] %in% c(" sunburst" , " pie" )) {
1030
+ # As of v1.46.1, paper_bgcolor defaults to '#fff' which
1031
+ # col2rgb() can't parse, but expands to '#ffffff'
1032
+ # https://stackoverflow.com/a/2899224/1583084
1033
+ bgcolor <- p $ x $ layout $ paper_bgcolor %|| % " #ffffff"
1034
+ trace $ stroke <- trace [[" stroke" ]] %|| % default(I(bgcolor ))
1031
1035
}
1032
1036
trace
1033
1037
}
You can’t perform that action at this time.
0 commit comments