Skip to content

Commit 6183de6

Browse files
authored
v4.10.1 release candidate (#2202)
* Start v4.10.1 release candidate; groom news * Don't run examples on a non-interactive windows environment (This is mainly to avoid spurious CRAN NOTE on win-builder) * Account for the fact that linewidth_or_size() could take non element/Geom input (like NULL)
1 parent 10e0100 commit 6183de6

Some content is hidden

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

54 files changed

+104
-62
lines changed

DESCRIPTION

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: plotly
22
Title: Create Interactive Web Graphics via 'plotly.js'
3-
Version: 4.10.0.9001
3+
Version: 4.10.1
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",
@@ -82,5 +82,3 @@ LazyData: true
8282
RoxygenNote: 7.2.1
8383
Encoding: UTF-8
8484
Roxygen: list(markdown = TRUE)
85-
Remotes:
86-
tidyverse/ggplot2

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ S3method(layout,matrix)
2727
S3method(layout,plotly)
2828
S3method(layout,shiny.tag.list)
2929
S3method(linewidth_or_size,Geom)
30+
S3method(linewidth_or_size,default)
3031
S3method(linewidth_or_size,element)
3132
S3method(plotly_build,"NULL")
3233
S3method(plotly_build,gg)

NEWS.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
# 4.10.0.9000
1+
# 4.10.1
22

33
## Changes to plotly.js
44

55
* 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.
66

77
## New features
88

9+
* `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)
10+
* 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)
911
* `ggplotly()` now supports the `{ggalluvial}` package. (#2061, thanks @moutikabdessabour)
1012
* `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)
1113
* `raster2uri()` supports nativeRaster objects. This enables nativeRaster support for
1214
the `annotation_raster()` geom (#2174, @zeehio).
13-
* `plotlyOutput()`'s gains a `fill` argument which , allowing it have more flexible default sizing behavior, which will be useful in combination with `{bslib}`'s new `card()`. (#2192)
14-
15-
* `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)
16-
* 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)
1715

1816
## Bug fixes
1917

R/add.R

+3-3
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

+1-1
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

+1-1
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

+2-2
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/group2NA.R

+1-1
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")

R/helpers.R

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' multiple colorbars.
99
#' @author Carson Sievert
1010
#' @export
11-
#' @examples
11+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
1212
#'
1313
#' p <- plot_ly(mtcars, x = ~wt, y = ~mpg, color = ~cyl)
1414
#'
@@ -112,7 +112,7 @@ hide_guides <- function(p) {
112112
#' @param p a plotly object.
113113
#' @export
114114
#' @seealso [hide_legend()]
115-
#' @examples
115+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
116116
#'
117117
#' p <- plot_ly(mtcars, x = ~wt, y = ~cyl, color = ~cyl)
118118
#' hide_colorbar(p)
@@ -136,7 +136,7 @@ hide_colorbar <- function(p) {
136136
#' @param p a plotly object.
137137
#' @export
138138
#' @seealso [hide_colorbar()]
139-
#' @examples
139+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
140140
#'
141141
#' p <- plot_ly(mtcars, x = ~wt, y = ~cyl, color = ~factor(cyl))
142142
#' hide_legend(p)
@@ -153,7 +153,7 @@ hide_legend <- function(p) {
153153
#'
154154
#' @param p a plotly or ggplot object.
155155
#' @export
156-
#' @examples
156+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
157157
#'
158158
#' # currently no bargl trace type
159159
#' toWebGL(ggplot() + geom_bar(aes(1:10)))
@@ -197,7 +197,7 @@ plotly_empty <- function(...) {
197197
#' @author Carson Sievert
198198
#' @export
199199
#' @references <https://plotly-r.com/embedding-images.html>
200-
#' @examples
200+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
201201
#'
202202
#' # a red gradient (from ?as.raster)
203203
#' r <- as.raster(matrix(hcl(0, 80, seq(50, 80, 10)), nrow = 4, ncol = 5))

R/highlight.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
#' @author Carson Sievert
5353
#' @references \url{https://plotly-r.com/client-side-linking.html}
5454
#' @seealso [attrs_selected()]
55-
#' @examples
55+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
5656
#'
5757
#' # These examples are designed to show you how to highlight/brush a *single*
5858
#' # view. For examples of multiple linked views, see `demo(package = "plotly")`

R/kaleido.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#' * `scope`: a reference to the underlying `kaleido.scopes.plotly.PlotlyScope`
3838
#' python object. Modify this object to customize the underlying Chromium
3939
#' subprocess and/or configure other details such as URL to plotly.js, MathJax, etc.
40-
#' @examples
40+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
4141
#'
4242
#' \dontrun{
4343
#' # Save a single image

R/layers2traces.R

+5
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,11 @@ linewidth_or_size.element <- function(x) {
11361136
if ("linewidth" %in% names(x)) "linewidth" else "size"
11371137
}
11381138

1139+
#' @export
1140+
linewidth_or_size.default <- function(x) {
1141+
if (get_package_version("ggplot2") >= "3.4") "linewidth" else "size"
1142+
}
1143+
11391144

11401145
# Convert R pch point codes to plotly "symbol" codes.
11411146
pch2symbol <- function(x) {

R/layout.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ layout.plotly <- function(p, ..., data = NULL) {
5252
#' \url{https://plotly.com/r/reference/#layout-xaxis-rangeslider}
5353
#' @export
5454
#' @author Carson Sievert
55-
#' @examples
55+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
5656
#'
5757
#' plot_ly(x = time(USAccDeaths), y = USAccDeaths) %>%
5858
#' add_lines() %>%
@@ -103,7 +103,7 @@ rangeslider <- function(p, start = NULL, end = NULL, ...) {
103103
#' [here](https://github.com/plotly/plotly.R/blob/master/inst/examples/rmd/MathJax/index.Rmd) for a **shiny** example).
104104
#' @author Carson Sievert
105105
#' @export
106-
#' @examples
106+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
107107
#'
108108
#' # remove the plotly logo and collaborate button from modebar
109109
#' config(plot_ly(), displaylogo = FALSE, collaborate = FALSE)

R/mathjax.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' @param x a character vector
99
#' @export
1010
#' @seealso [config]
11-
#' @examples
11+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
1212
#'
1313
#' plot_ly(x = c(1, 2, 3, 4), y = c(1, 4, 9, 16)) %>%
1414
#' layout(title = TeX("\\text{Some mathjax: }\\alpha+\\beta x")) %>%

R/orca.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#' @author Carson Sievert
2828
#' @md
2929
#' @rdname orca
30-
#' @examples
30+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
3131
#'
3232
#' \dontrun{
3333
#' # NOTE: in a headless environment, you may need to set `more_args="--enable-webgl"`

R/partial_bundles.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#' @param minified whether or not to use a minified js file (non-minified file can be useful for debugging plotly.js)
2020
#' @author Carson Sievert
2121
#' @export
22-
#' @examples
22+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
2323
#'
2424
#' # ----------------------------------------------------------------------
2525
#' # This function is always safe to use when rendering a single

R/plotly.R

+5-5
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
#' \item For quick, accurate, and searchable plotly.js reference: [schema()]
9090
#' }
9191
#' @export
92-
#' @examples
92+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
9393
#' \dontrun{
9494
#'
9595
#' # plot_ly() tries to create a sensible plot based on the information you
@@ -263,7 +263,7 @@ plot_mapbox <- function(data = data.frame(), ...) {
263263
#' @export
264264
#' @author Carson Sievert
265265
#' @seealso [plot_ly()], [plot_mapbox()], [ggplotly()]
266-
#' @examples
266+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
267267
#'
268268
#' map_data("world", "canada") %>%
269269
#' group_by(group) %>%
@@ -308,7 +308,7 @@ plot_geo <- function(data = data.frame(), ..., offline = FALSE) {
308308
#' @export
309309
#' @author Carson Sievert
310310
#' @seealso [plot_ly()], [plot_mapbox()], [ggplotly()]
311-
#' @examples
311+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
312312
#'
313313
#' \dontrun{
314314
#' hc <- hclust(dist(USArrests), "ave")
@@ -400,7 +400,7 @@ get_xy <- function(node) {
400400
#' @param x a plotly object.
401401
#' @param ... other options passed onto `htmlwidgets::createWidget`
402402
#' @export
403-
#' @examples
403+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
404404
#'
405405
#' trace <- list(x = 1, y = 1)
406406
#' obj <- list(data = list(trace), layout = list(title = "my plot"))
@@ -553,7 +553,7 @@ locale_dependency <- function(locale) {
553553
#'
554554
#' @param p a plotly object
555555
#' @export
556-
#' @examples
556+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
557557
#'
558558
#' \dontrun{
559559
#' p1 <- plot_ly()

R/plotly_build.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' @param p a ggplot object, or a plotly object, or a list.
99
#' @param registerFrames should a frame trace attribute be interpreted as frames in an animation?
1010
#' @export
11-
#' @examples
11+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
1212
#'
1313
#' p <- plot_ly(economics, x = ~date, y = ~pce)
1414
#' # the unevaluated plotly object

R/plotly_data.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#'
1414
#' @name plotly_data
1515
#' @export
16-
#' @examples
16+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
1717
#'
1818
#' # use group_by() to define groups of visual markings
1919
#' p <- txhousing %>%

R/proxy.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#' until after the next time all of the outputs are updated.
1111
#' @rdname plotlyProxy
1212
#' @export
13-
#' @examples
13+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
1414
#'
1515
#'
1616
#' if (require("shiny") && interactive()) {

R/style.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#' @seealso [api_download_plot()]
1212
#' @author Carson Sievert
1313
#' @export
14-
#' @examples
14+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
1515
#'
1616
#' # style() is especially useful in conjunction with ggplotly()
1717
#' # It allows you to leverage the underlying plotly.js library to change

R/subplots.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#' @return A plotly object
2929
#' @export
3030
#' @author Carson Sievert
31-
#' @examples
31+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
3232
#'
3333
#' # pass any number of plotly objects to subplot()
3434
#' p1 <- plot_ly(economics, x = ~date, y = ~uempmed)

R/toRGB.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' @return hexadecimal colour value (if is.na(x), return "transparent" for compatibility with Plotly)
55
#' @export
66
#' @seealso [showRGB()]
7-
#' @examples
7+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
88
#'
99
#' toRGB("steelblue")
1010
#' # [1] "rgba(70,130,180,1)"
@@ -66,7 +66,7 @@ toRGB <- function(x, alpha = 1) {
6666
#' @param ... arguments passed along to `scales::show_col`.
6767
#' @export
6868
#' @author Carson Sievert
69-
#' @examples
69+
#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows")
7070
#'
7171
#' showRGB(toRGB(colors()), labels = FALSE)
7272
showRGB <- function(x, ...) {

man/TeX.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/add_data.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/add_trace.Rd

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)