Skip to content

Commit e9cb526

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

File tree

436 files changed

+775
-542
lines changed

Some content is hidden

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

436 files changed

+775
-542
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
config:
2929
- {os: macOS-latest, r: 'release', visual_tests: true, node: "14.x", shinytest: true}
3030
- {os: windows-latest, r: 'release'}
31-
- {os: windows-latest, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/latest"}
31+
#- {os: windows-latest, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/latest"}
3232
- {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.1.0 (ubuntu-18.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
3333
# vdiffr & shinytest only runs on linux r-release since the results aren't cross-platform
3434
- {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}

DESCRIPTION

Lines changed: 4 additions & 3 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.10.0.9999
3+
Version: 4.10.1.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",
@@ -77,8 +77,9 @@ Suggests:
7777
forcats,
7878
palmerpenguins,
7979
rversions,
80-
reticulate
80+
reticulate,
81+
rsvg
8182
LazyData: true
82-
RoxygenNote: 7.1.2
83+
RoxygenNote: 7.2.3
8384
Encoding: UTF-8
8485
Roxygen: list(markdown = TRUE)

NAMESPACE

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ S3method(api_create,data.frame)
44
S3method(api_create,ggplot)
55
S3method(api_create,plotly)
66
S3method(embed_notebook,plotly)
7-
S3method(fortify,SharedData)
87
S3method(geom2trace,GeomBar)
98
S3method(geom2trace,GeomBlank)
109
S3method(geom2trace,GeomBoxplot)
@@ -25,6 +24,9 @@ S3method(highlight_key,plotly)
2524
S3method(layout,matrix)
2625
S3method(layout,plotly)
2726
S3method(layout,shiny.tag.list)
27+
S3method(linewidth_or_size,Geom)
28+
S3method(linewidth_or_size,default)
29+
S3method(linewidth_or_size,element)
2830
S3method(plotly_build,"NULL")
2931
S3method(plotly_build,gg)
3032
S3method(plotly_build,list)
@@ -36,6 +38,7 @@ S3method(print,api_plot)
3638
S3method(print,kaleidoScope)
3739
S3method(print,plotly_data)
3840
S3method(to_basic,GeomAbline)
41+
S3method(to_basic,GeomAlluvium)
3942
S3method(to_basic,GeomAnnotationMap)
4043
S3method(to_basic,GeomArea)
4144
S3method(to_basic,GeomBoxplot)
@@ -47,6 +50,8 @@ S3method(to_basic,GeomDensity2d)
4750
S3method(to_basic,GeomDotplot)
4851
S3method(to_basic,GeomErrorbar)
4952
S3method(to_basic,GeomErrorbarh)
53+
S3method(to_basic,GeomFunction)
54+
S3method(to_basic,GeomHex)
5055
S3method(to_basic,GeomHline)
5156
S3method(to_basic,GeomJitter)
5257
S3method(to_basic,GeomLine)
@@ -64,6 +69,7 @@ S3method(to_basic,GeomSf)
6469
S3method(to_basic,GeomSmooth)
6570
S3method(to_basic,GeomSpoke)
6671
S3method(to_basic,GeomStep)
72+
S3method(to_basic,GeomStratum)
6773
S3method(to_basic,GeomTile)
6874
S3method(to_basic,GeomViolin)
6975
S3method(to_basic,GeomVline)
@@ -251,6 +257,7 @@ importFrom(purrr,transpose)
251257
importFrom(rlang,"!!!")
252258
importFrom(rlang,"!!")
253259
importFrom(rlang,eval_tidy)
260+
importFrom(rlang,is_na)
254261
importFrom(stats,complete.cases)
255262
importFrom(stats,is.leaf)
256263
importFrom(stats,quantile)

NEWS.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
1-
# 4.10.0.9000
1+
# 4.10.1.9000
2+
3+
## Bug fixes
4+
5+
* `ggplotly()` no longer errors given a `geom_area()` with 1 or less data points (error introduced by new behavior in ggplot2 v3.4.0). (#2209)
6+
7+
8+
# 4.10.1
9+
10+
## Changes to plotly.js
11+
12+
* This version of the R package upgrades the version of the underlying plotly.js library from v2.5.1 to v2.11.1. This includes many bug fixes and improvements. The [plotly.js release page](https://github.com/plotly/plotly.js/releases) has the full list of changes.
213

314
## New features
415

16+
* `plotlyOutput()` gains a new `fill` parameter. When `TRUE` (the default), the widget's container element is allowed to grow/shrink to fit it's parent container so long as that parent is opinionated about its height and has been marked with `htmltools::bindFillRole(x, container = TRUE)`. (#2198)
17+
* The primary motivation for this is to allow plots to grow/shrink by default [inside `bslib::card_body_fill()`](https://rstudio.github.io/bslib/articles/cards.html#responsive-sizing)
518
* `ggplotly()` now supports the `{ggalluvial}` package. (#2061, thanks @moutikabdessabour)
619
* `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)
20+
* `raster2uri()` supports nativeRaster objects. This enables nativeRaster support for
21+
the `annotation_raster()` geom (#2174, @zeehio).
722

823
## Bug fixes
924

1025
* `ggplotly()` now converts `stat_ecdf()` properly. (#2065)
1126
* `ggplotly()` now correctly handles `geom_tile()` with no `fill` aesthetic. (#2063)
1227
* `ggplotly()` now respects `guide(aes = "none")` (e.g., `guide(fill = "none")`) when constructing legend entries. (#2067)
1328
* Fixed an issue with translating `GGally::ggcorr()` via `ggplotly()`. (#2012)
29+
* Fixed an issue where clearing a crosstalk filter would raise an error in the JS console (#2087)
30+
* Fixed an issue where `map_color()` would throw an error on R 4.2 (#2131)
1431

1532
## Improvements
1633

1734
* `ggplotly()` does not issue warnings with `options(warnPartialMatchArgs = TRUE)` any longer. (#2046, thanks @bersbersbers)
35+
* `ggplotly()` does not issue warnings related to use of deprecated `tidyr::gather_()` in internals. (#2125, thanks @simonpcouch)
1836

1937
# 4.10.0
2038

R/add.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#' @param p a plotly visualization
44
#' @param data a data frame.
55
#' @export
6-
#' @examples
6+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
77
#'
88
#' plot_ly() %>% add_data(economics) %>% add_trace(x = ~date, y = ~pce)
99
add_data <- function(p, data = NULL) {
@@ -41,7 +41,7 @@ add_data <- function(p, data = NULL) {
4141
#' @author Carson Sievert
4242
#' @export
4343
#' @rdname add_trace
44-
#' @examples
44+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
4545
#'
4646
#' # the `plot_ly()` function initiates an object, and if no trace type
4747
#' # is specified, it sets a sensible default
@@ -704,7 +704,7 @@ special_attrs <- function(trace) {
704704
# #'
705705
# #'
706706
# #' @export
707-
# #' @examples
707+
# #' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
708708
# #'
709709
# #' x <- rnorm(10)
710710
# #' plot_ly(x = ~x) %>%

R/animate.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#' @rdname animation
2929
#' @aliases animation
3030
#' @author Carson Sievert
31-
#' @examples
31+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
3232
#'
3333
#' df <- data.frame(
3434
#' x = c(1, 2, 2, 1, 1, 2),

R/api_exports.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#' @author Carson Sievert
4747
#' @references \url{https://api.plot.ly/v2}
4848
#' @seealso [signup()]
49-
#' @examples
49+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
5050
#'
5151
#' \dontrun{
5252
#'

R/dev.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#' or a number specifying the number of spaces to indent. See [jsonlite::prettify].
1010
#' @param ... other options passed onto [listviewer::jsonedit]
1111
#' @export
12-
#' @examples
12+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
1313
#'
1414
#' plotly_json(plot_ly())
1515
#' plotly_json(plot_ly(), FALSE)
@@ -32,7 +32,7 @@ plotly_json <- function(p = last_plot(), jsonedit = interactive(), pretty = TRUE
3232
#' @param jsonedit use `listviewer::jsonedit` to view the JSON?
3333
#' @param ... other options passed onto `listviewer::jsonedit`
3434
#' @export
35-
#' @examples
35+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
3636
#' s <- schema()
3737
#'
3838
#' # retrieve acceptable `layout.mapbox.style` values

R/ggplotly.R

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,14 @@ gg2list <- function(p, width = NULL, height = NULL,
304304
d[["y_plotlyDomain"]] <- d[["y"]]
305305
d
306306
})
307+
# And since we're essentially adding an "unknown" (to ggplot2)
308+
# aesthetic, add it to the dropped_aes field to avoid fals positive
309+
# warnings (https://github.com/tidyverse/ggplot2/pull/4866)
310+
layers <- lapply(layers, function(l) {
311+
l$stat$dropped_aes <- c(l$stat$dropped_aes, "x_plotlyDomain")
312+
l$stat$dropped_aes <- c(l$stat$dropped_aes, "y_plotlyDomain")
313+
l
314+
})
307315

308316
# Transform all scales
309317
data <- lapply(data, ggfun("scales_transform_df"), scales = scales)
@@ -676,9 +684,10 @@ gg2list <- function(p, width = NULL, height = NULL,
676684
d$y <- scales::rescale(d$y, rng$y_range, from = c(0, 1))
677685
params <- list(
678686
colour = panelGrid$colour,
679-
size = panelGrid$size,
680687
linetype = panelGrid$linetype
681688
)
689+
nm <- linewidth_or_size(panelGrid)
690+
params[[nm]] <- panelGrid[[nm]]
682691
grill <- geom2trace.GeomPath(d, params)
683692
grill$hoverinfo <- "none"
684693
grill$showlegend <- FALSE
@@ -723,8 +732,12 @@ gg2list <- function(p, width = NULL, height = NULL,
723732
isDiscrete <- identical(sc$scale_name, "position_d")
724733
isDiscreteType <- isDynamic && isDiscrete
725734

726-
ticktext <- rng[[xy]]$get_labels %()% rng[[paste0(xy, ".labels")]]
727-
tickvals <- rng[[xy]]$break_positions %()% rng[[paste0(xy, ".major")]]
735+
# In 3.2.x .major disappeared in favor of break_positions()
736+
# (tidyverse/ggplot2#3436), but with 3.4.x break_positions() no longer
737+
# yields the actual final positions on a 0-1 scale, but .major does
738+
# (tidyverse/ggplot2#5029)
739+
ticktext <- rng[[paste0(xy, ".labels")]] %||% rng[[xy]]$get_labels()
740+
tickvals <- rng[[paste0(xy, ".major")]] %||% rng[[xy]]$break_positions()
728741

729742
# https://github.com/tidyverse/ggplot2/pull/3566#issuecomment-565085809
730743
hasTickText <- !(is.na(ticktext) | is.na(tickvals))
@@ -735,7 +748,7 @@ gg2list <- function(p, width = NULL, height = NULL,
735748
# TODO: log type?
736749
type = if (isDateType) "date" else if (isDiscreteType) "category" else "linear",
737750
autorange = isDynamic,
738-
range = rng[[paste0(xy, ".range")]] %||% rng[[paste0(xy, "_range")]],
751+
range = rng[[xy]]$dimension %()% rng[[paste0(xy, ".range")]] %||% rng[[paste0(xy, "_range")]],
739752
tickmode = if (isDynamic) "auto" else "array",
740753
ticktext = ticktext,
741754
tickvals = tickvals,
@@ -958,7 +971,10 @@ gg2list <- function(p, width = NULL, height = NULL,
958971
gglayout$legend <- list(
959972
bgcolor = toRGB(theme$legend.background$fill),
960973
bordercolor = toRGB(theme$legend.background$colour),
961-
borderwidth = unitConvert(theme$legend.background$size, "pixels", "width"),
974+
borderwidth = unitConvert(
975+
theme$legend.background[[linewidth_or_size(theme$legend.background)]],
976+
"pixels", "width"
977+
),
962978
font = text2font(theme$legend.text)
963979
)
964980

@@ -1191,7 +1207,7 @@ verifyUnit <- function(u) {
11911207

11921208
## the default unit in ggplot2 is millimeters (unless it's element_text())
11931209
if (inherits(u, "element")) {
1194-
grid::unit(u$size %||% 0, "points")
1210+
grid::unit(u[[linewidth_or_size(u)]] %||% 0, "points")
11951211
} else {
11961212
grid::unit(u %||% 0, "mm")
11971213
}
@@ -1411,7 +1427,8 @@ gdef2trace <- function(gdef, theme, gglayout) {
14111427
bgcolor = toRGB(theme$legend.background$fill),
14121428
bordercolor = toRGB(theme$legend.background$colour),
14131429
borderwidth = unitConvert(
1414-
theme$legend.background$size, "pixels", "width"
1430+
theme$legend.background[[linewidth_or_size(theme$legend.background)]],
1431+
"pixels", "width"
14151432
),
14161433
thickness = unitConvert(
14171434
theme$legend.key.width, "pixels", "width"

R/group2NA.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#' then `groupNames`, then `ordered`. As long as `groupNames`
2424
#' contains valid variable names, new rows will also be inserted to separate
2525
#' the groups.
26-
#' @examples
26+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
2727
#'
2828
#' # note the insertion of new rows with missing values
2929
#' group2NA(mtcars, "vs", "cyl")

0 commit comments

Comments
 (0)