Skip to content

Commit 6a34308

Browse files
committed
Merge branch 'master' of https://github.com/ropensci/plotly into fix-ggplot2-dev
2 parents 8434748 + 1bd2e70 commit 6a34308

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: plotly
22
Title: Create interactive web-based graphs via plotly's API
3-
Version: 1.0.3
3+
Version: 1.0.4
44
Authors@R: c(person("Chris", "Parmer", role = c("aut", "cph"),
55
email = "[email protected]"),
66
person("Scott", "Chamberlain", role = "aut",

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
1.0.4 -- 14 Aug 2015
2+
3+
Bug fix for subplot. See #265
4+
15
1.0.3 -- 7 Aug 2015
26

37
Improved legend positioning. See #241

R/plotly.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ plotly_build <- function(l = last_plot()) {
218218
for (i in seq_along(l$data)) {
219219
d <- l$data[[i]]
220220
# if appropriate, evaluate trace arguments in a suitable environment
221-
idx <- names(d) %in% c("args", "env")
222-
if (sum(idx) == 2) {
221+
idx <- names(d) %in% c("args", "env", "enclos")
222+
if (sum(idx) == 3) {
223223
dat <- c(d[!idx], eval(d$args, as.list(d$env), d$enclos))
224224
dat[c("args", "env", "enclos")] <- NULL
225225
# start processing specially named arguments
@@ -275,8 +275,8 @@ plotly_build <- function(l = last_plot()) {
275275
}
276276
for (i in seq_along(l$layout)) {
277277
layout <- l$layout[[i]]
278-
idx <- names(layout) %in% c("args", "env")
279-
x$layout[[i]] <- if (sum(idx) == 2) {
278+
idx <- names(layout) %in% c("args", "env", "enclos")
279+
x$layout[[i]] <- if (sum(idx) == 3) {
280280
c(layout[!idx], eval(layout$args, as.list(layout$env), layout$enclos))
281281
} else {
282282
layout
@@ -287,8 +287,8 @@ plotly_build <- function(l = last_plot()) {
287287
if (!is.null(l$style)) {
288288
for (i in seq_along(l$style)) {
289289
sty <- l$style[[i]]
290-
idx <- names(sty) %in% c("args", "env")
291-
new_sty <- if (sum(idx) == 2) c(sty[!idx], eval(sty$args, as.list(sty$env), sty$enclos)) else sty
290+
idx <- names(sty) %in% c("args", "env", "enclos")
291+
new_sty <- if (sum(idx) == 3) c(sty[!idx], eval(sty$args, as.list(sty$env), sty$enclos)) else sty
292292
for (k in sty$traces) x$data[[k]] <- modifyList(x$data[[k]], new_sty)
293293
}
294294
}

R/plotly_POST.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ plotly_POST <- function(x) {
3131
# empty keyword arguments can cause problems
3232
kwargs <- x[get_kwargs()]
3333
kwargs <- kwargs[sapply(kwargs, length) > 0]
34-
34+
3535
# filename & fileopt are keyword arguments required by the API
3636
# (note they can also be specified by the user)
37-
3837
if (!is.null(x$url) || !is.null(kwargs$filename)) kwargs$fileopt <- "overwrite"
3938
if (is.null(kwargs$filename)) {
4039
kwargs$filename <-

R/subplots.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ subplot <- function(..., nrows = 1, which_layout = "merge", margin = 0.02) {
7575
# bump x/y axis anchors appropriately
7676
p_info$xaxis <- sub("x1", "x", paste0("x", p_info$key))
7777
p_info$yaxis <- sub("y1", "y", paste0("y", p_info$key))
78-
7978
# Only do domain computations if they are _completely_ missing
8079
# (I don't think it makes sense to support partial specification of domains)
8180
if (all(is.na(with(p_info, c(xstart, xend, ystart, yend))))) {
82-
p_info[c("xstart", "xend", "yend", "ystart")] <-
83-
get_domains(max(p_info$key), nrows, margin)
81+
doms <- get_domains(max(p_info$key), nrows, margin)
82+
doms$plot <- as.character(seq_len(nrow(doms)))
83+
p_info <- p_info[!names(p_info) %in% c("xstart", "xend", "ystart", "yend")]
84+
p_info <- plyr::join(p_info, doms, by = "plot")
8485
}
8586
# empty plot container that we'll fill up with new info
8687
p <- list(

0 commit comments

Comments
 (0)