File tree Expand file tree Collapse file tree 2 files changed +8
-21
lines changed Expand file tree Collapse file tree 2 files changed +8
-21
lines changed Original file line number Diff line number Diff line change @@ -351,26 +351,6 @@ plotly_build <- function(l = last_plot()) {
351
351
if (! is.null(a ) && ! is.null(names(a ))) {
352
352
x $ layout $ annotations <- list (x $ layout $ annotations )
353
353
}
354
- # search for keyword args in traces and place them at the top level
355
- kwargs <- lapply(x $ data , function (z ) z [get_kwargs()])
356
- # 'top-level' keywords args take precedence
357
- kwargs <- Reduce(modifyList , c(kwargs , list (x [get_kwargs()])))
358
- # empty keyword arguments can cause problems
359
- kwargs <- kwargs [sapply(kwargs , length ) > 0 ]
360
- # try our damndest to assign a sensible filename
361
- if (is.null(kwargs $ filename )) {
362
- kwargs $ filename <-
363
- as.character(kwargs $ layout $ title ) %|| %
364
- paste(
365
- c(kwargs $ layout $ xaxis $ title ,
366
- kwargs $ layout $ yaxis $ title ,
367
- kwargs $ layout $ zaxis $ title ),
368
- collapse = " vs. "
369
- ) %|| %
370
- " plot from api"
371
- }
372
- # tack on keyword arguments
373
- x <- c(x , kwargs )
374
354
# traces shouldn't have any names
375
355
x $ data <- setNames(x $ data , NULL )
376
356
# add plotly class mainly for printing method
Original file line number Diff line number Diff line change 26
26
27
27
plotly_POST <- function (x , filename , fileopt = " new" , world_readable = TRUE ) {
28
28
x <- plotly_build(x )
29
- if (! missing(filename )) x $ filename <- filename
29
+ x $ filename <- if (! missing(filename )) {
30
+ filename
31
+ } else {
32
+ # try our damndest to assign a sensible filename
33
+ x $ filename %|| % as.character(x $ layout $ title ) %|| %
34
+ paste(c(x $ layout $ xaxis $ title , x $ layout $ yaxis $ title , x $ layout $ zaxis $ title ),
35
+ collapse = " vs. " ) %|| % " plot from api"
36
+ }
30
37
if (! is.null(x $ fileopt ))
31
38
warning(" fileopt was specified in the wrong place. Please specify in plotly_POST()" )
32
39
x $ fileopt <- fileopt
You can’t perform that action at this time.
0 commit comments