Skip to content

Commit 5860c71

Browse files
committed
Merge branch 'master' of https://github.com/plotly/plotly.R
2 parents d7568f7 + e6cc271 commit 5860c71

File tree

384 files changed

+1136
-531
lines changed

Some content is hidden

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

384 files changed

+1136
-531
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ jobs:
3535
- {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
3636
- {os: ubuntu-18.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
3737
- {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
38-
- {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
3938

4039
env:
4140
RSPM: ${{ matrix.config.rspm }}
@@ -72,47 +71,45 @@ jobs:
7271
key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
7372
restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
7473

75-
- name: Install system dependencies
74+
- name: Install Linux sysdeps
7675
if: runner.os == 'Linux'
7776
run: |
7877
pak::local_system_requirements(execute = TRUE)
7978
pak::pkg_system_requirements("rcmdcheck", execute = TRUE)
8079
shell: Rscript {0}
81-
82-
- uses: actions/setup-node@v1
83-
with:
84-
node-version: ${{ matrix.config.node }}
85-
86-
- name: Install orca
87-
if: matrix.config.visual_tests == true
88-
run: npm install -g electron@6.1.4 orca
89-
shell: bash
90-
91-
- name: Install phantomjs
92-
if: matrix.config.shinytest == true
93-
run: |
94-
pak::pak("shinytest")
95-
shinytest::installDependencies()
96-
pak::pak()
97-
shell: Rscript {0}
98-
80+
9981
- name: Install dependencies
10082
run: |
101-
pak::local_install_dev_deps(upgrade = TRUE)
83+
if (Sys.info()[['sysname']] == 'Darwin') options(pkgType = 'mac.binary')
84+
pak::local_install_dev_deps(upgrade = FALSE)
10285
pak::pkg_install("rcmdcheck")
10386
shell: Rscript {0}
104-
105-
- name: Session info
87+
88+
- name: Set up Python 3.8
89+
uses: actions/setup-python@v2
90+
with:
91+
python-version: 3.8
92+
93+
- name: Install kaleido
94+
if: matrix.config.visual_tests == true
10695
run: |
107-
options(width = 100)
108-
pkgs <- installed.packages()[, "Package"]
109-
sessioninfo::session_info(pkgs, include_base = TRUE)
110-
shell: Rscript {0}
96+
sudo chown -R $UID $CONDA # https://github.com/nextstrain/conda/issues/5
97+
Rscript -e "reticulate::install_miniconda()"
98+
Rscript -e "reticulate::conda_install('r-reticulate', 'python-kaleido')"
99+
Rscript -e "reticulate::conda_install('r-reticulate', 'plotly', channel = 'plotly')"
100+
Rscript -e "reticulate::use_miniconda('r-reticulate')"
101+
102+
- name: Install shinytest deps
103+
if: matrix.config.shinytest == true
104+
run: |
105+
Rscript -e 'shinytest::installDependencies()'
106+
R CMD install .
107+
shell: bash
111108

112109
# Run test() before R CMD check since, for some reason, rcmdcheck::rcmdcheck() skips vdiffr tests
113110
- name: Run Tests
114111
run: |
115-
options(crayon.enabled = TRUE)
112+
options(crayon.enabled = TRUE, testthat.progress.max_fails=1000)
116113
if (!require(devtools)) pak::pak("devtools")
117114
if (!require(reshape2)) pak::pak("reshape2")
118115
res <- devtools::test()

DESCRIPTION

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: plotly
22
Title: Create Interactive Web Graphics via 'plotly.js' (modified for use in MIRO)
3-
Version: 4.9.4.9000
3+
Version: 4.10.0.9999
44
Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"),
55
email = "cpsievert1@gmail.com", comment = c(ORCID = "0000-0002-4958-2844")),
66
person("Chris", "Parmer", role = "aut",
@@ -22,8 +22,8 @@ Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"),
2222
person("Plotly Technologies Inc.", role = "cph"))
2323
License: MIT + file LICENSE
2424
Description: Create interactive web graphics from 'ggplot2' graphs and/or a custom interface to the (MIT-licensed) JavaScript library 'plotly.js' inspired by the grammar of graphics.
25-
URL: https://plotly-r.com, https://github.com/ropensci/plotly#readme, https://plotly.com/r/
26-
BugReports: https://github.com/ropensci/plotly/issues
25+
URL: https://plotly-r.com, https://github.com/plotly/plotly.R, https://plotly.com/r/
26+
BugReports: https://github.com/plotly/plotly.R/issues
2727
Depends:
2828
R (>= 3.2.0)
2929
Imports:
@@ -54,6 +54,7 @@ Suggests:
5454
hexbin,
5555
ggthemes,
5656
GGally,
57+
ggalluvial,
5758
testthat,
5859
knitr,
5960
devtools,
@@ -66,17 +67,18 @@ Suggests:
6667
webshot,
6768
listviewer,
6869
dendextend,
69-
sf,
7070
maptools,
7171
rgeos,
72+
sf,
7273
png,
7374
IRdisplay,
7475
processx,
7576
plotlyGeoAssets,
7677
forcats,
7778
palmerpenguins,
78-
rversions
79+
rversions,
80+
reticulate
7981
LazyData: true
80-
RoxygenNote: 7.1.1
82+
RoxygenNote: 7.1.2
8183
Encoding: UTF-8
8284
Roxygen: list(markdown = TRUE)

NAMESPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ S3method(print,api)
3333
S3method(print,api_grid)
3434
S3method(print,api_grid_local)
3535
S3method(print,api_plot)
36+
S3method(print,kaleidoScope)
3637
S3method(print,plotly_data)
3738
S3method(to_basic,GeomAbline)
3839
S3method(to_basic,GeomAnnotationMap)
@@ -134,6 +135,7 @@ export(hide_guides)
134135
export(hide_legend)
135136
export(highlight)
136137
export(highlight_key)
138+
export(kaleido)
137139
export(knit_print.api_grid)
138140
export(knit_print.api_grid_local)
139141
export(knit_print.api_plot)
@@ -166,6 +168,7 @@ export(remove_typedarray_polyfill)
166168
export(rename)
167169
export(rename_)
168170
export(renderPlotly)
171+
export(save_image)
169172
export(schema)
170173
export(select)
171174
export(select_)
@@ -257,6 +260,7 @@ importFrom(tidyr,unnest)
257260
importFrom(tools,file_ext)
258261
importFrom(tools,file_path_sans_ext)
259262
importFrom(utils,browseURL)
263+
importFrom(utils,capture.output)
260264
importFrom(utils,data)
261265
importFrom(utils,file.edit)
262266
importFrom(utils,getFromNamespace)

NEWS.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,39 @@
1-
# 4.9.4.9000
1+
# 4.10.0.9000
22

3-
## Changes to plotly.js
3+
## New features
4+
5+
* `ggplotly()` now supports the `{ggalluvial}` package. (#2061, thanks @moutikabdessabour)
6+
* `highlight()` now supports `on="plotly_selecting"`, enabling client-side linked brushing via mouse click+drag (no mouse-up event required, as with `on="plotly_selected"`). (#1280)
7+
8+
## Bug fixes
9+
10+
* `ggplotly()` now converts `stat_ecdf()` properly. (#2065)
11+
* `ggplotly()` now correctly handles `geom_tile()` with no `fill` aesthetic. (#2063)
12+
* `ggplotly()` now respects `guide(aes = "none")` (e.g., `guide(fill = "none")`) when constructing legend entries. (#2067)
13+
* Fixed an issue with translating `GGally::ggcorr()` via `ggplotly()`. (#2012)
14+
15+
## Improvements
16+
17+
* `ggplotly()` does not issue warnings with `options(warnPartialMatchArgs = TRUE)` any longer. (#2046, thanks @bersbersbers)
418

5-
* This version of the R package upgrades the version of the underlying plotly.js library from v1.57.1 to v2.0.0. This includes many breaking changes, bug fixes, and improvements to the underlying JavaScript library. The [plotly.js release page](https://github.com/plotly/plotly.js/releases) has the full list of changes.
19+
# 4.10.0
620

7-
## Breaking changes
21+
## Breaking changes in JavaScript API
22+
23+
* This version of the R package upgrades the version of the underlying plotly.js library from v1.57.1 to v2.5.1. This includes many breaking changes, bug fixes, and improvements to the underlying JavaScript library. Most of the breaking changes are summarized in [this announcement of the 2.0 release](https://community.plotly.com/t/announcing-plotly-js-2-0/53675), but [see here](https://github.com/plotly/plotly.js/blob/HEAD/CHANGELOG.md) for the full changelog.
24+
25+
## Breaking changes in R API
826

927
* `ggplotly()` now uses the `layout.legend.title` (instead of `layout.annotations`) plotly.js API to convert guides for discrete scales. (#1961)
28+
* `renderPlotly()` now uses `Plotly.react()` (instead of `Plotly.newPlot()`) to redraw when `layout(transition = )` is specified. This makes it possible/easier to implement a smooth transitions when `renderPlotly()` gets re-executed. (#2001)
29+
30+
## New Features
31+
32+
* Added new functions for static image exporting via the [kaleido python package](https://github.com/plotly/Kaleido), namely `save_image()` and `kaleido()`. See `help(save_image, package = "plotly")` for installation info and example usage. (#1971)
33+
34+
## Improvements
35+
36+
* `ggplotly()` now better positions axis titles for `facet_wrap()`/`facet_grid()`. (#1975)
1037

1138
# 4.9.4.1
1239

@@ -39,7 +66,7 @@
3966

4067
* All HTTP requests are now retried upon failure (#1656, @jameslamb).
4168

42-
* R linebreaks (`\n`) in _factor labels_ are now translated to HTML linebreaks (`<br />`), too. Before, this conversion was only done for colums of type character. ([#1700](https://github.com/ropensci/plotly/pull/1700), @salim-b).
69+
* R linebreaks (`\n`) in _factor labels_ are now translated to HTML linebreaks (`<br />`), too. Before, this conversion was only done for colums of type character. ([#1700](https://github.com/plotly/plotly.R/pull/1700), @salim-b).
4370

4471
## BUG FIXES
4572

@@ -173,7 +200,7 @@ This is minor patch release with a few minor bug fixes and updates test expectat
173200

174201
### Other improvements relevant for all **plotly** objects
175202

176-
* LaTeX rendering via MathJax is now supported and the new `TeX()` function may be used to flag a character vector as LaTeX (#375). Use the new `mathjax` argument in `config()` to specify either external (`mathjax="cdn"`) or local (`mathjax="local"`) MathJaX. If `"cdn"`, mathjax is loaded externally (meaning an internet connection is needed for TeX rendering). If `"local"`, the PLOTLY_MATHJAX_PATH environment variable must be set to the location (a local file path) of MathJax. IMPORTANT: **plotly** uses SVG-based mathjax rendering which doesn't play nicely with HTML-based rendering (e.g., **rmarkdown** documents and **shiny** apps). To leverage both types of rendering, you must `<iframe>` your plotly graph(s) into the larger document (see [here](https://github.com/ropensci/plotly/blob/master/inst/examples/rmd/MathJax/index.Rmd) for an **rmarkdown** example and [here](https://github.com/ropensci/plotly/blob/master/inst/examples/rmd/MathJax/index.Rmd) for a **shiny** example).
203+
* LaTeX rendering via MathJax is now supported and the new `TeX()` function may be used to flag a character vector as LaTeX (#375). Use the new `mathjax` argument in `config()` to specify either external (`mathjax="cdn"`) or local (`mathjax="local"`) MathJaX. If `"cdn"`, mathjax is loaded externally (meaning an internet connection is needed for TeX rendering). If `"local"`, the PLOTLY_MATHJAX_PATH environment variable must be set to the location (a local file path) of MathJax. IMPORTANT: **plotly** uses SVG-based mathjax rendering which doesn't play nicely with HTML-based rendering (e.g., **rmarkdown** documents and **shiny** apps). To leverage both types of rendering, you must `<iframe>` your plotly graph(s) into the larger document (see [here](https://github.com/plotly/plotly.R/blob/master/inst/examples/rmd/MathJax/index.Rmd) for an **rmarkdown** example and [here](https://github.com/plotly/plotly.R/blob/master/inst/examples/rmd/MathJax/index.Rmd) for a **shiny** example).
177204
* The selection (i.e., linked-brushing) mode can now switch from 'transient' to 'persistent' by holding the 'shift' key. It's still possible to _force_ persistent selection by setting `persistent = TRUE` in `highlight()`, but `persistent = FALSE` (the default) is now recommended since it allows one to switch between [persistent/transient selection](https://plotly-r.com/client-side-linking.html#fig:txmissing-modes) in the browser, rather than at the command line.
178205
* The `highlight()` function gains a `debounce` argument for throttling the rate at which `on` events may be fired. This is mainly useful for improving user experience when `highlight(on = "plotly_hover")` and mousing over relevant markers at a rapid rate (#1277)
179206
* The new `partial_bundle()` function makes it easy to leverage [partial bundles of plotly.js](https://github.com/plotly/plotly.js#partial-bundles) for reduced file sizes and faster render times.
@@ -444,7 +471,7 @@ limits.
444471

445472
## BUG FIXES
446473

447-
* `event_data()` now works inside shiny modules (#659). For an example, see <https://github.com/ropensci/plotly/tree/master/inst/examples/shiny/event_data_modules>
474+
* `event_data()` now works inside shiny modules (#659). For an example, see <https://github.com/plotly/plotly.R/tree/master/inst/examples/shiny/event_data_modules>
448475

449476
# 4.3.6 -- 9 September 2016
450477

R/add.R

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,14 @@ add_data <- function(p, data = NULL) {
130130
#' layout(title = "Basic Pie Chart using Plotly")
131131
#'
132132
#' data(wind)
133-
#' plot_ly(wind, r = ~r, t = ~t) %>%
133+
#' plot_ly(wind, r = ~r, theta = ~t) %>%
134134
#' add_area(color = ~nms) %>%
135-
#' layout(radialaxis = list(ticksuffix = "%"), orientation = 270)
135+
#' layout(
136+
#' polar = list(
137+
#' radialaxis = list(ticksuffix = "%"),
138+
#' angularaxis = list(rotation = 90)
139+
#' )
140+
#' )
136141
#'
137142
#' # ------------------------------------------------------------
138143
#' # 3D chart types
@@ -432,20 +437,29 @@ add_image <- function(p, z = NULL, colormodel = NULL, ..., data = NULL, inherit
432437

433438
#' @inheritParams add_trace
434439
#' @rdname add_trace
435-
#' @param r For polar chart only. Sets the radial coordinates.
436-
#' @param t For polar chart only. Sets the radial coordinates.
440+
#' @param r Sets the radial coordinates.
441+
#' @param theta Sets the angular coordinates.
442+
#' @param t Deprecated. Use `theta` instead.
437443
#' @export
438-
add_area <- function(p, r = NULL, t = NULL, ...,
444+
add_area <- function(p, r = NULL, theta = NULL, t = NULL, ...,
439445
data = NULL, inherit = TRUE) {
446+
if (!is.null(t)) {
447+
message(
448+
"Since `add_area()` now uses the barpolar instead of the area trace, ",
449+
"the `t` argument is now deprecated. Use the `theta` argument instead."
450+
)
451+
}
452+
theta <- theta %||% t
440453
if (inherit) {
441-
r <- t %||% p$x$attrs[[1]][["r"]]
442-
t <- t %||% p$x$attrs[[1]][["t"]]
454+
attrs <- p$x$attrs[[1]]
455+
r <- r %||% attrs[["r"]]
456+
theta <- theta %||% (attrs[["theta"]] %||% attrs[["t"]])
443457
}
444-
if (is.null(r) || is.null(t)) {
445-
stop("Must supply `r`/`t` attributes", call. = FALSE)
458+
if (is.null(r) || is.null(theta)) {
459+
stop("Must supply `r`/`theta` attributes", call. = FALSE)
446460
}
447461
add_trace_classed(
448-
p, class = "plotly_area", r = r, t = t, type = "area",
462+
p, class = "plotly_area", r = r, theta = theta, type = "barpolar",
449463
..., data = data, inherit = inherit
450464
)
451465
}

R/deprecated.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ get_figure <- function(username, id) {
5151
#' For more details and examples, see \url{https://plotly.com/r/getting-started/}.
5252
#'
5353
#' If you're here looking for an intro/overview of the package, see the
54-
#' \href{https://github.com/ropensci/plotly/#getting-started}{readme}
54+
#' \href{https://github.com/plotly/plotly.R/#getting-started}{readme}
5555
#'
5656
#' @keywords internal
5757
#' @param username plotly username

0 commit comments

Comments
 (0)