Skip to content

Commit c947733

Browse files
committed
merge with master
2 parents 18f592e + dd3b1da commit c947733

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1515
-2793
lines changed

.travis.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ before_install:
55
- chmod 755 ./travis-tool.sh
66
- ./travis-tool.sh bootstrap
77
# password is encrypted below
8-
- echo "Sys.setenv('plotly_username' = 'dfvd')" > ~/.Rprofile
8+
- echo "Sys.setenv('plotly_username' = 'RTestBot3000')" > ~/.Rprofile
99

1010
install:
1111
- ./travis-tool.sh install_deps
@@ -20,16 +20,11 @@ script:
2020

2121
after_success:
2222
- cd ../plotly-test-table
23-
- ls -R
2423
- Rscript ../plotly/inst/build-push-comment.R
2524

2625
env:
2726
global:
2827
# plotly_api_key (for posting to plot.ly)
29-
- secure: "eHO4OUmgLusU9i4xSvr3daZxnsMZw3x4FH8BYVEC8Ja+Ey6kkAFFSh2iAC/CqewEYJ7I/M8aIJYqlyTMGRYUgy36WU7iWHAGgaZOU8fIB5dWzMwHbIvS4Naq2sdU7lRT7sxkS+40K1+rplpWDoLF2yt8vSRWo9rjNzp+yc8PjXM="
28+
- secure: "UAETDsmeXkXm9eUpZa3JTm8/cv+jyLmArXE0TQD0yQNICFNPkGeNergoQmkesRqG+ifLu6V1lPXu1XlqQPdXY60clUHThDN+AjsBmcv9F170k6RtBSV8pIKL9fsW8t0v/maEet86qOSf3cNa5+gK8GjBH1pmLrN2rF9r7RhwUdg="
3029
# GITHUB_PAT (for pushing to plotly-test-table)
31-
- secure: "LHJONgWOo+98vNeFLI7LSJU3RtbMVszlI79GB8CcXmc2mlgM/UtZ5b6RnkNlhmg3Gj1/uObfm/rIybVTwuS1yNpeKv73+gsZOYhobVXiUGVxdRFG/mg5mbqwyWkkuofjPGFlMZCEMgHim37eZzgjSibwVH1LClRDsCoFMCgvgV0="
32-
# plotlyjs_full (link to the full offline bundle)
33-
- secure: "ivxfqGwbzpBpVJe+jVcOBktcmLrT38W/ZapAk/FNDu+yaBhag1eCYErAPPx6Snc4GzwatMt22v4SxAqXQF4SAhTRtmrWVaWnbhzuNqpTkiS6IKEd6EqaoyUZvUTgXh1ruyik00zl3ET9898O3vFfqafodljE0lCLVICHq6ANo68="
34-
# plotlyjs_no_jq (link to the offline bundle w/o jQuery)
35-
- secure: "i5cYEs2lCFSYgrSTHMmzzs8hRwAwiz89GpgM16fqUDQz8T1QMWofNugQInS7fIfKL36FoTz8BaiLs2D98/2kDkkZ0LTHnfrdrY9PO+7D+CmL8QeLLp4atBT0i682nwy8RzEqlvB8yAVQo/i0Eh8tmT97pppddsxttZKoUidfOeA="
30+
- secure: "LHJONgWOo+98vNeFLI7LSJU3RtbMVszlI79GB8CcXmc2mlgM/UtZ5b6RnkNlhmg3Gj1/uObfm/rIybVTwuS1yNpeKv73+gsZOYhobVXiUGVxdRFG/mg5mbqwyWkkuofjPGFlMZCEMgHim37eZzgjSibwVH1LClRDsCoFMCgvgV0="

DESCRIPTION

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
Package: plotly
2-
Title: Create interactive web-based graphs via plotly's API
3-
Version: 1.0.0
4-
Authors@R: c(person("Chris", "Parmer", role = c("aut", "cph"),
2+
Title: Create Interactive Web Graphics via Plotly's JavaScript Graphing Library
3+
Version: 2.0.6
4+
Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"),
5+
email = "[email protected]"),
6+
person("Chris", "Parmer", role = c("aut", "cph"),
57
email = "[email protected]"),
8+
person("Toby", "Hocking", role = "aut",
9+
email = "[email protected]"),
610
person("Scott", "Chamberlain", role = "aut",
711
email = "[email protected]"),
812
person("Karthik", "Ram", role = "aut",
913
email = "[email protected]"),
10-
person("Toby", "Hocking", role = "aut",
11-
email = "[email protected]"),
1214
person("Marianne", "Corvellec", role = "aut",
1315
email = "[email protected]"),
1416
person("Pedro", "Despouy", role = "aut",
15-
email = "[email protected]"),
16-
person("Carson", "Sievert", role = c("aut", "cre"),
17-
email = "[email protected]"))
17+
email = "[email protected]"))
1818
License: MIT + file LICENSE
19-
Description: Create interactive web-based graphs via plotly's API.
20-
Easily translate ggplot2 plots to plotly and/or create custom plotly graphs.
21-
Once uploaded to a plotly account, plotly graphs (and the data behind them)
22-
can be viewed and modified in a web browser.
23-
URL: https://github.com/ropensci/plotly
19+
Description: Easily translate ggplot2 graphs to an interactive web-based version and/or create custom web-based visualizations directly from R. Once uploaded to a plotly account, plotly graphs (and the data behind them) can be viewed and modified in a web browser.
20+
URL: https://plot.ly/r, https://github.com/ropensci/plotly
2421
BugReports: https://github.com/ropensci/plotly/issues
2522
Depends:
2623
ggplot2
@@ -30,14 +27,24 @@ Imports:
3027
jsonlite,
3128
magrittr,
3229
digest,
33-
viridis
30+
viridis,
31+
base64enc,
32+
htmlwidgets,
33+
plyr
3434
Suggests:
3535
dplyr,
3636
maps,
3737
testthat,
3838
knitr,
3939
devtools,
4040
shiny,
41+
htmltools,
42+
curl,
4143
rmarkdown,
42-
RColorBrewer
44+
RColorBrewer,
45+
Rserve,
46+
RSclient,
47+
broom
4348
LazyData: true
49+
VignetteBuilder: knitr
50+
RoxygenNote: 5.0.1

NAMESPACE

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
# Generated by roxygen2 (4.1.1): do not edit by hand
1+
# Generated by roxygen2: do not edit by hand
22

3-
S3method(print,offline)
3+
S3method(print,figure)
44
S3method(print,plotly)
55
export("%>%")
66
export(add_trace)
7+
export(config)
78
export(embed_notebook)
89
export(get_figure)
910
export(gg2list)
1011
export(ggplot_build2)
1112
export(ggplotly)
1213
export(group2NA)
13-
export(knit_print.offline)
14+
export(knit_print.figure)
1415
export(knit_print.plotly)
1516
export(last_plot)
1617
export(layer2traces)
@@ -20,6 +21,7 @@ export(paramORdefault)
2021
export(plot_ly)
2122
export(plotly)
2223
export(plotlyOutput)
24+
export(plotly_IMAGE)
2325
export(plotly_POST)
2426
export(plotly_build)
2527
export(plotly_empty)
@@ -31,4 +33,20 @@ export(toRGB)
3133
import(ggplot2)
3234
import(httr)
3335
import(jsonlite)
36+
importFrom(base64enc,base64encode)
37+
importFrom(grDevices,col2rgb)
38+
importFrom(htmlwidgets,createWidget)
39+
importFrom(htmlwidgets,shinyRenderWidget)
40+
importFrom(htmlwidgets,shinyWidgetOutput)
41+
importFrom(htmlwidgets,sizingPolicy)
3442
importFrom(magrittr,"%>%")
43+
importFrom(plyr,ddply)
44+
importFrom(plyr,join)
45+
importFrom(plyr,summarise)
46+
importFrom(stats,setNames)
47+
importFrom(utils,browseURL)
48+
importFrom(utils,data)
49+
importFrom(utils,getFromNamespace)
50+
importFrom(utils,modifyList)
51+
importFrom(utils,packageVersion)
52+
importFrom(viridis,viridis)

NEWS

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,79 @@
1+
2.0.6 -- 2 Dec 2015
2+
3+
Upgrade to plotlyjs 1.1.1. Fixes #319.
4+
5+
2.0.5 -- 1 Dec 2015
6+
7+
Fix for legend names. See #236.
8+
9+
2.0.4 -- 28 Nov 2015
10+
11+
Fix #313.
12+
13+
2.0.3 -- 18 Nov 2015
14+
15+
Fixed bug causing knitr options to be ignored. Also added VignetteBuilder to DESCRIPTION to vignette is available.
16+
17+
2.0.2 -- 17 Nov 2015
18+
19+
Using plotly_build() on a ggplot object should always return a plotly object
20+
21+
2.0.1 -- 17 Nov 2015
22+
23+
Better printing of server figures. Documentation and other fixes for initial CRAN release!
24+
25+
2.0.0 -- 2 Nov 2015
26+
27+
Added a dependency on htmlwidgets and 'offline' plots are now the default. If you want to create a figure on a plotly server, you need to use `plotly_POST()`. Also added a `config()` function to control the default appearance of the interactive plot
28+
29+
1.0.10 -- 3 Nov 2015
30+
31+
Fixed #292.
32+
33+
1.0.9 -- 28 Sep 2015
34+
35+
Fixed filename, fileopt arguments in plot_ly. Specifying the same filename will now overwrite the plot if it exists.
36+
37+
1.0.8 -- 14 Sep 2015
38+
39+
Added the plotly_IMAGES() function which interfaces to the images endpoint https://api.plot.ly/v2/#images
40+
41+
Details -> https://github.com/ropensci/plotly/pull/279
42+
43+
1.0.7 -- 26 Aug 2015
44+
45+
See https://github.com/ropensci/plotly/pull/275
46+
47+
1.0.6 -- 25 Aug 2015
48+
49+
Fix a bug with subplot domain calculations (see https://github.com/ropensci/plotly/pull/274)
50+
51+
1.0.5 -- 20 Aug 2015
52+
53+
Fix issue converting plotly offline markdown documents to HTML when using `markdown::markdownToHTML`
54+
55+
1.0.4 -- 14 Aug 2015
56+
57+
Bug fix for subplot. See #265
58+
59+
1.0.3 -- 7 Aug 2015
60+
61+
Improved legend positioning. See #241
62+
63+
1.0.2 -- 2 Aug 2015
64+
65+
* last_plot() will now look for the last plotly object; if not found, it will try to find the last ggplot object.
66+
* Officially added the filename, fileopt, and world_readable arguments to plot_ly() and ggplotly().
67+
* If plotly offline is not available, the shiny.launch.browser option is changed to open a web brower. See #245.
68+
* Various namespace/documentation improvements for R CMD check.
69+
70+
1.0.1 -- 2 Aug 2015
71+
72+
Removed the stream() function as it wasn't ready to be included.
73+
174
1.0.0 -- 31 July 2015
275

3-
A major reworking of package internals which includes a few backwards incompatible changes.
76+
A major reworking of package internals which includes a few backwards incompatible changes.
477

578
Major changes include:
679

@@ -30,7 +103,7 @@ Let gg2list() return a figure object (backwards incompatible change).
30103

31104
0.5.29 -- 16 April 2015
32105

33-
geom_density() as filled area chart #202
106+
geom_density() as filled area chart #202
34107

35108
0.5.28 -- 15 April 2015
36109

R/build_function.R

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,29 @@
1010
#' @keywords internal
1111
#' @export
1212
ggplot_build2 <- local({
13-
# Get body of the original function, in list form
14-
ggplot_build2 <- ggplot2::ggplot_build
15-
g_b <- as.list(body(ggplot_build2))
16-
17-
# Find line where we want to insert new code
18-
line_after <- quote(data <- calculate_stats(panel, data, layers))
19-
idx <- vapply(g_b, identical, line_after, FUN.VALUE=TRUE)
20-
idx <- which(idx)
21-
22-
# Insert new code before that line
23-
new_line <- quote(prestats.data <- data)
24-
return_value <- quote(list(data=data, panel=panel, plot=plot,
25-
prestats.data=prestats.data))
26-
g_b2 <- c(g_b[seq(1, idx-1)], list(new_line), g_b[seq(idx, length(g_b)-1)],
27-
return_value)
28-
29-
# Assign the modified body back into the function
30-
body(ggplot_build2) <- as.call(g_b2)
31-
ggplot_build2
13+
tryCatch({
14+
# Get body of the original function, in list form
15+
ggplot_build2 <- ggplot2::ggplot_build
16+
g_b <- as.list(body(ggplot_build2))
17+
18+
# Find line where we want to insert new code
19+
line_after <- quote(data <- calculate_stats(panel, data, layers))
20+
idx <- vapply(g_b, identical, line_after, FUN.VALUE=TRUE)
21+
idx <- which(idx)
22+
23+
if (length(idx) != 1) {
24+
warning("ggplotly() is not compatible with this version of ggplot2", call. = F)
25+
} else {
26+
# Insert new code before that line
27+
new_line <- quote(prestats.data <- data)
28+
return_value <- quote(list(data=data, panel=panel, plot=plot,
29+
prestats.data=prestats.data))
30+
g_b2 <- c(g_b[seq(1, idx-1)], list(new_line), g_b[seq(idx, length(g_b)-1)],
31+
return_value)
32+
33+
# Assign the modified body back into the function
34+
body(ggplot_build2) <- as.call(g_b2)
35+
}
36+
ggplot_build2
37+
})
3238
})

R/deprecated.R

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#' Main interface to plotly
2+
#'
3+
#' Deprecated: see \link{signup} for credentials/configuration storage details.
4+
#' See \link{ggplotly} for the new ggplot2 interface.
5+
#'
6+
#' @param username plotly username
7+
#' @param key plotly API key
8+
#' @export
9+
plotly <- function(username, key) {
10+
11+
if (!missing(username)) {
12+
message("Storing 'username' as the environment variable 'plotly_username'")
13+
Sys.setenv("plotly_username" = username)
14+
} else {
15+
usr <- verify("username")
16+
}
17+
if (!missing(key)) {
18+
message("Storing 'key' as the environment variable 'plotly_api_key'")
19+
Sys.setenv("plotly_api_key" = key)
20+
} else {
21+
key <- verify("api_key")
22+
}
23+
24+
.Deprecated("ggplotly")
25+
.Deprecated("plot_ly")
26+
invisible(NULL)
27+
}
28+
29+
30+
#' Plotly Offline
31+
#'
32+
#' Deprecated in version 2.0 (offline plots are now the default)
33+
#'
34+
#' @param p a plotly object
35+
#' @param height A valid CSS unit. (like "100\%", "600px", "auto") or a number,
36+
#' which will be coerced to a string and have "px" appended.
37+
#' @param width A valid CSS unit. (like "100\%", "600px", "auto") or a number,
38+
#' which will be coerced to a string and have "px" appended.
39+
#' @param out_dir a directory to place the visualization.
40+
#' If \code{NULL}, a temporary directory is used when the offline object is printed.
41+
#' @param open_browser open the visualization after creating it?
42+
#' @author Carson Sievert
43+
#' @return a plotly object of class "offline"
44+
#' @export
45+
46+
offline <- function(p, height, width, out_dir, open_browser) {
47+
.Deprecated("plot_ly")
48+
p
49+
}

0 commit comments

Comments
 (0)