diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..bc83715229 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at accounts@plot.ly. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.4, available at [http://contributor-covenant.org/version/1/4](http://contributor-covenant.org/version/1/4/), and may also be found online at . diff --git a/DESCRIPTION b/DESCRIPTION index 9ee106d72f..4a4e15a253 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: plotly Title: Create Interactive Web Graphics via 'plotly.js' -Version: 4.10.0.9002 +Version: 4.11.0 Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"), email = "cpsievert1@gmail.com", comment = c(ORCID = "0000-0002-4958-2844")), person("Chris", "Parmer", role = "aut", @@ -42,7 +42,7 @@ Imports: vctrs, tibble, lazyeval (>= 0.2.0), - rlang (>= 0.4.10), + rlang (>= 1.0.0), crosstalk, purrr, data.table, @@ -56,9 +56,8 @@ Suggests: ggalluvial, testthat, knitr, - devtools, shiny (>= 1.1.0), - shinytest (>= 1.3.0), + shinytest2, curl, rmarkdown, Cairo, @@ -66,18 +65,26 @@ Suggests: webshot, listviewer, dendextend, - maptools, - rgeos, sf, png, IRdisplay, processx, plotlyGeoAssets, forcats, + withr, palmerpenguins, rversions, - reticulate + reticulate, + rsvg, + ggridges LazyData: true -RoxygenNote: 7.1.2 +RoxygenNote: 7.3.2 Encoding: UTF-8 Roxygen: list(markdown = TRUE) +Config/Needs/check: + tidyverse/ggplot2, + ggobi/GGally, + rcmdcheck, + devtools, + reshape2, + s2 diff --git a/LICENSE.md b/LICENSE.md index feb4e544e3..fa66b17d20 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ -The MIT License (MIT) +MIT License -Copyright (c) 2017 Plotly Technologies Inc +Copyright (c) 2017-2024 Plotly Technologies Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/NAMESPACE b/NAMESPACE index 25291e11f7..1512977bb3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -13,6 +13,7 @@ S3method(geom2trace,GeomErrorbarh) S3method(geom2trace,GeomPath) S3method(geom2trace,GeomPoint) S3method(geom2trace,GeomPolygon) +S3method(geom2trace,GeomRidgelineGradient) S3method(geom2trace,GeomText) S3method(geom2trace,GeomTile) S3method(geom2trace,default) @@ -26,6 +27,9 @@ S3method(highlight_key,plotly) S3method(layout,matrix) S3method(layout,plotly) S3method(layout,shiny.tag.list) +S3method(linewidth_or_size,Geom) +S3method(linewidth_or_size,default) +S3method(linewidth_or_size,element) S3method(plotly_build,"NULL") S3method(plotly_build,gg) S3method(plotly_build,list) @@ -36,6 +40,9 @@ S3method(print,api_grid_local) S3method(print,api_plot) S3method(print,kaleidoScope) S3method(print,plotly_data) +S3method(process,api_image) +S3method(process,api_plot) +S3method(process,default) S3method(to_basic,GeomAbline) S3method(to_basic,GeomAlluvium) S3method(to_basic,GeomAnnotationMap) @@ -46,6 +53,10 @@ S3method(to_basic,GeomContour) S3method(to_basic,GeomCrossbar) S3method(to_basic,GeomDensity) S3method(to_basic,GeomDensity2d) +S3method(to_basic,GeomDensityLine) +S3method(to_basic,GeomDensityRidges) +S3method(to_basic,GeomDensityRidges2) +S3method(to_basic,GeomDensityRidgesGradient) S3method(to_basic,GeomDotplot) S3method(to_basic,GeomErrorbar) S3method(to_basic,GeomErrorbarh) @@ -62,6 +73,8 @@ S3method(to_basic,GeomRaster) S3method(to_basic,GeomRasterAnn) S3method(to_basic,GeomRect) S3method(to_basic,GeomRibbon) +S3method(to_basic,GeomRidgeline) +S3method(to_basic,GeomRidgelineGradient) S3method(to_basic,GeomRug) S3method(to_basic,GeomSegment) S3method(to_basic,GeomSf) diff --git a/NEWS.md b/NEWS.md index 8401d34223..0b0f1ef121 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,59 @@ -# 4.10.0.9000 +# plotly 4.11.0 + +## New features + +* `ggplotly()` now supports the `{ggridges}` package. (#2314) + +## Improvements + +* Various updates to `ggplotly()` to better support recent versions of ggplot2. (#2315, #2368, #2442, thanks @teunbrand). + +## Bug fixes + +* Closed #2337: Creating a new `event_data()` handler no longer causes a spurious reactive update of existing `event_data()`s. (#2339) +* Closed #2376: Removes errant boxmode warning for grouped boxplot. (#2396) +* Closed #2392: Trivial warning about RColorBrewer minimal n value is no longer thrown (#1999) + +# 4.10.4 + +## Improvements + +* `ggplotly()` now works better with the development version of ggplot2 (> v3.4.4). (#2315) + +# 4.10.3 + +## Improvements + +* `ggplotly()` now works better with the development version of ggplot2 (> v3.4.3). (#2301) + +## Bug fixes + +* Closed #1947: `ggplotly()` now correctly handles `geom_vline`/`geom_hline` with empty data. Previously, if `geom_vline`/`geom_hline` was passed an empty data frame, it would result in an error. The plot is drawn even if no lines are found; this is the same behavior as `ggplot2`. + +* Closed #1214: Do not warn in RStudio on Windows when scattergl is used. Recent RStudio versions can render scattergl correctly. + +* Closed #2298: Fix fill assignment in geom_point when a single shape value was used with multiple fill and colour values mapped (@zeehio) + +# 4.10.2 + +## New features + +* Closed #2216: Additional selectize.js options can now be passed along to `highlight()`'s `selectize` argument. (#2217) + +## Improvements + +* Closed #2259: `ggplotly()` now provides better support for ggplot2 >v3.4.2. (#2262) + +## Bug fixes + +* Closed #2212: `ggplotly()` no longer silently drops legends that are customized through `ggplot2::guide_legend()`. +* Closed #2179: `save_image()` no longer needs `reticulate::py_run_string("import sys")` in order to run without error. (#2179) +* Closed #2218: `highlight(selectize = TRUE)` no longer yields an incorrect selectize.js result when there is a combination of crosstalk and non-crosstalk traces. (#2217) +* Closed #2208: `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) +* Closed #2220: `ggplotly()` no longer errors on `stat_summary(geom = "crossbar")`. (#2222) +* Closed #2212: `ggplotly()` no longer removes legends when setting guide properties via `guides(aes = guide_xxx(...))`. + +# 4.10.1 ## Changes to plotly.js @@ -6,8 +61,12 @@ ## New features +* `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) + * 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) * `ggplotly()` now supports the `{ggalluvial}` package. (#2061, thanks @moutikabdessabour) * `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) +* `raster2uri()` supports nativeRaster objects. This enables nativeRaster support for + the `annotation_raster()` geom (#2174, @zeehio). ## Bug fixes @@ -143,7 +202,7 @@ This is minor patch release with a few minor bug fixes and updates test expectat ## NEW FEATURES & IMPROVEMENTS -* Several new features and improvements related to accessing plotly.js events in shiny (learn more about them in this RStudio [webinar](https://www.rstudio.com/resources/webinars/accessing-and-responding-to-plotly-events-in-shiny/)): +* Several new features and improvements related to accessing plotly.js events in shiny (learn more about them in this RStudio [webinar](https://posit.co/resources/videos/accessing-and-responding-to-plotly-events-in-shiny/)): * The `event` argument of the `event_data()` function now supports the following events: `plotly_selecting`, `plotly_brushed`, `plotly_brushing`, `plotly_restyle`, `plotly_legendclick`, `plotly_legenddoubleclick`, `plotly_clickannotation`, `plotly_afterplot`, `plotly_doubleclick`, `plotly_deselect`, `plotly_unhover`. For examples, see `plotly_example("shiny", "event_data")`, `plotly_example("shiny", "event_data_legends")`, and `plotly_example("shiny", "event_data_annotation")`, * New `event_register()` and `event_unregister()` functions for declaring which events to transmit over the wire (i.e., from the browser to the shiny server). Events that are likely to have large overhead are not registered by default, so you'll need to register these: `plotly_selecting`, `plotly_unhover`, `plotly_restyle`, `plotly_legendclick`, and `plotly_legenddoubleclick`. * A new `priority` argument. By setting `priority='event'`, the `event` is treated like a true event: any reactive expression using the `event` becomes invalidated (regardless of whether the input values has changed). For an example, see `plotly_example("shiny", "event_priority")`. diff --git a/R/add.R b/R/add.R index b07164c2b9..7f8542ca9f 100644 --- a/R/add.R +++ b/R/add.R @@ -3,7 +3,7 @@ #' @param p a plotly visualization #' @param data a data frame. #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' plot_ly() %>% add_data(economics) %>% add_trace(x = ~date, y = ~pce) add_data <- function(p, data = NULL) { @@ -41,7 +41,7 @@ add_data <- function(p, data = NULL) { #' @author Carson Sievert #' @export #' @rdname add_trace -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' # the `plot_ly()` function initiates an object, and if no trace type #' # is specified, it sets a sensible default @@ -704,7 +704,7 @@ special_attrs <- function(trace) { # #' # #' # #' @export -# #' @examples +# #' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") # #' # #' x <- rnorm(10) # #' plot_ly(x = ~x) %>% diff --git a/R/animate.R b/R/animate.R index 58b7763ba6..16a6878c5a 100644 --- a/R/animate.R +++ b/R/animate.R @@ -28,7 +28,7 @@ #' @rdname animation #' @aliases animation #' @author Carson Sievert -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' df <- data.frame( #' x = c(1, 2, 2, 1, 1, 2), @@ -122,7 +122,6 @@ animation_opts_defaults <- function() { } -#' @inheritParams animation_opts #' @param hide remove the animation slider? #' @param ... for `animation_slider`, attributes are passed to a special #' layout.sliders object tied to the animation frames. @@ -149,7 +148,6 @@ animation_slider <- function(p, hide = FALSE, ...) { } -#' @inheritParams animation_slider #' @param label a character string used for the animation button's label #' @export #' @rdname animation diff --git a/R/api_exports.R b/R/api_exports.R index 02ae27638e..19445ffe40 100644 --- a/R/api_exports.R +++ b/R/api_exports.R @@ -46,7 +46,7 @@ #' @author Carson Sievert #' @references \url{https://api.plot.ly/v2} #' @seealso [signup()] -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' \dontrun{ #' @@ -108,9 +108,6 @@ #' #' } #' - - -#' @rdname api #' @export api_create <- function(x = last_plot(), filename = NULL, fileopt = c("overwrite", "new"), diff --git a/R/dev.R b/R/dev.R index 95e4950357..9c1d28f0a8 100644 --- a/R/dev.R +++ b/R/dev.R @@ -9,7 +9,7 @@ #' or a number specifying the number of spaces to indent. See [jsonlite::prettify]. #' @param ... other options passed onto [listviewer::jsonedit] #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' plotly_json(plot_ly()) #' plotly_json(plot_ly(), FALSE) @@ -32,7 +32,7 @@ plotly_json <- function(p = last_plot(), jsonedit = interactive(), pretty = TRUE #' @param jsonedit use `listviewer::jsonedit` to view the JSON? #' @param ... other options passed onto `listviewer::jsonedit` #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' s <- schema() #' #' # retrieve acceptable `layout.mapbox.style` values diff --git a/R/export.R b/R/export.R index 91f18d0bbf..866a1b60ba 100644 --- a/R/export.R +++ b/R/export.R @@ -1,6 +1,6 @@ #' Export a plotly graph to a static file #' -#' This function is in the process of being deprecated (use [orca] instead). +#' This function is deprecated, use [save_image] instead. #' #' @details For SVG plots, a screenshot is taken via `webshot::webshot()`. #' Since `phantomjs` (and hence `webshot`) does not support WebGL, @@ -19,7 +19,7 @@ #' @author Carson Sievert #' export <- function(p = last_plot(), file = "plotly.png", selenium = NULL, ...) { - .Deprecated("orca") + .Deprecated("save_image") # infer the file type fileType <- tolower(tools::file_ext(file)) diff --git a/R/ggplotly.R b/R/ggplotly.R index 6c0aad48eb..973a31ebc1 100644 --- a/R/ggplotly.R +++ b/R/ggplotly.R @@ -277,6 +277,11 @@ gg2list <- function(p, width = NULL, height = NULL, # Compute aesthetics to produce data with generalised variable names data <- by_layer(function(l, d) l$compute_aesthetics(d, plot)) + if (exists("setup_plot_labels", envir = asNamespace("ggplot2"))) { + # Mirror ggplot2/#5879 + plot$labels <- ggfun("setup_plot_labels")(plot, layers, data) + } + # add frame to group if it exists data <- lapply(data, function(d) { @@ -304,9 +309,17 @@ gg2list <- function(p, width = NULL, height = NULL, d[["y_plotlyDomain"]] <- d[["y"]] d }) + # And since we're essentially adding an "unknown" (to ggplot2) + # aesthetic, add it to the dropped_aes field to avoid fals positive + # warnings (https://github.com/tidyverse/ggplot2/pull/4866) + layers <- lapply(layers, function(l) { + l$stat$dropped_aes <- c(l$stat$dropped_aes, "x_plotlyDomain") + l$stat$dropped_aes <- c(l$stat$dropped_aes, "y_plotlyDomain") + l + }) # Transform all scales - data <- lapply(data, ggfun("scales_transform_df"), scales = scales) + data <- lapply(data, scales_transform_df, scales = scales) # Map and train positions so that statistics have access to ranges # and all positions are numeric @@ -360,7 +373,7 @@ gg2list <- function(p, width = NULL, height = NULL, data <- by_layer(function(l, d) l$map_statistic(d, plot)) # Make sure missing (but required) aesthetics are added - ggfun("scales_add_missing")(plot, c("x", "y"), plot$plot_env) + scales_add_missing(plot, c("x", "y")) # Reparameterise geoms from (e.g.) y and width to ymin and ymax data <- by_layer(function(l, d) l$compute_geom_1(d)) @@ -393,7 +406,7 @@ gg2list <- function(p, width = NULL, height = NULL, # Train and map non-position scales npscales <- scales$non_position_scales() if (npscales$n() > 0) { - lapply(data, ggfun("scales_train_df"), scales = npscales) + lapply(data, scales_train_df, scales = npscales) # this for loop is unique to plotly -- it saves the "domain" # of each non-positional scale for display in tooltips for (sc in npscales$scales) { @@ -405,7 +418,7 @@ gg2list <- function(p, width = NULL, height = NULL, d }) } - data <- lapply(data, ggfun("scales_map_df"), scales = npscales) + data <- lapply(data, scales_map_df, scales = npscales) } # Fill in defaults etc. @@ -455,12 +468,8 @@ gg2list <- function(p, width = NULL, height = NULL, assign(var, built_env[[var]], envir = envir) } - # initiate plotly.js layout with some plot-wide theming stuff - theme <- ggfun("plot_theme")(plot) - elements <- names(which(sapply(theme, inherits, "element"))) - for (i in elements) { - theme[[i]] <- ggplot2::calc_element(i, theme) - } + theme <- calculated_theme_elements(plot) + # Translate plot wide theme elements to plotly.js layout pm <- unitConvert(theme$plot.margin, "pixels") gglayout <- list( @@ -659,7 +668,9 @@ gg2list <- function(p, width = NULL, height = NULL, "\\*\\s+degree[ ]?[\\*]?", "°", gsub("\"", "", tickData[["degree_label"]]) ) - rng[[paste0(xy, ".major")]] <- tickData[[paste0(xy, "_start")]] + # Downstream logic expects these 'break positions' to be on 0-1 scale + # (which is then rescaled back to the data scale) + rng[[paste0(xy, ".major")]] <- scales::rescale(tickData[[paste0(xy, "_start")]]) # If it doesn't already exist (for this panel), # generate graticule (as done in, CoordSf$render_bg) @@ -676,9 +687,10 @@ gg2list <- function(p, width = NULL, height = NULL, d$y <- scales::rescale(d$y, rng$y_range, from = c(0, 1)) params <- list( colour = panelGrid$colour, - size = panelGrid$size, linetype = panelGrid$linetype ) + nm <- linewidth_or_size(panelGrid) + params[[nm]] <- panelGrid[[nm]] grill <- geom2trace.GeomPath(d, params) grill$hoverinfo <- "none" grill$showlegend <- FALSE @@ -716,26 +728,30 @@ gg2list <- function(p, width = NULL, height = NULL, call. = FALSE ) } - # determine axis types (note: scale_name may go away someday) - # https://github.com/hadley/ggplot2/issues/1312 - isDate <- isTRUE(sc$scale_name %in% c("date", "datetime")) + + # determine axis types + isDate <- inherits(sc, c("ScaleContinuousDatetime", "ScaleContinuousDate")) isDateType <- isDynamic && isDate - isDiscrete <- identical(sc$scale_name, "position_d") + isDiscrete <- inherits(sc, "ScaleDiscretePosition") isDiscreteType <- isDynamic && isDiscrete - ticktext <- rng[[xy]]$get_labels %()% rng[[paste0(xy, ".labels")]] - tickvals <- rng[[xy]]$break_positions %()% rng[[paste0(xy, ".major")]] + # In 3.2.x .major disappeared in favor of break_positions() + # (tidyverse/ggplot2#3436), but with 3.4.x break_positions() no longer + # yields the actual final positions on a 0-1 scale, but .major does + # (tidyverse/ggplot2#5029) + ticktext <- rng[[paste0(xy, ".labels")]] %||% rng[[xy]]$get_labels() + tickvals <- rng[[paste0(xy, ".major")]] %||% rng[[xy]]$break_positions() # https://github.com/tidyverse/ggplot2/pull/3566#issuecomment-565085809 hasTickText <- !(is.na(ticktext) | is.na(tickvals)) - ticktext <- ticktext[hasTickText] - tickvals <- tickvals[hasTickText] + ticktext <- as.character(unlist(ticktext[hasTickText])) + tickvals <- as.numeric(unlist(tickvals[hasTickText])) axisObj <- list( # TODO: log type? type = if (isDateType) "date" else if (isDiscreteType) "category" else "linear", autorange = isDynamic, - range = rng[[paste0(xy, ".range")]] %||% rng[[paste0(xy, "_range")]], + range = rng[[xy]]$dimension %()% rng[[paste0(xy, ".range")]] %||% rng[[paste0(xy, "_range")]], tickmode = if (isDynamic) "auto" else "array", ticktext = ticktext, tickvals = tickvals, @@ -769,8 +785,11 @@ gg2list <- function(p, width = NULL, height = NULL, # set scaleanchor/scaleratio if these are fixed coordinates # the logic here is similar to what p$coordinates$aspect() does, # but the ratio is scaled to the data range by plotly.js - fixed_coords <- c("CoordSf", "CoordFixed", "CoordMap", "CoordQuickmap") - if (inherits(p$coordinates, fixed_coords)) { + is_fixed <- inherits( + p$coordinates, + c("CoordSf", "CoordFixed", "CoordMap", "CoordQuickmap") + ) + if (is_fixed || isFALSE(p$coordinates$is_free())) { axisObj$scaleanchor <- anchor ratio <- p$coordinates$ratio %||% 1 axisObj$scaleratio <- if (xy == "y") ratio else 1 / ratio @@ -958,7 +977,10 @@ gg2list <- function(p, width = NULL, height = NULL, gglayout$legend <- list( bgcolor = toRGB(theme$legend.background$fill), bordercolor = toRGB(theme$legend.background$colour), - borderwidth = unitConvert(theme$legend.background$size, "pixels", "width"), + borderwidth = unitConvert( + theme$legend.background[[linewidth_or_size(theme$legend.background)]], + "pixels", "width" + ), font = text2font(theme$legend.text) ) @@ -988,12 +1010,12 @@ gg2list <- function(p, width = NULL, height = NULL, # justification of legend boxes theme$legend.box.just <- theme$legend.box.just %||% c("center", "center") # scales -> data for guides - gdefs <- ggfun("guides_train")(scales, theme, plot$guides, plot$labels) - if (length(gdefs) > 0) { - gdefs <- ggfun("guides_merge")(gdefs) - gdefs <- ggfun("guides_geom")(gdefs, layers, plot$mapping) + gdefs <- if (inherits(plot$guides, "ggproto")) { + get_gdefs_ggproto(npscales$scales, theme, plot, layers, layer_data) + } else { + get_gdefs(scales, theme, plot, layers) } - + # colourbar -> plotly.js colorbar colorbar <- compact(lapply(gdefs, gdef2trace, theme, gglayout)) nguides <- length(colorbar) + gglayout$showlegend @@ -1138,6 +1160,24 @@ gg2list <- function(p, width = NULL, height = NULL, # Due to the non-standard use of assign() in g2list() (above) utils::globalVariables(c("groupDomains", "layers", "prestats_data", "scales", "sets")) +# Get the "complete" set of theme elements and their calculated values +calculated_theme_elements <- function(plot) { + complete_theme <- ggfun("complete_theme") + if (is.function(complete_theme)) { + theme <- complete_theme(plot$theme) + elements <- names(theme) + } else { + theme <- ggfun("plot_theme")(plot) + elements <- names(which(sapply(theme, inherits, "element"))) + } + + for (i in elements) { + theme[[i]] <- ggplot2::calc_element(i, theme) + } + + theme +} + #----------------------------------------------------------------------------- # ggplotly 'utility' functions @@ -1191,7 +1231,7 @@ verifyUnit <- function(u) { ## the default unit in ggplot2 is millimeters (unless it's element_text()) if (inherits(u, "element")) { - grid::unit(u$size %||% 0, "points") + grid::unit(u[[linewidth_or_size(u)]] %||% 0, "points") } else { grid::unit(u %||% 0, "mm") } @@ -1368,7 +1408,8 @@ rect2shape <- function(rekt = ggplot2::element_rect()) { linetype = lty2dash(rekt$linetype) ), yref = "paper", - xref = "paper" + xref = "paper", + layer = "below" ) } @@ -1387,12 +1428,24 @@ gdef2trace <- function(gdef, theme, gglayout) { if (inherits(gdef, "colorbar")) { # sometimes the key has missing values, which we can ignore gdef$key <- gdef$key[!is.na(gdef$key$.value), ] - rng <- range(gdef$bar$value) - gdef$bar$value <- scales::rescale(gdef$bar$value, from = rng) - gdef$key$.value <- scales::rescale(gdef$key$.value, from = rng) + + # Put values on a 0-1 scale + # N.B. ggplot2 >v3.4.2 (specifically #4879) renamed bar to decor and also + # started returning normalized values for the key field + decor <- gdef$decor %||% gdef$bar + decor$value <- decor$value %||% decor$max + rng <- range(decor$value) + decor$value <- scales::rescale(decor$value, from = rng) + if (!"decor" %in% names(gdef)) { + gdef$key$.value <- scales::rescale(gdef$key$.value, from = rng) + } + vals <- lapply(gglayout[c("xaxis", "yaxis")], function(ax) { - if (identical(ax$tickmode, "auto")) ax$ticktext else ax$tickvals + res <- if (identical(ax$tickmode, "auto")) ax$ticktext else ax$tickvals + # if zero-length, return NULL to avoid subscript oob errors + res %||% NULL }) + list( x = vals[[1]][[1]], y = vals[[2]][[1]], @@ -1406,12 +1459,13 @@ gdef2trace <- function(gdef, theme, gglayout) { # do everything on a 0-1 scale marker = list( color = c(0, 1), - colorscale = setNames(gdef$bar[c("value", "colour")], NULL), + colorscale = setNames(decor[c("value", "colour")], NULL), colorbar = list( bgcolor = toRGB(theme$legend.background$fill), bordercolor = toRGB(theme$legend.background$colour), borderwidth = unitConvert( - theme$legend.background$size, "pixels", "width" + theme$legend.background[[linewidth_or_size(theme$legend.background)]], + "pixels", "width" ), thickness = unitConvert( theme$legend.key.width, "pixels", "width" @@ -1442,3 +1496,79 @@ getAesMap <- function(plot, layer) { layer$mapping } } + +# ------------------------------------------------------------------ +# Handle compatibility for changes in ggplot2 >v3.4.2 (specifically #5144), +# which moved away from scales_transform_df(), scales_train_df(), etc +# towards ggproto methods attached to `scales` +# ------------------------------------------------------------------ +scales_transform_df <- function(scales, df) { + if (is.function(scales$transform_df)) { + scales$transform_df(df) + } else { + ggfun("scales_transform_df")(df, scales = scales) + } +} + +scales_train_df <- function(scales, df) { + if (is.function(scales$train_df)) { + scales$train_df(df) + } else { + ggfun("scales_train_df")(df, scales = scales) + } +} + +scales_map_df <- function(scales, df) { + if (is.function(scales$map_df)) { + scales$map_df(df) + } else { + ggfun("scales_map_df")(df, scales = scales) + } +} + +scales_add_missing <- function(plot, aesthetics) { + if (is.function(plot$scales$add_missing)) { + plot$scales$add_missing(c("x", "y"), plot$plot_env) + } else { + ggfun("scales_add_missing")(plot, aesthetics, plot$plot_env) + } +} + +# ------------------------------------------------------------------------- +# Handle compatibility for changes in ggplot2 >v3.4.2 (specifically #4879), +# which away from guides_train(), guides_merge(), guides_geom() +# towards ggproto methods attached to `plot$guides` +# ------------------------------------------------------------------------- +get_gdefs_ggproto <- function(scales, theme, plot, layers, layer_data) { + + # Unfortunate duplication of logic in tidyverse/ggplot2#5428 + # which ensures a 1:1 mapping between aesthetics and scales + aesthetics <- lapply(scales, `[[`, "aesthetics") + scales <- rep.int(scales, lengths(aesthetics)) + aesthetics <- unlist(aesthetics, recursive = FALSE, use.names = FALSE) + + guides <- plot$guides$setup(scales, aesthetics = aesthetics) + guides$train(scales, plot$labels) + if (length(guides$guides) > 0) { + guides$merge() + guides$process_layers(layers, layer_data) + } + # Add old legend/colorbar classes to guide params so that ggplotly() code + # can continue to work the same way it always has + for (i in which(vapply(guides$guides, inherits, logical(1), "GuideColourbar"))) { + guides$params[[i]] <- prefix_class(guides$params[[i]], "colorbar") + } + for (i in which(vapply(guides$guides, inherits, logical(1), "GuideLegend"))) { + guides$params[[i]] <- prefix_class(guides$params[[i]], "legend") + } + guides$params +} + +get_gdefs <- function(scales, theme, plot, layers) { + gdefs <- ggfun("guides_train")(scales, theme, plot$guides, plot$labels) + if (length(gdefs) > 0) { + gdefs <- ggfun("guides_merge")(gdefs) + gdefs <- ggfun("guides_geom")(gdefs, layers, plot$mapping) + } + gdefs +} diff --git a/R/ggridges.R b/R/ggridges.R new file mode 100644 index 0000000000..afe34b6978 --- /dev/null +++ b/R/ggridges.R @@ -0,0 +1,272 @@ +# Get data for ridge plots +# +# @param data dataframe, the data returned by `ggplot2::ggplot_build()`. +# @param na.rm boolean, from params +# +# @return dataframe containing plotting data +# +get_ridge_data <- function(data, na.rm) { + if (isTRUE(na.rm)) { + data <- data[stats::complete.cases(data[c("x", "ymin", "ymax")]), ] + } + + #if dataframe is empty there's nothing to draw + if (nrow(data) == 0) return(list()) + + # remove all points that fall below the minimum height + data$ymax[data$height < data$min_height] <- NA + + # order data + data <- data[order(data$ymin, data$x), ] + + # remove missing points + missing_pos <- !stats::complete.cases(data[c("x", "ymin", "ymax")]) + ids <- cumsum(missing_pos) + 1 + data$group <- paste0(data$group, "-", ids) + data[!missing_pos, ] +} + + +# Prepare plotting data for ggridges +# @param closed boolean, should the polygon be closed at bottom (TRUE for +# geom_density_ridges2, FALSE for geom_density_ridges) +prepare_ridge_chart <- function(data, prestats_data, layout, params, p, closed = FALSE, ...) { + d <- get_ridge_data(data, params$na.rm) + + # split data into separate groups + groups <- split(d, factor(d$group)) + + # sort list so lowest ymin values are in the front (opposite of ggridges) + o <- order( + unlist( + lapply( + groups, + function(data) data$ymin[1] + ) + ), + decreasing = FALSE + ) + groups <- groups[o] + + # for each group create a density + vline + point as applicable + res <- lapply( + rev(groups), + function(x) { + draw_stuff <- split(x, x$datatype) + + # first draw the basic density ridge part + stopifnot(!is.null(draw_stuff$ridgeline)) + + d2 <- d1 <- draw_stuff$ridgeline + if (!closed) d2$colour <- NA # no colour for density bottom line + + d1$y <- d1$ymax + d1$alpha <- 1 # don't use fill alpha for line alpha + + ridges <- list( + to_basic(prefix_class(d2, "GeomDensity")), + to_basic(prefix_class(d1, "GeomLine")) + ) + # attach the crosstalk group/set + ridges[[1]] <- structure(ridges[[1]], set = attr(d2, 'set')) # Density + ridges[[2]] <- structure(ridges[[2]], set = attr(d1, 'set')) # Line + + if ('vline' %in% names(draw_stuff)) { + draw_stuff$vline$xend <- draw_stuff$vline$x + draw_stuff$vline$yend <- draw_stuff$vline$ymax + draw_stuff$vline$y <- draw_stuff$vline$ymin + draw_stuff$vline$colour <- draw_stuff$vline$vline_colour + draw_stuff$vline$size <- draw_stuff$vline$vline_size + + vlines <- to_basic( + prefix_class(draw_stuff$vline, 'GeomSegment'), + prestats_data, layout, params, p, ... + ) + # attach the crosstalk group/set + vlines <- structure(vlines, set = attr(draw_stuff$vline, 'set')) + ridges <- c(ridges, list(vlines)) + } + + # points + if ('point' %in% names(draw_stuff)) { + draw_stuff$point$y <- draw_stuff$point$ymin + + # use point aesthetics + draw_stuff$point$shape <- draw_stuff$point$point_shape + draw_stuff$point$fill <- draw_stuff$point$point_fill + draw_stuff$point$stroke <- draw_stuff$point$point_stroke + draw_stuff$point$alpha <- draw_stuff$point$point_alpha + draw_stuff$point$colour <- draw_stuff$point$point_colour + draw_stuff$point$size <- draw_stuff$point$point_size + + points <- to_basic( + prefix_class(as.data.frame(draw_stuff$point), # remove ridge classes + 'GeomPoint'), + prestats_data, layout, params, p, ... + ) + # attach the crosstalk group/set + points <- structure(points, set = attr(draw_stuff$point, 'set')) + ridges <- c(ridges, list(points)) + } + + ridges + } + ) + res +} + + +#' @export +to_basic.GeomDensityRidgesGradient <- function(data, prestats_data, layout, params, p, ...) { + res <- prepare_ridge_chart(data, prestats_data, layout, params, p, FALSE, ...) + # set list depth to 1 + unlist(res, recursive = FALSE) +} + + +#' @export +to_basic.GeomDensityRidges <- function(data, prestats_data, layout, params, p, ...) { + to_basic( + prefix_class(data, 'GeomDensityRidgesGradient'), + prestats_data, layout, params, p, + closed = FALSE, + ... + ) +} + + +#' @export +to_basic.GeomDensityRidges2 <- function(data, prestats_data, layout, params, p, ...) { + to_basic( + prefix_class(data, 'GeomDensityRidgesGradient'), + prestats_data, layout, params, p, + closed = TRUE, + ... + ) +} + + + +#' @export +to_basic.GeomDensityLine <- function(data, prestats_data, layout, params, p, ...) { + to_basic(prefix_class(data, 'GeomDensity')) +} + + + +#' @export +to_basic.GeomRidgeline <- function(data, prestats_data, layout, params, p, ...) { + to_basic( + prefix_class(data, 'GeomDensityRidgesGradient'), + prestats_data, layout, params, p, ... + ) +} + + +#' @export +to_basic.GeomRidgelineGradient <- function(data, prestats_data, layout, params, p, ...) { + d <- get_ridge_data(data, params$na.rm) + + # split data into separate groups + groups <- split(d, factor(d$group)) + + # sort list so lowest ymin values are in the front (opposite of ggridges) + o <- order( + unlist( + lapply( + groups, + function(data) data$ymin[1] + ) + ), + decreasing = FALSE + ) + groups <- groups[o] + + # for each group create a density + vline + point as applicable + res <- lapply( + rev(groups), + function(x) { + + draw_stuff <- split(x, x$datatype) + + # first draw the basic density ridge part + + stopifnot(!is.null(draw_stuff$ridgeline)) + d2 <- d1 <- draw_stuff$ridgeline + d2$colour <- NA # no colour for density area + d2$fill_plotlyDomain <- NA + + d1$y <- d1$ymax + d1$alpha <- 1 # don't use fill alpha for line alpha + + # calculate all the positions where the fill type changes + fillchange <- c(FALSE, d2$fill[2:nrow(d2)] != d2$fill[1:nrow(d2)-1]) + + # and where the id changes + idchange <- c(TRUE, d2$group[2:nrow(d2)] != d2$group[1:nrow(d2)-1]) + + # make new ids from all changes in fill style or original id + d2$ids <- cumsum(fillchange | idchange) + + # get fill color for all ids + fill <- d2$fill[fillchange | idchange] + + # rows to be duplicated + dupl_rows <- which(fillchange & !idchange) + d2$y <- d2$ymax + if (length(dupl_rows) > 0) { + rows <- d2[dupl_rows, ] + rows$ids <- d2$ids[dupl_rows-1] + rows <- rows[rev(seq_len(nrow(rows))), , drop = FALSE] + # combine original and duplicated d2 + d2 <- rbind(d2, rows) + } + + # split by group to make polygons + d2 <- tibble::deframe(tidyr::nest(d2, .by = 'ids')) + + ridges <- c( + d2, + list( + to_basic(prefix_class(d1, "GeomLine")) + ) + ) + + ridges + } + ) + # set list depth to 1 + unlist(res, recursive = FALSE) +} + + + +#' @export +geom2trace.GeomRidgelineGradient <- function(data, params, p) { + # munching for polygon + positions <- data.frame( + x = c(data$x , rev(data$x)), + y = c(data$ymax, rev(data$ymin)) + ) + + L <- list( + x = positions[["x"]], + y = positions[["y"]], + text = uniq(data[["hovertext"]]), + key = data[["key"]], + customdata = data[["customdata"]], + frame = data[["frame"]], + ids = positions[["ids"]], + type = "scatter", + mode = "lines", + line = list( + width = aes2plotly(data, params, linewidth_or_size(GeomPolygon)), + color = toRGB('black'), + dash = aes2plotly(data, params, "linetype") + ), + fill = "toself", + fillcolor = toRGB(unique(data$fill[1])), + hoveron = hover_on(data) + ) + compact(L) +} diff --git a/R/group2NA.R b/R/group2NA.R index 3b67190dd3..78af437ed6 100644 --- a/R/group2NA.R +++ b/R/group2NA.R @@ -23,7 +23,7 @@ #' then `groupNames`, then `ordered`. As long as `groupNames` #' contains valid variable names, new rows will also be inserted to separate #' the groups. -#' @examples +#' @examplesIf interactive() #' #' # note the insertion of new rows with missing values #' group2NA(mtcars, "vs", "cyl") diff --git a/R/helpers.R b/R/helpers.R index 87e1421a20..8018ce0db9 100644 --- a/R/helpers.R +++ b/R/helpers.R @@ -8,7 +8,7 @@ #' multiple colorbars. #' @author Carson Sievert #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' p <- plot_ly(mtcars, x = ~wt, y = ~mpg, color = ~cyl) #' @@ -112,7 +112,7 @@ hide_guides <- function(p) { #' @param p a plotly object. #' @export #' @seealso [hide_legend()] -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' p <- plot_ly(mtcars, x = ~wt, y = ~cyl, color = ~cyl) #' hide_colorbar(p) @@ -136,7 +136,7 @@ hide_colorbar <- function(p) { #' @param p a plotly object. #' @export #' @seealso [hide_colorbar()] -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' p <- plot_ly(mtcars, x = ~wt, y = ~cyl, color = ~factor(cyl)) #' hide_legend(p) @@ -153,7 +153,7 @@ hide_legend <- function(p) { #' #' @param p a plotly or ggplot object. #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' # currently no bargl trace type #' toWebGL(ggplot() + geom_bar(aes(1:10))) @@ -197,7 +197,7 @@ plotly_empty <- function(...) { #' @author Carson Sievert #' @export #' @references -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' # a red gradient (from ?as.raster) #' r <- as.raster(matrix(hcl(0, 80, seq(50, 80, 10)), nrow = 4, ncol = 5)) @@ -219,14 +219,19 @@ plotly_empty <- function(...) { raster2uri <- function(r, ...) { try_library("png", "raster2uri") # should be 4 x n matrix - r <- grDevices::as.raster(r, ...) - rgbs <- col2rgb(c(r), alpha = T) / 255 - nr <- dim(r)[1] - nc <- dim(r)[2] - reds <- matrix(rgbs[1, ], nrow = nr, ncol = nc, byrow = TRUE) - greens <- matrix(rgbs[2, ], nrow = nr, ncol = nc, byrow = TRUE) - blues <- matrix(rgbs[3, ], nrow = nr, ncol = nc, byrow = TRUE) - alphas <- matrix(rgbs[4, ], nrow = nr, ncol = nc, byrow = TRUE) - png <- array(c(reds, greens, blues, alphas), dim = c(dim(r), 4)) + if (inherits(r, "nativeRaster")) { + # png::writePNG directly supports nativeRaster objects + png <- r + } else { + r <- grDevices::as.raster(r, ...) + rgbs <- col2rgb(c(r), alpha = T) / 255 + nr <- dim(r)[1] + nc <- dim(r)[2] + reds <- matrix(rgbs[1, ], nrow = nr, ncol = nc, byrow = TRUE) + greens <- matrix(rgbs[2, ], nrow = nr, ncol = nc, byrow = TRUE) + blues <- matrix(rgbs[3, ], nrow = nr, ncol = nc, byrow = TRUE) + alphas <- matrix(rgbs[4, ], nrow = nr, ncol = nc, byrow = TRUE) + png <- array(c(reds, greens, blues, alphas), dim = c(dim(r), 4)) + } base64enc::dataURI(png::writePNG(png), mime = "image/png") } diff --git a/R/highlight.R b/R/highlight.R index 46008089cc..17434f92e5 100644 --- a/R/highlight.R +++ b/R/highlight.R @@ -36,8 +36,10 @@ #' highlighting selections. See [toRGB()] for valid color #' specifications. If `NULL` (the default), the color of selected marks #' are not altered. -#' @param selectize provide a selectize.js widget for selecting keys? Note that -#' the label used for this widget derives from the groupName of the SharedData object. +#' @param selectize whether or not to render a selectize.js widget for selecting +#' [highlight_key()] values. A list of additional selectize.js options may +#' also be provided. The label used for this widget should be set via the +#' `groupName` argument of [highlight_key()]. #' @param defaultValues a vector of values for setting a "default selection". #' These values should match the key attribute. #' @param opacityDim a number between 0 and 1 used to reduce the @@ -52,7 +54,7 @@ #' @author Carson Sievert #' @references \url{https://plotly-r.com/client-side-linking.html} #' @seealso [attrs_selected()] -#' @examples +#' @examplesIf interactive() #' #' # These examples are designed to show you how to highlight/brush a *single* #' # view. For examples of multiple linked views, see `demo(package = "plotly")` @@ -115,7 +117,7 @@ highlight <- function(p, on = "plotly_click", off, # attach HTML dependencies (these libraries are used in the HTMLwidgets.renderValue() method) # TODO: only attach these when keys are present! - if (selectize) { + if (!identical(selectize, FALSE)) { p$dependencies <- c(p$dependencies, list(selectizeLib())) } if (dynamic) { diff --git a/R/kaleido.R b/R/kaleido.R index d03daa62c9..2ed9cdb678 100644 --- a/R/kaleido.R +++ b/R/kaleido.R @@ -8,14 +8,15 @@ #' @section Installation: #' #' `kaleido()` requires [the kaleido python -#' package](https://github.com/plotly/Kaleido/) to be usable via the \pkg{reticulate} package. Here is a recommended way to do the installation: +#' package](https://github.com/plotly/Kaleido/) to be usable via the +#' \pkg{reticulate} package. If you're starting from scratch, you install +#' eveything you need with the following R code: #' #' ``` -#' install.packages('reticulate') -#' reticulate::install_miniconda() -#' reticulate::conda_install('r-reticulate', 'python-kaleido') -#' reticulate::conda_install('r-reticulate', 'plotly', channel = 'plotly') -#' reticulate::use_miniconda('r-reticulate') +#' install.packages("reticulate") +#' library(reticulate) +#' use_python(install_python()) +#' py_install(c("kaleido", "plotly")) #' ``` #' #' @param ... not currently used. @@ -37,7 +38,7 @@ #' * `scope`: a reference to the underlying `kaleido.scopes.plotly.PlotlyScope` #' python object. Modify this object to customize the underlying Chromium #' subprocess and/or configure other details such as URL to plotly.js, MathJax, etc. -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' \dontrun{ #' # Save a single image @@ -65,16 +66,40 @@ save_image <- function(p, file, ..., width = NULL, height = NULL, scale = NULL) #' @rdname save_image #' @export kaleido <- function(...) { - if (!rlang::is_installed("reticulate")) { - stop("`kaleido()` requires the reticulate package.") - } - if (!reticulate::py_available(initialize = TRUE)) { - stop("`kaleido()` requires `reticulate::py_available()` to be `TRUE`. Do you need to install python?") + rlang::check_installed("reticulate") + + call_env <- rlang::caller_env() + + if (!reticulate::py_available()) { + rlang::abort(c("`{reticulate}` wasn't able to find a Python environment.", + i = "If you have an existing Python installation, use `reticulate::use_python()` to inform `{reticulate}` of it.", + i = "To have `{reticulate}` install Python for you, `reticulate::install_python()`." + ), call = call_env) } + tryCatch( + reticulate::import("plotly"), + error = function(e) { + rlang::abort(c( + "The `plotly` Python package is required for static image exporting.", + i = "Please install it via `reticulate::py_install('plotly')`." + ), call = call_env) + } + ) + + kaleido <- tryCatch( + reticulate::import("kaleido"), + error = function(e) { + rlang::abort(c( + "The `kaleido` Python package is required for static image exporting.", + i = "Please install it via `reticulate::py_install('kaleido')`." + ), call = call_env) + } + ) + py <- reticulate::py scope_name <- paste0("scope_", new_id()) - py[[scope_name]] <- reticulate::import("kaleido")$scopes$plotly$PlotlyScope( + py[[scope_name]] <- kaleido$scopes$plotly$PlotlyScope( plotlyjs = plotlyMainBundlePath() ) @@ -107,7 +132,7 @@ kaleido <- function(...) { # Write the base64 encoded string that transform() returns to disk # https://github.com/plotly/Kaleido/blame/master/README.md#L52 reticulate::py_run_string( - sprintf("open('%s', 'wb').write(%s)", file, transform_cmd) + sprintf("import sys; open('%s', 'wb').write(%s)", file, transform_cmd) ) invisible(file) diff --git a/R/layers2traces.R b/R/layers2traces.R index 8ac5a4742c..1b889dc3f8 100644 --- a/R/layers2traces.R +++ b/R/layers2traces.R @@ -79,7 +79,8 @@ layers2traces <- function(data, prestats_data, layout, p) { discreteScales <- list() for (sc in p$scales$non_position_scales()$scales) { if (sc$is_discrete()) { - discreteScales[[sc$aesthetics]] <- sc + nm <- paste(sc$aesthetics, collapse = "_") + discreteScales[[nm]] <- sc } } # Convert "high-level" geoms to their "low-level" counterpart @@ -102,7 +103,12 @@ layers2traces <- function(data, prestats_data, layout, p) { } # now to the actual layer -> trace conversion trace.list <- list() - aes_no_guide <- names(vapply(p$guides, identical, logical(1), "none")) + + # ggplot2 >v3.4.2 (specifically #4879) moved the guides system to ggproto, + # which moved the location of the name->value fields + guides <- if (inherits(p$guides, "ggproto")) p$guides$guides else p$guides + aes_no_guide <- names(guides)[vapply(guides, identical, logical(1), "none")] + for (i in seq_along(datz)) { d <- datz[[i]] # variables that produce multiple traces and deserve their own legend entries @@ -191,6 +197,7 @@ to_basic.GeomCol <- function(data, prestats_data, layout, params, p, ...) { #' @export to_basic.GeomViolin <- function(data, prestats_data, layout, params, p, ...) { n <- nrow(data) + data <- data[order(data[["y"]], decreasing = FALSE), ] revData <- data[order(data[["y"]], decreasing = TRUE), ] idx <- !names(data) %in% c("x", "xmin", "xmax") data <- rbind( @@ -387,9 +394,11 @@ to_basic.GeomHex <- function(data, prestats_data, layout, params, p, ...) { dy <- resolution(data[["y"]], FALSE)/sqrt(3)/2 * 1.15 hexC <- hexbin::hexcoords(dx, dy, n = 1) n <- nrow(data) - data$size <- ifelse(data$size < 1, data$size ^ (1 / 6), data$size ^ 6) - x <- rep.int(hexC[["x"]], n) * rep(data$size, each = 6) + rep(data[["x"]], each = 6) - y <- rep.int(hexC[["y"]], n) * rep(data$size, each = 6) + rep(data[["y"]], each = 6) + nm <- linewidth_or_size(GeomHex) + size <- data[[nm]] + data[[nm]] <- ifelse(size < 1, size ^ (1 / 6), size ^ 6) + x <- rep.int(hexC[["x"]], n) * rep(data[[nm]], each = 6) + rep(data[["x"]], each = 6) + y <- rep.int(hexC[["y"]], n) * rep(data[[nm]], each = 6) + rep(data[["y"]], each = 6) data <- data[rep(seq_len(n), each = 6), ] data[["x"]] <- x data[["y"]] <- y @@ -441,7 +450,9 @@ to_basic.GeomHline <- function(data, prestats_data, layout, params, p, ...) { data = layout$layout, cols = paste0(x, c("_min", "_max")), values_to = x, names_to = "variable" ) lay <- as.data.frame(lay) - data <- merge(lay[c("PANEL", x)], data, by = "PANEL") + if (nrow(data) > 0) { + data <- merge(lay[c("PANEL", x)], data, by = "PANEL") + } data[["x"]] <- data[[x]] data[["y"]] <- data$yintercept prefix_class(data, c("GeomHline", "GeomPath")) @@ -458,7 +469,9 @@ to_basic.GeomVline <- function(data, prestats_data, layout, params, p, ...) { data = layout$layout, cols = paste0(y, c("_min", "_max")), values_to = y, names_to = "variable" ) lay <- as.data.frame(lay) - data <- merge(lay[c("PANEL", y)], data, by = "PANEL") + if (nrow(data) > 0) { + data <- merge(lay[c("PANEL", y)], data, by = "PANEL") + } data[["y"]] <- data[[y]] data[["x"]] <- data$xintercept prefix_class(data, c("GeomVline", "GeomPath")) @@ -504,10 +517,10 @@ to_basic.GeomLinerange <- function(data, prestats_data, layout, params, p, ...) # reshape data so that x/y reflect path data data$group <- seq_len(nrow(data)) - lay <- tidyr::pivot_longer( - data = layout$layout, cols = c("ymin", "ymax"), values_to = "y", names_to = "recodeVariable" - ) - lay <- as.data.frame(lay) + data <- tidyr::pivot_longer( + data = data, cols = c("ymin", "ymax"), values_to = "y", names_to = "recodeVariable" + ) + data <- as.data.frame(data) data <- data[order(data$group), ] # fix the hovertext (by removing the "irrelevant" aesthetic) recodeMap <- p$mapping[dplyr::recode(data[["recodeVariable"]], "ymax" = "ymin", "ymin" = "ymax")] @@ -558,13 +571,15 @@ to_basic.GeomSpoke <- function(data, prestats_data, layout, params, p, ...) { #' @export to_basic.GeomCrossbar <- function(data, prestats_data, layout, params, p, ...) { # from GeomCrossbar$draw_panel() - middle <- base::transform(data, x = xmin, xend = xmax, yend = y, size = size * params$fatten, alpha = NA) + middle <- base::transform(data, x = xmin, xend = xmax, yend = y, alpha = NA) + nm <- linewidth_or_size(GeomCrossbar) + data[[nm]] <- data[[nm]] * (params$fatten %||% formals(geom_crossbar)$fatten) list( prefix_class(to_basic.GeomRect(data), "GeomCrossbar"), prefix_class(to_basic.GeomSegment(middle), "GeomCrossbar") ) } -utils::globalVariables(c("xmin", "xmax", "y", "size", "COL", "PANEL", "ROW", "yaxis")) +utils::globalVariables(c("xmin", "xmax", "y", "size", "linewidth", "COL", "PANEL", "ROW", "yaxis")) #' @export to_basic.GeomRug <- function(data, prestats_data, layout, params, p, ...) { @@ -710,7 +725,7 @@ geom2trace.GeomPath <- function(data, params, p) { name = if (inherits(data, "GeomSmooth")) "fitted values", line = list( # TODO: line width array? -- https://github.com/plotly/plotly.js/issues/147 - width = aes2plotly(data, params, "size")[1], + width = aes2plotly(data, params, linewidth_or_size(GeomPath))[1], color = toRGB( aes2plotly(data, params, "colour"), aes2plotly(data, params, "alpha") @@ -752,9 +767,14 @@ geom2trace.GeomPoint <- function(data, params, p) { hoveron = hover_on(data) ) # fill is only relevant for pch %in% 21:25 - pch <- uniq(data$shape) %||% params$shape %||% GeomPoint$default_aes$shape + pch <- uniq(data$shape) %||% params$shape %||% GeomPoint$use_defaults(NULL)$shape if (any(idx <- pch %in% 21:25) || any(idx <- !is.null(data[["fill_plotlyDomain"]]))) { - L$marker$color[idx] <- aes2plotly(data, params, "fill")[idx] + fill_value <- aes2plotly(data, params, "fill") + if (length(idx) == 1) { + L$marker$color <- fill_value + } else { + L$marker$color[idx] <- fill_value[idx] + } } compact(L) } @@ -803,7 +823,7 @@ geom2trace.GeomBar <- function(data, params, p) { aes2plotly(data, params, "alpha") ), line = list( - width = aes2plotly(data, params, "size"), + width = aes2plotly(data, params, linewidth_or_size(GeomBar)), color = aes2plotly(data, params, "colour") ) ) @@ -812,7 +832,7 @@ geom2trace.GeomBar <- function(data, params, p) { #' @export geom2trace.GeomPolygon <- function(data, params, p) { - + data <- group2NA(data) L <- list( @@ -826,7 +846,7 @@ geom2trace.GeomPolygon <- function(data, params, p) { type = "scatter", mode = "lines", line = list( - width = aes2plotly(data, params, "size"), + width = aes2plotly(data, params, linewidth_or_size(GeomPolygon)), color = toRGB( aes2plotly(data, params, "colour"), aes2plotly(data, params, "alpha") @@ -847,6 +867,9 @@ geom2trace.GeomPolygon <- function(data, params, p) { #' @export geom2trace.GeomBoxplot <- function(data, params, p) { + # marker styling must inherit from GeomPoint$default_aes + # https://github.com/hadley/ggplot2/blob/ab42c2ca81458b0cf78e3ba47ed5db21f4d0fc30/NEWS#L73-L7 + point_defaults <- GeomPoint$use_defaults(NULL) compact(list( x = data[["x"]], y = data[["y"]], @@ -860,20 +883,19 @@ geom2trace.GeomBoxplot <- function(data, params, p) { aes2plotly(data, params, "fill"), aes2plotly(data, params, "alpha") ), - # marker styling must inherit from GeomPoint$default_aes - # https://github.com/hadley/ggplot2/blob/ab42c2ca81458b0cf78e3ba47ed5db21f4d0fc30/NEWS#L73-L77 + # markers/points marker = list( - opacity = GeomPoint$default_aes$alpha, - outliercolor = toRGB(GeomPoint$default_aes$colour), + opacity = point_defaults$alpha, + outliercolor = toRGB(point_defaults$colour), line = list( - width = mm2pixels(GeomPoint$default_aes$stroke), - color = toRGB(GeomPoint$default_aes$colour) + width = mm2pixels(point_defaults$stroke), + color = toRGB(point_defaults$colour) ), - size = mm2pixels(GeomPoint$default_aes$size) + size = mm2pixels(point_defaults$size) ), line = list( color = aes2plotly(data, params, "colour"), - width = aes2plotly(data, params, "size") + width = aes2plotly(data, params, linewidth_or_size(GeomBoxplot)) ) )) } @@ -976,11 +998,11 @@ geom2trace.default <- function(data, params, p) { # since plotly.js can't draw two polygons with different fill in a single trace split_on <- function(dat) { lookup <- list( - GeomHline = c("linetype", "colour", "size"), - GeomVline = c("linetype", "colour", "size"), - GeomAbline = c("linetype", "colour", "size"), - GeomPath = c("fill", "colour", "size"), - GeomPolygon = c("fill", "colour", "size"), + GeomHline = c("linetype", "colour", "size", "linewidth"), + GeomVline = c("linetype", "colour", "size", "linewidth"), + GeomAbline = c("linetype", "colour", "size", "linewidth"), + GeomPath = c("fill", "colour", "size", "linewidth"), + GeomPolygon = c("fill", "colour", "size", "linewidth"), GeomBar = "fill", GeomBoxplot = c("colour", "fill", "size"), GeomErrorbar = "colour", @@ -1057,6 +1079,7 @@ make_error <- function(data, params, xy = "x") { # (note this function is also used for geom_smooth) ribbon_dat <- function(dat) { n <- nrow(dat) + if (n == 0) return(dat) o <- order(dat[["x"]]) o2 <- order(dat[["x"]], decreasing = TRUE) used <- c("x", "ymin", "ymax", "y") @@ -1076,24 +1099,30 @@ ribbon_dat <- function(dat) { aes2plotly <- function(data, params, aes = "size") { geom <- class(data)[1] - # Hack to support this geom_sf hack - # https://github.com/tidyverse/ggplot2/blob/505e4bfb/R/sf.R#L179-L187 - defaults <- if (inherits(data, "GeomSf")) { - type <- if (any(grepl("point", class(data)))) "point" else if (any(grepl("line", class(data)))) "line" else "" - ggfun("default_aesthetics")(type) - } else { - geom_obj <- ggfun(geom) - # If the first class of `data` is a data.frame, - # ggfun() returns a function because ggplot2 now - # defines data.frame in it's namespace - # https://github.com/ropensci/plotly/pull/1481 - if ("default_aes" %in% names(geom_obj)) geom_obj$default_aes else NULL + vals <- uniq(data[[aes]]) %||% params[[aes]] + + if (is.null(vals)) { + # Hack to support this geom_sf hack + # https://github.com/tidyverse/ggplot2/blob/505e4bfb/R/sf.R#L179-L187 + defaults <- if (inherits(data, "GeomSf") && exists("default_aesthetics", envir = asNamespace("ggplot2"))) { + type <- if (any(grepl("[P-p]oint", class(data)))) "point" else if (any(grepl("[L-l]ine", class(data)))) "line" else "" + ggfun("default_aesthetics")(type) + } else { + geom_obj <- ggfun(geom) + # If the first class of `data` is a data.frame, + # ggfun() returns a function because ggplot2 now + # defines data.frame in it's namespace + # https://github.com/ropensci/plotly/pull/1481 + if ("default_aes" %in% names(geom_obj)) geom_obj$use_defaults(NULL) else NULL + } + vals <- defaults[[aes]] } + vals <- vals %||% NA - vals <- uniq(data[[aes]]) %||% params[[aes]] %||% defaults[[aes]] %||% NA converter <- switch( aes, - size = mm2pixels, + size = mm2pixels, + linewidth = mm2pixels, stroke = mm2pixels, colour = toRGB, fill = toRGB, @@ -1112,6 +1141,31 @@ aes2plotly <- function(data, params, aes = "size") { converter(vals) } + +# ggplot2 3.4.0 deprecated size in favor of linewidth in line-based geoms (e.g., +# GeomLine, GeomRect, etc) and elements (e.g., element_line(), element_rect(), +# etc). Note that, some geoms (e.g., GeomBoxplot, GeomSf) can have both +# linewidth and size +linewidth_or_size <- function(x) { + UseMethod("linewidth_or_size") +} + +#' @export +linewidth_or_size.Geom <- function(x) { + if ("linewidth" %in% x$aesthetics()) "linewidth" else "size" +} + +#' @export +linewidth_or_size.element <- function(x) { + if ("linewidth" %in% names(x)) "linewidth" else "size" +} + +#' @export +linewidth_or_size.default <- function(x) { + if (get_package_version("ggplot2") >= "3.4") "linewidth" else "size" +} + + # Convert R pch point codes to plotly "symbol" codes. pch2symbol <- function(x) { lookup <- list( diff --git a/R/layout.R b/R/layout.R index 31cf5f014d..c1c225aadc 100644 --- a/R/layout.R +++ b/R/layout.R @@ -52,7 +52,7 @@ layout.plotly <- function(p, ..., data = NULL) { #' \url{https://plotly.com/r/reference/#layout-xaxis-rangeslider} #' @export #' @author Carson Sievert -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' plot_ly(x = time(USAccDeaths), y = USAccDeaths) %>% #' add_lines() %>% @@ -103,7 +103,7 @@ rangeslider <- function(p, start = NULL, end = NULL, ...) { #' [here](https://github.com/plotly/plotly.R/blob/master/inst/examples/rmd/MathJax/index.Rmd) for a **shiny** example). #' @author Carson Sievert #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' # remove the plotly logo and collaborate button from modebar #' config(plot_ly(), displaylogo = FALSE, collaborate = FALSE) diff --git a/R/mathjax.R b/R/mathjax.R index 3e0a5ebe9b..c9f7c4ba42 100644 --- a/R/mathjax.R +++ b/R/mathjax.R @@ -8,7 +8,7 @@ #' @param x a character vector #' @export #' @seealso [config] -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' plot_ly(x = c(1, 2, 3, 4), y = c(1, 4, 9, 16)) %>% #' layout(title = TeX("\\text{Some mathjax: }\\alpha+\\beta x")) %>% diff --git a/R/orca.R b/R/orca.R index a5566beb47..df0398d783 100644 --- a/R/orca.R +++ b/R/orca.R @@ -1,6 +1,6 @@ #' Static image exporting via orca #' -#' Superseded by [kaleido()]. +#' This function is deprecated, use [save_image()] instead. #' #' @param p a plotly object. #' @param file output filename. @@ -27,7 +27,7 @@ #' @author Carson Sievert #' @md #' @rdname orca -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' \dontrun{ #' # NOTE: in a headless environment, you may need to set `more_args="--enable-webgl"` @@ -60,7 +60,7 @@ orca <- function(p, file = "plot.png", format = tools::file_ext(file), parallel_limit = NULL, verbose = FALSE, debug = FALSE, safe = FALSE, more_args = NULL, ...) { - .Deprecated("kaleido") + .Deprecated("save_image") orca_available() @@ -97,7 +97,6 @@ orca <- function(p, file = "plot.png", format = tools::file_ext(file), #' Orca image export server #' -#' @inheritParams orca #' @param port Sets the server's port number. #' @param keep_alive Turn on keep alive mode where orca will (try to) relaunch server if process unexpectedly exits. #' @param window_max_number Sets maximum number of browser windows the server can keep open at a given time. diff --git a/R/partial_bundles.R b/R/partial_bundles.R index 699989418b..fc7a66795e 100644 --- a/R/partial_bundles.R +++ b/R/partial_bundles.R @@ -19,7 +19,7 @@ #' @param minified whether or not to use a minified js file (non-minified file can be useful for debugging plotly.js) #' @author Carson Sievert #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' # ---------------------------------------------------------------------- #' # This function is always safe to use when rendering a single diff --git a/R/plotly.R b/R/plotly.R index 27af9d74c1..19b908b5bc 100644 --- a/R/plotly.R +++ b/R/plotly.R @@ -89,7 +89,7 @@ #' \item For quick, accurate, and searchable plotly.js reference: [schema()] #' } #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' \dontrun{ #' #' # plot_ly() tries to create a sensible plot based on the information you @@ -269,7 +269,7 @@ plot_mapbox <- function(data = data.frame(), ...) { #' @export #' @author Carson Sievert #' @seealso [plot_ly()], [plot_mapbox()], [ggplotly()] -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' map_data("world", "canada") %>% #' group_by(group) %>% @@ -314,7 +314,7 @@ plot_geo <- function(data = data.frame(), ..., offline = FALSE) { #' @export #' @author Carson Sievert #' @seealso [plot_ly()], [plot_mapbox()], [ggplotly()] -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' \dontrun{ #' hc <- hclust(dist(USArrests), "ave") @@ -406,7 +406,7 @@ get_xy <- function(node) { #' @param x a plotly object. #' @param ... other options passed onto `htmlwidgets::createWidget` #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' trace <- list(x = 1, y = 1) #' obj <- list(data = list(trace), layout = list(title = "my plot")) @@ -559,7 +559,7 @@ locale_dependency <- function(locale) { #' #' @param p a plotly object #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' \dontrun{ #' p1 <- plot_ly() diff --git a/R/plotly_build.R b/R/plotly_build.R index 0f0a4e1511..d0fb241111 100644 --- a/R/plotly_build.R +++ b/R/plotly_build.R @@ -8,7 +8,7 @@ #' @param p a ggplot object, or a plotly object, or a list. #' @param registerFrames should a frame trace attribute be interpreted as frames in an animation? #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' p <- plot_ly(economics, x = ~date, y = ~pce) #' # the unevaluated plotly object @@ -395,11 +395,7 @@ plotly_build.plotly <- function(p, registerFrames = TRUE) { # if a partial bundle was specified, make sure it supports the visualization p <- verify_partial_bundle(p) - - # scattergl currently doesn't render in RStudio on Windows - # https://github.com/ropensci/plotly/issues/1214 - p <- verify_scattergl_platform(p) - + # make sure plots don't get sent out of the network (for enterprise) p$x$base_url <- get_domain() p @@ -787,7 +783,7 @@ map_color <- function(traces, stroke = FALSE, title = "", colorway, na.color = " isOrdered <- all(vapply(color[isDiscrete], is.ordered, logical(1))) lvls <- getLevels(unlist(color[isDiscrete])) N <- length(lvls) - pal <- palette %||% if (isOrdered) viridisLite::viridis(N) else RColorBrewer::brewer.pal(N, "Set2") + pal <- palette %||% if (isOrdered) viridisLite::viridis(N) else RColorBrewer::brewer.pal(max(N, 3L), "Set2") colScale <- scales::col_factor(pal, levels = names(pal) %||% lvls, na.color = na.color) color_codes <- Map(function(x, y) toRGB(colScale(as.character(x)), y), color[isDiscrete], alphas[isDiscrete]) traces[isDiscrete] <- Map(mapColor, traces[isDiscrete], color_codes) diff --git a/R/plotly_data.R b/R/plotly_data.R index 4639182376..ddd5de4263 100644 --- a/R/plotly_data.R +++ b/R/plotly_data.R @@ -13,7 +13,7 @@ #' #' @name plotly_data #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' # use group_by() to define groups of visual markings #' p <- txhousing %>% diff --git a/R/process.R b/R/process.R index bd987b0f21..bb422e6839 100644 --- a/R/process.R +++ b/R/process.R @@ -6,14 +6,17 @@ process <- function(resp) { UseMethod("process") } +#' @export process.default <- function(resp) { json_content(relay_error(resp)) } +#' @export process.api_plot <- function(resp) { json_content(relay_error(resp)) } +#' @export process.api_image <- function(resp) { relay_error(resp) type <- resp[["headers"]][["content-type"]] diff --git a/R/proxy.R b/R/proxy.R index 03ad60fe12..f1b9e142b4 100644 --- a/R/proxy.R +++ b/R/proxy.R @@ -10,7 +10,7 @@ #' until after the next time all of the outputs are updated. #' @rdname plotlyProxy #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' #' if (require("shiny") && interactive()) { diff --git a/R/shiny.R b/R/shiny.R index 6f9e66a521..a25b653aac 100644 --- a/R/shiny.R +++ b/R/shiny.R @@ -17,14 +17,15 @@ #' @param env The environment in which to evaluate `expr`. #' @param quoted Is `expr` a quoted expression (with `quote()`)? This #' is useful if you want to save an expression in a variable. -#' +#' @param fill see [htmlwidgets::shinyWidgetOutput()] for explanation (requires +#' a recent version of htmlwidgets). #' @importFrom htmlwidgets shinyWidgetOutput #' @importFrom htmlwidgets shinyRenderWidget #' @name plotly-shiny #' #' @export plotlyOutput <- function(outputId, width = "100%", height = "400px", - inline = FALSE, reportTheme = TRUE) { + inline = FALSE, reportTheme = TRUE, fill = !inline) { args <- list( outputId = outputId, name = "plotly", @@ -37,6 +38,9 @@ plotlyOutput <- function(outputId, width = "100%", height = "400px", if (is_installed("shiny", "1.4.0.9003") && is_installed("htmlwidgets", "1.5.2.9000")) { args$reportTheme <- reportTheme } + if (is_installed("htmlwidgets", "1.5.4.9001")) { + args$fill <- fill + } do.call(htmlwidgets::shinyWidgetOutput, args) } @@ -189,7 +193,7 @@ event_data <- function( } else { - eventHasStorage <- eventID %in% names(session$userData$plotlyInputStore) + eventHasStorage <- eventID %in% shiny::isolate(names(session$userData$plotlyInputStore)) if (!eventHasStorage) { # store input value as a reactive value to leverage caching diff --git a/R/style.R b/R/style.R index 131d0a2b52..1a1f1ed65e 100644 --- a/R/style.R +++ b/R/style.R @@ -11,7 +11,7 @@ #' @seealso [api_download_plot()] #' @author Carson Sievert #' @export -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' # style() is especially useful in conjunction with ggplotly() #' # It allows you to leverage the underlying plotly.js library to change diff --git a/R/subplots.R b/R/subplots.R index 7eedf3afa0..1474e4e4ca 100644 --- a/R/subplots.R +++ b/R/subplots.R @@ -28,7 +28,7 @@ #' @return A plotly object #' @export #' @author Carson Sievert -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' # pass any number of plotly objects to subplot() #' p1 <- plot_ly(economics, x = ~date, y = ~uempmed) @@ -57,7 +57,7 @@ #' do(p = plot_ly(., x = ~date, y = ~value)) %>% #' subplot(nrows = NROW(.), shareX = TRUE) #' -#' # learn more at https://plotly.com/r/subplot.html +#' # learn more at https://plotly.com/r/subplots/ #' subplot <- function(..., nrows = 1, widths = NULL, heights = NULL, margin = 0.02, diff --git a/R/toRGB.R b/R/toRGB.R index a768d75232..750dd7113f 100644 --- a/R/toRGB.R +++ b/R/toRGB.R @@ -4,7 +4,7 @@ #' @return hexadecimal colour value (if is.na(x), return "transparent" for compatibility with Plotly) #' @export #' @seealso [showRGB()] -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' toRGB("steelblue") #' # [1] "rgba(70,130,180,1)" @@ -66,7 +66,7 @@ toRGB <- function(x, alpha = 1) { #' @param ... arguments passed along to `scales::show_col`. #' @export #' @author Carson Sievert -#' @examples +#' @examplesIf interactive() || !identical(.Platform$OS.type, "windows") #' #' showRGB(toRGB(colors()), labels = FALSE) showRGB <- function(x, ...) { diff --git a/R/utils.R b/R/utils.R index 40018afc91..c59da8c6a2 100644 --- a/R/utils.R +++ b/R/utils.R @@ -366,31 +366,32 @@ supply_highlight_attrs <- function(p) { # set "global" options via crosstalk variable p$x$highlight <- p$x$highlight %||% highlight_defaults() - # defaults are now populated, allowing us to populate some other - # attributes such as the selectize widget definition - sets <- unlist(lapply(p$x$data, "[[", "set")) - keys <- setNames(lapply(p$x$data, "[[", "key"), sets) - p$x$highlight$ctGroups <- i(unique(sets)) + # Grab the special "crosstalk set" (i.e., group) for each trace + sets <- lapply(p$x$data, "[[", "set") + noSet <- vapply(sets, is.null, logical(1)) + + # If no sets are present, there's nothing more to do + if (all(noSet)) { + return(p) + } + + # Store the unique set of crosstalk sets (which gets looped over client-side) + p$x$highlight$ctGroups <- i(unique(unlist(sets))) + + # Build a set -> key mapping for each relevant trace, which we'll use + # to set default values and/or build the selectize.js payload (if relevant) + setDat <- p$x$data[!noSet] + keys <- setNames(lapply(setDat, "[[", "key"), sets[!noSet]) - # TODO: throw warning if we don't detect valid keys? - hasKeys <- FALSE for (i in p$x$highlight$ctGroups) { + + # Get all the keys for this crosstalk group k <- unique(unlist(keys[names(keys) %in% i], use.names = FALSE)) - if (is.null(k)) next k <- k[!is.null(k)] - hasKeys <- TRUE - - # include one selectize dropdown per "valid" SharedData layer - if (isTRUE(p$x$highlight$selectize)) { - # Hash i (the crosstalk group id) so that it can be used - # as an HTML id client-side (i.e., key shouldn't contain spaces) - p$x$selectize[[rlang::hash(i)]] <- list( - items = data.frame(value = k, label = k), group = i - ) - } + if (length(k) == 0) next # set default values via crosstalk api - vals <- p$x$highlight$defaultValues[p$x$highlight$defaultValues %in% k] + vals <- intersect(p$x$highlight$defaultValues, k) if (length(vals)) { p <- htmlwidgets::onRender( p, sprintf( @@ -399,20 +400,44 @@ supply_highlight_attrs <- function(p) { ) ) } + + # include one selectize dropdown per "valid" SharedData layer + selectize <- p$x$highlight$selectize %||% FALSE + if (!identical(selectize, FALSE)) { + options <- list(items = data.frame(value = k, label = k), group = i) + if (!is.logical(selectize)) { + options <- modify_list(options, selectize) + } + # Hash i (the crosstalk group id) so that it can be used + # as an HTML id client-side (i.e., key shouldn't contain spaces) + groupId <- rlang::hash(i) + + # If the selectize payload has already been built, use that already built payload + # (since it may have been modified at this point), unless there are new keys to consider + oldSelectize <- p$x$selectize[[groupId]] + if (length(oldSelectize) > 0) { + missingKeys <- setdiff(k, oldSelectize$items$value) + if (length(missingKeys) > 0) { + warning("Overwriting the existing selectize payload for group '", i, "'. If you've previously modified this payload in some way, consider modifying it again.") + } else { + options <- oldSelectize + } + } + + p$x$selectize[[groupId]] <- options + } } - # add HTML dependencies, set a sensible dragmode default, & throw messages - if (hasKeys) { - p$x$layout$dragmode <- p$x$layout$dragmode %|D|% - default(switch(p$x$highlight$on %||% "", plotly_selected = "select", plotly_selecting = "select") %||% "zoom") - if (is.default(p$x$highlight$off)) { - message( - sprintf( - "Setting the `off` event (i.e., '%s') to match the `on` event (i.e., '%s'). You can change this default via the `highlight()` function.", - p$x$highlight$off, p$x$highlight$on - ) + # set a sensible dragmode default, & throw messages + p$x$layout$dragmode <- p$x$layout$dragmode %|D|% + default(switch(p$x$highlight$on %||% "", plotly_selected = "select", plotly_selecting = "select") %||% "zoom") + if (is.default(p$x$highlight$off)) { + message( + sprintf( + "Setting the `off` event (i.e., '%s') to match the `on` event (i.e., '%s'). You can change this default via the `highlight()` function.", + p$x$highlight$off, p$x$highlight$on ) - } + ) } p @@ -424,7 +449,7 @@ verify_attr_names <- function(p) { # some layout attributes (e.g., [x-y]axis can have trailing numbers) attrs_name_check( sub("[0-9]+$", "", names(p$x$layout)), - c(names(Schema$layout$layoutAttributes), c("barmode", "bargap", "bargroupgap", "barcornerradius", "mapType")), + c(names(Schema$layout$layoutAttributes), c("boxmode", "barmode", "bargap", "bargroupgap", "barcornerradius", "mapType")), "layout" ) attrs_name_check( @@ -923,22 +948,6 @@ verify_mathjax <- function(p) { p } -verify_scattergl_platform <- function(p) { - if (!identical(.Platform$OS.type, "windows")) return(p) - if (!is_rstudio()) return(p) - - types <- vapply(p$x$data, function(x) x[["type"]] %||% "scatter", character(1)) - if ("scattergl" %in% types) { - warning( - "'scattergl' trace types don't currently render in RStudio on Windows. ", - "Open in another web browser (IE, Chrome, Firefox, etc).", - call. = FALSE - ) - } - - p -} - has_marker <- function(types, modes) { is_scatter <- grepl("scatter", types) ifelse(is_scatter, grepl("marker", modes), has_attr(types, "marker")) diff --git a/demo/animation-tour-USArrests.R b/demo/animation-tour-USArrests.R index 887101bc38..5d983d4b83 100644 --- a/demo/animation-tour-USArrests.R +++ b/demo/animation-tour-USArrests.R @@ -1,16 +1,21 @@ # adapted from https://github.com/rstudio/ggvis/blob/master/demo/tourr.r -library(tourr) library(plotly) data("USArrests") +# Avoids R CMD check NOTE about using `tourr` without mentioning it in DESCRIPTION +# Install it via CRAN `install.packages("tourr")` +rescale <- getFromNamespace("rescale", "tourr") +new_tour <- getFromNamespace("new_tour", "tourr") +grand_tour <- getFromNamespace("grand_tour", "tourr") + mat <- rescale(USArrests[, 1:4]) tour <- new_tour(mat, grand_tour(), NULL) # projection of each observation tour_dat <- function(step_size) { step <- tour(step_size) - proj <- center(mat %*% step$proj) + proj <- scale(mat %*% step$proj, center = TRUE, scale = FALSE) data.frame(x = proj[,1], y = proj[,2], state = rownames(mat)) } diff --git a/demo/animation-tour-basic.R b/demo/animation-tour-basic.R index b56a313132..0d337a77cb 100644 --- a/demo/animation-tour-basic.R +++ b/demo/animation-tour-basic.R @@ -1,13 +1,22 @@ # adapted from https://github.com/rstudio/ggvis/blob/master/demo/tourr.r -library(tourr) library(plotly) +# Avoids R CMD check NOTE about using `tourr` without mentioning it in DESCRIPTION +# Install it `install.packages("tourr")` +rescale <- getFromNamespace("rescale", "tourr") +new_tour <- getFromNamespace("new_tour", "tourr") +grand_tour <- getFromNamespace("grand_tour", "tourr") +lazyLoad( + file.path(system.file("data", package = "tourr"), "Rdata"), + filter = function(x) x == "flea" +) + mat <- rescale(as.matrix(flea[1:6])) tour <- new_tour(mat, grand_tour(), NULL) tour_dat <- function(step_size) { step <- tour(step_size) - proj <- center(mat %*% step$proj) + proj <- scale(mat %*% step$proj, center = TRUE, scale = FALSE) data.frame(x = proj[,1], y = proj[,2], species = flea$species) } diff --git a/demo/crosstalk-filter-lines.R b/demo/crosstalk-filter-lines.R index 893ba591ab..6fb8aa90af 100644 --- a/demo/crosstalk-filter-lines.R +++ b/demo/crosstalk-filter-lines.R @@ -1,8 +1,14 @@ library(crosstalk) library(ggplot2) -library(gapminder) library(plotly) +# Equivalent to data(gapminder, package = "gapminder"), but avoids R CMD check NOTE +# about `gapminder` not being in DESCRIPTION. Install it `install.packages("gapminder")` +lazyLoad( + file.path(system.file("data", package = "gapminder"), "Rdata"), + filter = function(x) x == "gapminder" +) + sd <- highlight_key(gapminder) g <- ggplot(sd, aes(year, lifeExp, color = country, group = country)) + diff --git a/demo/crosstalk-highlight-leaflet.R b/demo/crosstalk-highlight-leaflet.R index eb0fd89cf4..a5662de38e 100644 --- a/demo/crosstalk-highlight-leaflet.R +++ b/demo/crosstalk-highlight-leaflet.R @@ -1,6 +1,4 @@ library(plotly) -# devtools::install_github("rstudio/leaflet#346") -library(leaflet) library(crosstalk) library(htmltools) @@ -13,8 +11,11 @@ p <- plot_ly(sd, x = ~depth, y = ~mag) %>% add_markers(alpha = 0.5) %>% highlight("plotly_selected", dynamic = TRUE) -map <- leaflet(sd) %>% - addTiles() %>% - addCircles() +# Requires devtools::install_github("rstudio/leaflet#346") +withr::with_namespace("leaflet", { + map <- leaflet(sd) %>% + addTiles() %>% + addCircles() +}) bscols(p, map) diff --git a/demo/sf-dt.R b/demo/sf-dt.R index 6bbadf8a86..d3a37050f3 100644 --- a/demo/sf-dt.R +++ b/demo/sf-dt.R @@ -9,4 +9,5 @@ map <- plot_ly(ncsd, split = ~NAME, color = I("gray"), hoveron = "fills") %>% layout(title = "Click on counties to query them", showlegend = FALSE) %>% config(displayModeBar = FALSE) -bscols(map, DT::datatable(ncsd)) +datatable <- getFromNamespace("datatable", "DT") +bscols(map, datatable(ncsd)) diff --git a/demo/sf-mapbox-data.R b/demo/sf-mapbox-data.R index a0e6ceca85..2bf27040c0 100644 --- a/demo/sf-mapbox-data.R +++ b/demo/sf-mapbox-data.R @@ -11,10 +11,11 @@ plot_mapbox(res_mn, split = ~INDRESNAME, color = ~AREA, stroke = ~PERIMETER, spa # linking with DT mn <- highlight_key(res_mn) +datatable <- getFromNamespace("datatable", "DT") bscols( plot_mapbox(mn, split = ~INDRESNAME, text = ~INDRESNAME, hoverinfo = "text", hoveron = "fills") %>% layout(title = "Click a reservation", showlegend = FALSE), - DT::datatable(mn) + datatable(mn) ) # linking with plotly @@ -31,5 +32,3 @@ bscols( layout(barmode = "overlay") %>% highlight("plotly_selected", persistent = TRUE) ) - - diff --git a/demo/sf-mapbox-layout.R b/demo/sf-mapbox-layout.R index 61461cecdc..b1bf48d940 100644 --- a/demo/sf-mapbox-layout.R +++ b/demo/sf-mapbox-layout.R @@ -7,7 +7,8 @@ nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE) sf_to_geojson <- function(x) { tmp <- tempfile(fileext = ".geojson") st_write(x, tmp, driver = "GEOJSON") - geojsonio::geojson_read(tmp, "local") + geojson_read <- getFromNamespace("geojson_read", "geojsonio") + geojson_read(tmp, "local") } # By converting sf to geojson and routing to mapbox.layers, rendering diff --git a/inst/CITATION b/inst/CITATION index 522858f67e..83739ac862 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -1,6 +1,5 @@ -citHeader("To cite plotly in publications use:") - -citEntry(entry = "book", +bibentry( + bibtype = "book", author = "Carson Sievert", title = "Interactive Web-Based Data Visualization with R, plotly, and shiny", publisher = "Chapman and Hall/CRC", diff --git a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/001.png b/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/001.png deleted file mode 100644 index a2c4ed51fe..0000000000 Binary files a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/001.png and /dev/null differ diff --git a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/002.png b/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/002.png deleted file mode 100644 index 019a666e49..0000000000 Binary files a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/002.png and /dev/null differ diff --git a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/003.png b/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/003.png deleted file mode 100644 index 7d6f6c1421..0000000000 Binary files a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/003.png and /dev/null differ diff --git a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/004.png b/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/004.png deleted file mode 100644 index 51a8976c1f..0000000000 Binary files a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/004.png and /dev/null differ diff --git a/inst/examples/shiny/event_data/tests/shinytest/mytest.R b/inst/examples/shiny/event_data/tests/shinytest/mytest.R deleted file mode 100644 index 803adf7b71..0000000000 --- a/inst/examples/shiny/event_data/tests/shinytest/mytest.R +++ /dev/null @@ -1,29 +0,0 @@ -library(shinytest) -app <- ShinyDriver$new("../../", shinyOptions = list(display.mode = "normal")) -app$snapshotInit("mytest") - -app$snapshot() -app$setInputs(`plotly_hover-A` = "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]", allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_click-A` = "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]", allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_hover-A` = character(0), allowInputNoBinding_ = TRUE) -app$snapshot() -app$setInputs(`plotly_brushing-A` = "{\"x\":[25.726819184123485,25.98332414553473],\"y\":[1.3174499999999998,5.61955]}", allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_selecting-A` = "[]", allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_brushing-A` = "{\"x\":[24.64379823594267,25.98332414553473],\"y\":[3.2093373493975905,3.5073743975903615]}", allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_brushing-A` = "{\"x\":[24.045286659316428,25.98332414553473],\"y\":[3.040881626506024,3.5073743975903615]}", allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_selecting-A` = "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]", allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_brushing-A` = "{\"x\":[23.95978500551268,25.98332414553473],\"y\":[3.0020072289156627,3.5073743975903615]}", allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_selected-A` = "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]", allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_brushed-A` = "{\"x\":[23.95978500551268,25.98332414553473],\"y\":[3.0020072289156627,3.5073743975903615]}", allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_hover-A` = "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]", allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_hover-A` = character(0), allowInputNoBinding_ = TRUE) -app$snapshot() -app$setInputs(`plotly_selected-A` = character(0), allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_brushed-A` = character(0), allowInputNoBinding_ = TRUE) -#app$setInputs(`plotly_selected-A` = character(0), allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_selecting-A` = character(0), allowInputNoBinding_ = TRUE) -#app$setInputs(`plotly_brushed-A` = character(0), allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_brushing-A` = character(0), allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_click-A` = character(0), allowInputNoBinding_ = TRUE) -app$setInputs(`plotly_deselect-A` = "\"plot\"", allowInputNoBinding_ = TRUE) -app$snapshot() diff --git a/inst/examples/shiny/event_data/tests/testthat.R b/inst/examples/shiny/event_data/tests/testthat.R new file mode 100644 index 0000000000..7d25b5b9e4 --- /dev/null +++ b/inst/examples/shiny/event_data/tests/testthat.R @@ -0,0 +1 @@ +shinytest2::test_app() diff --git a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/001.json b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/001.json similarity index 79% rename from inst/examples/shiny/event_data/tests/shinytest/mytest-expected/001.json rename to inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/001.json index 175aa7b1a3..e4e32e11f5 100644 --- a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/001.json +++ b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/001.json @@ -1,6 +1,21 @@ { "input": { - "plotType": "ggplotly" + ".clientValue-default-plotlyCrosstalkOpts": { + "on": "plotly_click", + "persistent": false, + "dynamic": false, + "selectize": false, + "opacityDim": 0.2, + "selected": { + "opacity": 1 + }, + "debounce": 0, + "color": [ + + ] + }, + "plotType": "ggplotly", + "plotly_afterplot-A": "\"plot\"" }, "output": { "brushed": "[1] \"Brush extents appear here (double-click to clear)\"", @@ -14,70 +29,70 @@ "x": [ 21, 21, - 22.8, - 21.4, - 18.7, - 18.1, - 14.3, - 24.4, - 22.8, - 19.2, - 17.8, - 16.4, - 17.3, - 15.2, + 22.800000000000001, + 21.399999999999999, + 18.699999999999999, + 18.100000000000001, + 14.300000000000001, + 24.399999999999999, + 22.800000000000001, + 19.199999999999999, + 17.800000000000001, + 16.399999999999999, + 17.300000000000001, + 15.199999999999999, 10.4, 10.4, - 14.7, - 32.4, - 30.4, - 33.9, + 14.699999999999999, + 32.399999999999999, + 30.399999999999999, + 33.899999999999999, 21.5, 15.5, - 15.2, - 13.3, - 19.2, - 27.3, + 15.199999999999999, + 13.300000000000001, + 19.199999999999999, + 27.300000000000001, 26, - 30.4, - 15.8, - 19.7, + 30.399999999999999, + 15.800000000000001, + 19.699999999999999, 15, - 21.4 + 21.399999999999999 ], "y": [ - 2.62, + 2.6200000000000001, 2.875, - 2.32, - 3.215, - 3.44, + 2.3199999999999998, + 3.2149999999999999, + 3.4399999999999999, 3.46, - 3.57, - 3.19, - 3.15, - 3.44, - 3.44, - 4.07, + 3.5699999999999998, + 3.1899999999999999, + 3.1499999999999999, + 3.4399999999999999, + 3.4399999999999999, + 4.0700000000000003, 3.73, - 3.78, + 3.7799999999999998, 5.25, - 5.424, - 5.345, - 2.2, + 5.4240000000000004, + 5.3449999999999998, + 2.2000000000000002, 1.615, 1.835, - 2.465, + 2.4649999999999999, 3.52, - 3.435, - 3.84, - 3.845, - 1.935, - 2.14, - 1.513, - 3.17, + 3.4350000000000001, + 3.8399999999999999, + 3.8450000000000002, + 1.9350000000000001, + 2.1400000000000001, + 1.5129999999999999, + 3.1699999999999999, 2.77, - 3.57, - 2.78 + 3.5699999999999998, + 2.7799999999999998 ], "text": [ "mpg: 21.0
wt: 2.620
nms: Mazda RX4", @@ -153,10 +168,10 @@ "autocolorscale": false, "color": "rgba(0,0,0,1)", "opacity": 1, - "size": 5.66929133858268, + "size": 5.6692913385826778, "symbol": "circle", "line": { - "width": 1.88976377952756, + "width": 1.8897637795275593, "color": "rgba(0,0,0,1)" } }, @@ -170,17 +185,17 @@ ], "layout": { "margin": { - "t": 25.7412480974125, - "r": 7.30593607305936, - "b": 39.6955859969559, - "l": 31.4155251141553 + "t": 25.74124809741248, + "r": 7.3059360730593621, + "b": 39.69558599695587, + "l": 31.415525114155255 }, "plot_bgcolor": "rgba(235,235,235,1)", "paper_bgcolor": "rgba(255,255,255,1)", "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 14.6118721461187 + "size": 14.611872146118724 }, "xaxis": { "domain": [ @@ -191,8 +206,8 @@ "type": "linear", "autorange": false, "range": [ - 9.225, - 35.075 + 9.2249999999999996, + 35.074999999999996 ], "tickmode": "array", "ticktext": [ @@ -223,13 +238,13 @@ "nticks": null, "ticks": "outside", "tickcolor": "rgba(51,51,51,1)", - "ticklen": 3.65296803652968, - "tickwidth": 0.66417600664176, + "ticklen": 3.6529680365296811, + "tickwidth": 0.66417600664176002, "showticklabels": true, "tickfont": { "color": "rgba(77,77,77,1)", "family": "", - "size": 11.689497716895 + "size": 11.68949771689498 }, "tickangle": 0, "showline": false, @@ -237,7 +252,7 @@ "linewidth": 0, "showgrid": true, "gridcolor": "rgba(255,255,255,1)", - "gridwidth": 0.66417600664176, + "gridwidth": 0.66417600664176002, "zeroline": false, "anchor": "y", "title": { @@ -245,7 +260,7 @@ "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 14.6118721461187 + "size": 14.611872146118724 } }, "hoverformat": ".2f" @@ -259,8 +274,8 @@ "type": "linear", "autorange": false, "range": [ - 1.31745, - 5.61955 + 1.3174499999999998, + 5.6195500000000003 ], "tickmode": "array", "ticktext": [ @@ -285,13 +300,13 @@ "nticks": null, "ticks": "outside", "tickcolor": "rgba(51,51,51,1)", - "ticklen": 3.65296803652968, - "tickwidth": 0.66417600664176, + "ticklen": 3.6529680365296811, + "tickwidth": 0.66417600664176002, "showticklabels": true, "tickfont": { "color": "rgba(77,77,77,1)", "family": "", - "size": 11.689497716895 + "size": 11.68949771689498 }, "tickangle": 0, "showline": false, @@ -299,7 +314,7 @@ "linewidth": 0, "showgrid": true, "gridcolor": "rgba(255,255,255,1)", - "gridwidth": 0.66417600664176, + "gridwidth": 0.66417600664176002, "zeroline": false, "anchor": "x", "title": { @@ -307,7 +322,7 @@ "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 14.6118721461187 + "size": 14.611872146118724 } }, "hoverformat": ".2f" @@ -335,11 +350,11 @@ "legend": { "bgcolor": "rgba(255,255,255,1)", "bordercolor": "transparent", - "borderwidth": 1.88976377952756, + "borderwidth": 1.8897637795275593, "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 11.689497716895 + "size": 11.68949771689498 } }, "hovermode": "closest", @@ -374,7 +389,7 @@ "persistent": false, "dynamic": false, "selectize": false, - "opacityDim": 0.2, + "opacityDim": 0.20000000000000001, "selected": { "opacity": 1 }, @@ -430,9 +445,9 @@ }, { "name": "crosstalk", - "version": "1.2.0", + "version": "1.2.1", "src": { - "href": "crosstalk-1.2.0" + "href": "crosstalk-1.2.1" }, "meta": null, "script": "js/crosstalk.min.js", diff --git a/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/001_.png b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/001_.png new file mode 100644 index 0000000000..f844a551f9 Binary files /dev/null and b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/001_.png differ diff --git a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/002.json b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/002.json similarity index 81% rename from inst/examples/shiny/event_data/tests/shinytest/mytest-expected/002.json rename to inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/002.json index 5025798b36..15430c47e8 100644 --- a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/002.json +++ b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/002.json @@ -14,11 +14,11 @@ ] }, + "plotType": "ggplotly", "plotly_afterplot-A": "\"plot\"", "plotly_click-A": "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]", "plotly_hover-A": null, - "plotly_relayout-A": "{\"width\":962,\"height\":400}", - "plotType": "ggplotly" + "plotly_relayout-A": "{\"width\":962,\"height\":400}" }, "output": { "brushed": "[1] \"Brush extents appear here (double-click to clear)\"", @@ -32,70 +32,70 @@ "x": [ 21, 21, - 22.8, - 21.4, - 18.7, - 18.1, - 14.3, - 24.4, - 22.8, - 19.2, - 17.8, - 16.4, - 17.3, - 15.2, + 22.800000000000001, + 21.399999999999999, + 18.699999999999999, + 18.100000000000001, + 14.300000000000001, + 24.399999999999999, + 22.800000000000001, + 19.199999999999999, + 17.800000000000001, + 16.399999999999999, + 17.300000000000001, + 15.199999999999999, 10.4, 10.4, - 14.7, - 32.4, - 30.4, - 33.9, + 14.699999999999999, + 32.399999999999999, + 30.399999999999999, + 33.899999999999999, 21.5, 15.5, - 15.2, - 13.3, - 19.2, - 27.3, + 15.199999999999999, + 13.300000000000001, + 19.199999999999999, + 27.300000000000001, 26, - 30.4, - 15.8, - 19.7, + 30.399999999999999, + 15.800000000000001, + 19.699999999999999, 15, - 21.4 + 21.399999999999999 ], "y": [ - 2.62, + 2.6200000000000001, 2.875, - 2.32, - 3.215, - 3.44, + 2.3199999999999998, + 3.2149999999999999, + 3.4399999999999999, 3.46, - 3.57, - 3.19, - 3.15, - 3.44, - 3.44, - 4.07, + 3.5699999999999998, + 3.1899999999999999, + 3.1499999999999999, + 3.4399999999999999, + 3.4399999999999999, + 4.0700000000000003, 3.73, - 3.78, + 3.7799999999999998, 5.25, - 5.424, - 5.345, - 2.2, + 5.4240000000000004, + 5.3449999999999998, + 2.2000000000000002, 1.615, 1.835, - 2.465, + 2.4649999999999999, 3.52, - 3.435, - 3.84, - 3.845, - 1.935, - 2.14, - 1.513, - 3.17, + 3.4350000000000001, + 3.8399999999999999, + 3.8450000000000002, + 1.9350000000000001, + 2.1400000000000001, + 1.5129999999999999, + 3.1699999999999999, 2.77, - 3.57, - 2.78 + 3.5699999999999998, + 2.7799999999999998 ], "text": [ "mpg: 21.0
wt: 2.620
nms: Mazda RX4", @@ -171,10 +171,10 @@ "autocolorscale": false, "color": "rgba(0,0,0,1)", "opacity": 1, - "size": 5.66929133858268, + "size": 5.6692913385826778, "symbol": "circle", "line": { - "width": 1.88976377952756, + "width": 1.8897637795275593, "color": "rgba(0,0,0,1)" } }, @@ -188,17 +188,17 @@ ], "layout": { "margin": { - "t": 25.7412480974125, - "r": 7.30593607305936, - "b": 39.6955859969559, - "l": 31.4155251141553 + "t": 25.74124809741248, + "r": 7.3059360730593621, + "b": 39.69558599695587, + "l": 31.415525114155255 }, "plot_bgcolor": "rgba(235,235,235,1)", "paper_bgcolor": "rgba(255,255,255,1)", "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 14.6118721461187 + "size": 14.611872146118724 }, "xaxis": { "domain": [ @@ -209,8 +209,8 @@ "type": "linear", "autorange": false, "range": [ - 9.225, - 35.075 + 9.2249999999999996, + 35.074999999999996 ], "tickmode": "array", "ticktext": [ @@ -241,13 +241,13 @@ "nticks": null, "ticks": "outside", "tickcolor": "rgba(51,51,51,1)", - "ticklen": 3.65296803652968, - "tickwidth": 0.66417600664176, + "ticklen": 3.6529680365296811, + "tickwidth": 0.66417600664176002, "showticklabels": true, "tickfont": { "color": "rgba(77,77,77,1)", "family": "", - "size": 11.689497716895 + "size": 11.68949771689498 }, "tickangle": 0, "showline": false, @@ -255,7 +255,7 @@ "linewidth": 0, "showgrid": true, "gridcolor": "rgba(255,255,255,1)", - "gridwidth": 0.66417600664176, + "gridwidth": 0.66417600664176002, "zeroline": false, "anchor": "y", "title": { @@ -263,7 +263,7 @@ "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 14.6118721461187 + "size": 14.611872146118724 } }, "hoverformat": ".2f" @@ -277,8 +277,8 @@ "type": "linear", "autorange": false, "range": [ - 1.31745, - 5.61955 + 1.3174499999999998, + 5.6195500000000003 ], "tickmode": "array", "ticktext": [ @@ -303,13 +303,13 @@ "nticks": null, "ticks": "outside", "tickcolor": "rgba(51,51,51,1)", - "ticklen": 3.65296803652968, - "tickwidth": 0.66417600664176, + "ticklen": 3.6529680365296811, + "tickwidth": 0.66417600664176002, "showticklabels": true, "tickfont": { "color": "rgba(77,77,77,1)", "family": "", - "size": 11.689497716895 + "size": 11.68949771689498 }, "tickangle": 0, "showline": false, @@ -317,7 +317,7 @@ "linewidth": 0, "showgrid": true, "gridcolor": "rgba(255,255,255,1)", - "gridwidth": 0.66417600664176, + "gridwidth": 0.66417600664176002, "zeroline": false, "anchor": "x", "title": { @@ -325,7 +325,7 @@ "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 14.6118721461187 + "size": 14.611872146118724 } }, "hoverformat": ".2f" @@ -353,11 +353,11 @@ "legend": { "bgcolor": "rgba(255,255,255,1)", "bordercolor": "transparent", - "borderwidth": 1.88976377952756, + "borderwidth": 1.8897637795275593, "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 11.689497716895 + "size": 11.68949771689498 } }, "hovermode": "closest", @@ -392,7 +392,7 @@ "persistent": false, "dynamic": false, "selectize": false, - "opacityDim": 0.2, + "opacityDim": 0.20000000000000001, "selected": { "opacity": 1 }, @@ -448,9 +448,9 @@ }, { "name": "crosstalk", - "version": "1.2.0", + "version": "1.2.1", "src": { - "href": "crosstalk-1.2.0" + "href": "crosstalk-1.2.1" }, "meta": null, "script": "js/crosstalk.min.js", diff --git a/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/002_.png b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/002_.png new file mode 100644 index 0000000000..b96cc7b25e Binary files /dev/null and b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/002_.png differ diff --git a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/003.json b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/003.json similarity index 81% rename from inst/examples/shiny/event_data/tests/shinytest/mytest-expected/003.json rename to inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/003.json index 17a3bbfe4b..91f5634177 100644 --- a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/003.json +++ b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/003.json @@ -14,6 +14,7 @@ ] }, + "plotType": "ggplotly", "plotly_afterplot-A": "\"plot\"", "plotly_brushed-A": "{\"x\":[23.95978500551268,25.98332414553473],\"y\":[3.0020072289156627,3.5073743975903615]}", "plotly_brushing-A": "{\"x\":[23.95978500551268,25.98332414553473],\"y\":[3.0020072289156627,3.5073743975903615]}", @@ -21,8 +22,7 @@ "plotly_hover-A": null, "plotly_relayout-A": "{\"width\":962,\"height\":400}", "plotly_selected-A": "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]", - "plotly_selecting-A": "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]", - "plotType": "ggplotly" + "plotly_selecting-A": "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]" }, "output": { "brushed": "$x\n[1] 23.95979 25.98332\n\n$y\n[1] 3.002007 3.507374", @@ -36,70 +36,70 @@ "x": [ 21, 21, - 22.8, - 21.4, - 18.7, - 18.1, - 14.3, - 24.4, - 22.8, - 19.2, - 17.8, - 16.4, - 17.3, - 15.2, + 22.800000000000001, + 21.399999999999999, + 18.699999999999999, + 18.100000000000001, + 14.300000000000001, + 24.399999999999999, + 22.800000000000001, + 19.199999999999999, + 17.800000000000001, + 16.399999999999999, + 17.300000000000001, + 15.199999999999999, 10.4, 10.4, - 14.7, - 32.4, - 30.4, - 33.9, + 14.699999999999999, + 32.399999999999999, + 30.399999999999999, + 33.899999999999999, 21.5, 15.5, - 15.2, - 13.3, - 19.2, - 27.3, + 15.199999999999999, + 13.300000000000001, + 19.199999999999999, + 27.300000000000001, 26, - 30.4, - 15.8, - 19.7, + 30.399999999999999, + 15.800000000000001, + 19.699999999999999, 15, - 21.4 + 21.399999999999999 ], "y": [ - 2.62, + 2.6200000000000001, 2.875, - 2.32, - 3.215, - 3.44, + 2.3199999999999998, + 3.2149999999999999, + 3.4399999999999999, 3.46, - 3.57, - 3.19, - 3.15, - 3.44, - 3.44, - 4.07, + 3.5699999999999998, + 3.1899999999999999, + 3.1499999999999999, + 3.4399999999999999, + 3.4399999999999999, + 4.0700000000000003, 3.73, - 3.78, + 3.7799999999999998, 5.25, - 5.424, - 5.345, - 2.2, + 5.4240000000000004, + 5.3449999999999998, + 2.2000000000000002, 1.615, 1.835, - 2.465, + 2.4649999999999999, 3.52, - 3.435, - 3.84, - 3.845, - 1.935, - 2.14, - 1.513, - 3.17, + 3.4350000000000001, + 3.8399999999999999, + 3.8450000000000002, + 1.9350000000000001, + 2.1400000000000001, + 1.5129999999999999, + 3.1699999999999999, 2.77, - 3.57, - 2.78 + 3.5699999999999998, + 2.7799999999999998 ], "text": [ "mpg: 21.0
wt: 2.620
nms: Mazda RX4", @@ -175,10 +175,10 @@ "autocolorscale": false, "color": "rgba(0,0,0,1)", "opacity": 1, - "size": 5.66929133858268, + "size": 5.6692913385826778, "symbol": "circle", "line": { - "width": 1.88976377952756, + "width": 1.8897637795275593, "color": "rgba(0,0,0,1)" } }, @@ -192,17 +192,17 @@ ], "layout": { "margin": { - "t": 25.7412480974125, - "r": 7.30593607305936, - "b": 39.6955859969559, - "l": 31.4155251141553 + "t": 25.74124809741248, + "r": 7.3059360730593621, + "b": 39.69558599695587, + "l": 31.415525114155255 }, "plot_bgcolor": "rgba(235,235,235,1)", "paper_bgcolor": "rgba(255,255,255,1)", "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 14.6118721461187 + "size": 14.611872146118724 }, "xaxis": { "domain": [ @@ -213,8 +213,8 @@ "type": "linear", "autorange": false, "range": [ - 9.225, - 35.075 + 9.2249999999999996, + 35.074999999999996 ], "tickmode": "array", "ticktext": [ @@ -245,13 +245,13 @@ "nticks": null, "ticks": "outside", "tickcolor": "rgba(51,51,51,1)", - "ticklen": 3.65296803652968, - "tickwidth": 0.66417600664176, + "ticklen": 3.6529680365296811, + "tickwidth": 0.66417600664176002, "showticklabels": true, "tickfont": { "color": "rgba(77,77,77,1)", "family": "", - "size": 11.689497716895 + "size": 11.68949771689498 }, "tickangle": 0, "showline": false, @@ -259,7 +259,7 @@ "linewidth": 0, "showgrid": true, "gridcolor": "rgba(255,255,255,1)", - "gridwidth": 0.66417600664176, + "gridwidth": 0.66417600664176002, "zeroline": false, "anchor": "y", "title": { @@ -267,7 +267,7 @@ "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 14.6118721461187 + "size": 14.611872146118724 } }, "hoverformat": ".2f" @@ -281,8 +281,8 @@ "type": "linear", "autorange": false, "range": [ - 1.31745, - 5.61955 + 1.3174499999999998, + 5.6195500000000003 ], "tickmode": "array", "ticktext": [ @@ -307,13 +307,13 @@ "nticks": null, "ticks": "outside", "tickcolor": "rgba(51,51,51,1)", - "ticklen": 3.65296803652968, - "tickwidth": 0.66417600664176, + "ticklen": 3.6529680365296811, + "tickwidth": 0.66417600664176002, "showticklabels": true, "tickfont": { "color": "rgba(77,77,77,1)", "family": "", - "size": 11.689497716895 + "size": 11.68949771689498 }, "tickangle": 0, "showline": false, @@ -321,7 +321,7 @@ "linewidth": 0, "showgrid": true, "gridcolor": "rgba(255,255,255,1)", - "gridwidth": 0.66417600664176, + "gridwidth": 0.66417600664176002, "zeroline": false, "anchor": "x", "title": { @@ -329,7 +329,7 @@ "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 14.6118721461187 + "size": 14.611872146118724 } }, "hoverformat": ".2f" @@ -357,11 +357,11 @@ "legend": { "bgcolor": "rgba(255,255,255,1)", "bordercolor": "transparent", - "borderwidth": 1.88976377952756, + "borderwidth": 1.8897637795275593, "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 11.689497716895 + "size": 11.68949771689498 } }, "hovermode": "closest", @@ -396,7 +396,7 @@ "persistent": false, "dynamic": false, "selectize": false, - "opacityDim": 0.2, + "opacityDim": 0.20000000000000001, "selected": { "opacity": 1 }, @@ -452,9 +452,9 @@ }, { "name": "crosstalk", - "version": "1.2.0", + "version": "1.2.1", "src": { - "href": "crosstalk-1.2.0" + "href": "crosstalk-1.2.1" }, "meta": null, "script": "js/crosstalk.min.js", diff --git a/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/003_.png b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/003_.png new file mode 100644 index 0000000000..6c51c45735 Binary files /dev/null and b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/003_.png differ diff --git a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/004.json b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/004.json similarity index 81% rename from inst/examples/shiny/event_data/tests/shinytest/mytest-expected/004.json rename to inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/004.json index 2fce4cb389..a5fc81e2ee 100644 --- a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/004.json +++ b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/004.json @@ -14,6 +14,7 @@ ] }, + "plotType": "ggplotly", "plotly_afterplot-A": "\"plot\"", "plotly_brushed-A": null, "plotly_brushing-A": null, @@ -22,8 +23,7 @@ "plotly_hover-A": null, "plotly_relayout-A": "{\"width\":962,\"height\":400}", "plotly_selected-A": null, - "plotly_selecting-A": null, - "plotType": "ggplotly" + "plotly_selecting-A": null }, "output": { "brushed": "[1] \"Brush extents appear here (double-click to clear)\"", @@ -37,70 +37,70 @@ "x": [ 21, 21, - 22.8, - 21.4, - 18.7, - 18.1, - 14.3, - 24.4, - 22.8, - 19.2, - 17.8, - 16.4, - 17.3, - 15.2, + 22.800000000000001, + 21.399999999999999, + 18.699999999999999, + 18.100000000000001, + 14.300000000000001, + 24.399999999999999, + 22.800000000000001, + 19.199999999999999, + 17.800000000000001, + 16.399999999999999, + 17.300000000000001, + 15.199999999999999, 10.4, 10.4, - 14.7, - 32.4, - 30.4, - 33.9, + 14.699999999999999, + 32.399999999999999, + 30.399999999999999, + 33.899999999999999, 21.5, 15.5, - 15.2, - 13.3, - 19.2, - 27.3, + 15.199999999999999, + 13.300000000000001, + 19.199999999999999, + 27.300000000000001, 26, - 30.4, - 15.8, - 19.7, + 30.399999999999999, + 15.800000000000001, + 19.699999999999999, 15, - 21.4 + 21.399999999999999 ], "y": [ - 2.62, + 2.6200000000000001, 2.875, - 2.32, - 3.215, - 3.44, + 2.3199999999999998, + 3.2149999999999999, + 3.4399999999999999, 3.46, - 3.57, - 3.19, - 3.15, - 3.44, - 3.44, - 4.07, + 3.5699999999999998, + 3.1899999999999999, + 3.1499999999999999, + 3.4399999999999999, + 3.4399999999999999, + 4.0700000000000003, 3.73, - 3.78, + 3.7799999999999998, 5.25, - 5.424, - 5.345, - 2.2, + 5.4240000000000004, + 5.3449999999999998, + 2.2000000000000002, 1.615, 1.835, - 2.465, + 2.4649999999999999, 3.52, - 3.435, - 3.84, - 3.845, - 1.935, - 2.14, - 1.513, - 3.17, + 3.4350000000000001, + 3.8399999999999999, + 3.8450000000000002, + 1.9350000000000001, + 2.1400000000000001, + 1.5129999999999999, + 3.1699999999999999, 2.77, - 3.57, - 2.78 + 3.5699999999999998, + 2.7799999999999998 ], "text": [ "mpg: 21.0
wt: 2.620
nms: Mazda RX4", @@ -176,10 +176,10 @@ "autocolorscale": false, "color": "rgba(0,0,0,1)", "opacity": 1, - "size": 5.66929133858268, + "size": 5.6692913385826778, "symbol": "circle", "line": { - "width": 1.88976377952756, + "width": 1.8897637795275593, "color": "rgba(0,0,0,1)" } }, @@ -193,17 +193,17 @@ ], "layout": { "margin": { - "t": 25.7412480974125, - "r": 7.30593607305936, - "b": 39.6955859969559, - "l": 31.4155251141553 + "t": 25.74124809741248, + "r": 7.3059360730593621, + "b": 39.69558599695587, + "l": 31.415525114155255 }, "plot_bgcolor": "rgba(235,235,235,1)", "paper_bgcolor": "rgba(255,255,255,1)", "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 14.6118721461187 + "size": 14.611872146118724 }, "xaxis": { "domain": [ @@ -214,8 +214,8 @@ "type": "linear", "autorange": false, "range": [ - 9.225, - 35.075 + 9.2249999999999996, + 35.074999999999996 ], "tickmode": "array", "ticktext": [ @@ -246,13 +246,13 @@ "nticks": null, "ticks": "outside", "tickcolor": "rgba(51,51,51,1)", - "ticklen": 3.65296803652968, - "tickwidth": 0.66417600664176, + "ticklen": 3.6529680365296811, + "tickwidth": 0.66417600664176002, "showticklabels": true, "tickfont": { "color": "rgba(77,77,77,1)", "family": "", - "size": 11.689497716895 + "size": 11.68949771689498 }, "tickangle": 0, "showline": false, @@ -260,7 +260,7 @@ "linewidth": 0, "showgrid": true, "gridcolor": "rgba(255,255,255,1)", - "gridwidth": 0.66417600664176, + "gridwidth": 0.66417600664176002, "zeroline": false, "anchor": "y", "title": { @@ -268,7 +268,7 @@ "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 14.6118721461187 + "size": 14.611872146118724 } }, "hoverformat": ".2f" @@ -282,8 +282,8 @@ "type": "linear", "autorange": false, "range": [ - 1.31745, - 5.61955 + 1.3174499999999998, + 5.6195500000000003 ], "tickmode": "array", "ticktext": [ @@ -308,13 +308,13 @@ "nticks": null, "ticks": "outside", "tickcolor": "rgba(51,51,51,1)", - "ticklen": 3.65296803652968, - "tickwidth": 0.66417600664176, + "ticklen": 3.6529680365296811, + "tickwidth": 0.66417600664176002, "showticklabels": true, "tickfont": { "color": "rgba(77,77,77,1)", "family": "", - "size": 11.689497716895 + "size": 11.68949771689498 }, "tickangle": 0, "showline": false, @@ -322,7 +322,7 @@ "linewidth": 0, "showgrid": true, "gridcolor": "rgba(255,255,255,1)", - "gridwidth": 0.66417600664176, + "gridwidth": 0.66417600664176002, "zeroline": false, "anchor": "x", "title": { @@ -330,7 +330,7 @@ "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 14.6118721461187 + "size": 14.611872146118724 } }, "hoverformat": ".2f" @@ -358,11 +358,11 @@ "legend": { "bgcolor": "rgba(255,255,255,1)", "bordercolor": "transparent", - "borderwidth": 1.88976377952756, + "borderwidth": 1.8897637795275593, "font": { "color": "rgba(0,0,0,1)", "family": "", - "size": 11.689497716895 + "size": 11.68949771689498 } }, "hovermode": "closest", @@ -397,7 +397,7 @@ "persistent": false, "dynamic": false, "selectize": false, - "opacityDim": 0.2, + "opacityDim": 0.20000000000000001, "selected": { "opacity": 1 }, @@ -453,9 +453,9 @@ }, { "name": "crosstalk", - "version": "1.2.0", + "version": "1.2.1", "src": { - "href": "crosstalk-1.2.0" + "href": "crosstalk-1.2.1" }, "meta": null, "script": "js/crosstalk.min.js", diff --git a/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/004_.png b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/004_.png new file mode 100644 index 0000000000..e424b18f25 Binary files /dev/null and b/inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/004_.png differ diff --git a/inst/examples/shiny/event_data/tests/testthat/setup-shinytest2.R b/inst/examples/shiny/event_data/tests/testthat/setup-shinytest2.R new file mode 100644 index 0000000000..be65b4f035 --- /dev/null +++ b/inst/examples/shiny/event_data/tests/testthat/setup-shinytest2.R @@ -0,0 +1,2 @@ +# Load application support files into testing environment +shinytest2::load_app_env() diff --git a/inst/examples/shiny/event_data/tests/testthat/test-shinytest2.R b/inst/examples/shiny/event_data/tests/testthat/test-shinytest2.R new file mode 100644 index 0000000000..ead36064f6 --- /dev/null +++ b/inst/examples/shiny/event_data/tests/testthat/test-shinytest2.R @@ -0,0 +1,34 @@ +library(shinytest2) +app <- AppDriver$new( + "../../", view = interactive(), + options = list(display.mode = "normal") +) + +test_that("Plotly input values in Shiny", { + app$expect_values() + app$set_inputs(`plotly_hover-A` = "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]", allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_click-A` = "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]", allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_hover-A` = character(0), allow_no_input_binding_ = TRUE) + Sys.sleep(1) + app$expect_values() + app$set_inputs(`plotly_brushing-A` = "{\"x\":[25.726819184123485,25.98332414553473],\"y\":[1.3174499999999998,5.61955]}", allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_selecting-A` = "[]", allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_brushing-A` = "{\"x\":[24.64379823594267,25.98332414553473],\"y\":[3.2093373493975905,3.5073743975903615]}", allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_brushing-A` = "{\"x\":[24.045286659316428,25.98332414553473],\"y\":[3.040881626506024,3.5073743975903615]}", allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_selecting-A` = "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]", allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_brushing-A` = "{\"x\":[23.95978500551268,25.98332414553473],\"y\":[3.0020072289156627,3.5073743975903615]}", allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_selected-A` = "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]", allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_brushed-A` = "{\"x\":[23.95978500551268,25.98332414553473],\"y\":[3.0020072289156627,3.5073743975903615]}", allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_hover-A` = "[{\"curveNumber\":0,\"pointNumber\":7,\"x\":24.4,\"y\":3.19,\"customdata\":\"Merc 240D\"}]", allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_hover-A` = character(0), allow_no_input_binding_ = TRUE) + app$expect_values() + app$set_inputs(`plotly_selected-A` = character(0), allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_brushed-A` = character(0), allow_no_input_binding_ = TRUE) + #app$set_inputs(`plotly_selected-A` = character(0), allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_selecting-A` = character(0), allow_no_input_binding_ = TRUE) + #app$set_inputs(`plotly_brushed-A` = character(0), allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_brushing-A` = character(0), allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_click-A` = character(0), allow_no_input_binding_ = TRUE) + app$set_inputs(`plotly_deselect-A` = "\"plot\"", allow_no_input_binding_ = TRUE) + app$expect_values() +}) diff --git a/inst/htmlwidgets/plotly.js b/inst/htmlwidgets/plotly.js index 3b7beefa5d..71a7b3abf9 100644 --- a/inst/htmlwidgets/plotly.js +++ b/inst/htmlwidgets/plotly.js @@ -1,2 +1,2 @@ -!function l(o,r,n){function a(e,t){if(!r[e]){if(!o[e]){var i="function"==typeof require&&require;if(!t&&i)return i(e,!0);if(s)return s(e,!0);throw(i=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",i}i=r[e]={exports:{}},o[e][0].call(i.exports,function(t){return a(o[e][1][t]||t)},i,i.exports,l,o,r,n)}return r[e].exports}for(var s="function"==typeof require&&require,t=0;t"),g.legendgroup=g.legendgroup||p.join("
"),g._originalIndex=i,g._newIndex=this.gd._fullData.length+d.length,g._isCrosstalkTrace=!0,d.push(g))}if(0"),g.legendgroup=g.legendgroup||p.join("
"),g._originalIndex=l,g._newIndex=this.gd._fullData.length+d.length,g._isCrosstalkTrace=!0,d.push(g))}if(0 0) {\n var ev = JSON.stringify(event);\n for (var i = 0; i < selectionHistory.length; i++) {\n var sel = JSON.stringify(selectionHistory[i]);\n if (sel == ev) {\n return;\n }\n }\n }\n \n // accumulate history for persistent selection\n if (!x.highlight.persistent) {\n selectionHistory = [event];\n } else {\n selectionHistory.push(event);\n }\n crosstalk.var(\"plotlySelectionHistory\").set(selectionHistory);\n \n // do the actual updating of traces, frames, and the selectize widget\n traceManager.updateSelection(set, e.value);\n // https://github.com/selectize/selectize.js/blob/master/docs/api.md#methods_items\n if (x.selectize) {\n if (!x.highlight.persistent || e.value === null) {\n selectize.clear(true);\n }\n selectize.addItems(e.value, true);\n selectize.close();\n }\n }\n selection.on(\"change\", selectionChange);\n \n // Set a crosstalk variable selection value, triggering an update\n var turnOn = function(e) {\n if (e) {\n var selectedKeys = pointsToKeys(e.points);\n // Keys are group names, values are array of selected keys from group.\n for (var set in selectedKeys) {\n if (selectedKeys.hasOwnProperty(set)) {\n selection.set(selectedKeys[set].value, {sender: el});\n }\n }\n }\n };\n if (x.highlight.debounce > 0) {\n turnOn = debounce(turnOn, x.highlight.debounce);\n }\n graphDiv.on(x.highlight.on, turnOn);\n \n graphDiv.on(x.highlight.off, function turnOff(e) {\n // remove any visual clues\n removeBrush(el);\n // remove any selection history\n crosstalk.var(\"plotlySelectionHistory\").set(null);\n // trigger the actual removal of selection traces\n selection.set(null, {sender: el});\n });\n \n // register a callback for selectize so that there is bi-directional\n // communication between the widget and direct manipulation events\n if (x.selectize) {\n var selectizeID = Object.keys(x.selectize)[i];\n var items = x.selectize[selectizeID].items;\n var first = [{value: \"\", label: \"(All)\"}];\n var opts = {\n options: first.concat(items),\n searchField: \"label\",\n valueField: \"value\",\n labelField: \"label\",\n maxItems: 50\n };\n var select = $(\"#\" + selectizeID).find(\"select\")[0];\n var selectize = $(select).selectize(opts)[0].selectize;\n // NOTE: this callback is triggered when *directly* altering \n // dropdown items\n selectize.on(\"change\", function() {\n var currentItems = traceManager.groupSelections[set] || [];\n if (!x.highlight.persistent) {\n removeBrush(el);\n for (var i = 0; i < currentItems.length; i++) {\n selectize.removeItem(currentItems[i], true);\n }\n }\n var newItems = selectize.items.filter(function(idx) { \n return currentItems.indexOf(idx) < 0;\n });\n if (newItems.length > 0) {\n traceManager.updateSelection(set, newItems);\n } else {\n // Item has been removed...\n // TODO: this logic won't work for dynamically changing palette \n traceManager.updateSelection(set, null);\n traceManager.updateSelection(set, selectize.items);\n }\n });\n }\n } // end of selectionChange\n\n graphDiv.on(\"plotly_afterplot\", function() {\n // Used by Displayr to determine when widget is ready to be snapshot for testing\n graphDiv.setAttribute(\"rhtmlwidget-status\", \"ready\");\n });\n } // end of renderValue\n}; // end of widget definition\n\n/**\n * @param graphDiv The Plotly graph div\n * @param highlight An object with options for updating selection(s)\n */\nfunction TraceManager(graphDiv, highlight) {\n // The Plotly graph div\n this.gd = graphDiv;\n\n // Preserve the original data.\n // TODO: try using Lib.extendFlat() as done in \n // https://github.com/plotly/plotly.js/pull/1136 \n this.origData = JSON.parse(JSON.stringify(graphDiv.data));\n \n // avoid doing this over and over\n this.origOpacity = [];\n for (var i = 0; i < this.origData.length; i++) {\n this.origOpacity[i] = this.origData[i].opacity === 0 ? 0 : (this.origData[i].opacity || 1);\n }\n\n // key: group name, value: null or array of keys representing the\n // most recently received selection for that group.\n this.groupSelections = {};\n \n // selection parameters (e.g., transient versus persistent selection)\n this.highlight = highlight;\n}\n\nTraceManager.prototype.close = function() {\n // TODO: Unhook all event handlers\n};\n\nTraceManager.prototype.updateFilter = function(group, keys) {\n\n if (typeof(keys) === \"undefined\" || keys === null) {\n \n this.gd.data = JSON.parse(JSON.stringify(this.origData));\n \n } else {\n \n var traces = [];\n for (var i = 0; i < this.origData.length; i++) {\n var trace = this.origData[i];\n if (!trace.key || trace.set !== group) {\n continue;\n }\n var matchFunc = getMatchFunc(trace);\n var matches = matchFunc(trace.key, keys);\n \n if (matches.length > 0) {\n if (!trace._isSimpleKey) {\n // subsetArrayAttrs doesn't mutate trace (it makes a modified clone)\n trace = subsetArrayAttrs(trace, matches);\n }\n traces.push(trace);\n }\n }\n this.gd.data = traces;\n }\n \n Plotly.redraw(this.gd);\n \n // NOTE: we purposely do _not_ restore selection(s), since on filter,\n // axis likely will update, changing the pixel -> data mapping, leading \n // to a likely mismatch in the brush outline and highlighted marks\n \n};\n\nTraceManager.prototype.updateSelection = function(group, keys) {\n \n if (keys !== null && !Array.isArray(keys)) {\n throw new Error(\"Invalid keys argument; null or array expected\");\n }\n \n // if selection has been cleared, or if this is transient\n // selection, delete the \"selection traces\"\n var nNewTraces = this.gd.data.length - this.origData.length;\n if (keys === null || !this.highlight.persistent && nNewTraces > 0) {\n var tracesToRemove = [];\n for (var i = 0; i < this.gd.data.length; i++) {\n if (this.gd.data[i]._isCrosstalkTrace) tracesToRemove.push(i);\n }\n Plotly.deleteTraces(this.gd, tracesToRemove);\n this.groupSelections[group] = keys;\n } else {\n // add to the groupSelection, rather than overwriting it\n // TODO: can this be removed?\n this.groupSelections[group] = this.groupSelections[group] || [];\n for (var i = 0; i < keys.length; i++) {\n var k = keys[i];\n if (this.groupSelections[group].indexOf(k) < 0) {\n this.groupSelections[group].push(k);\n }\n }\n }\n \n if (keys === null) {\n \n Plotly.restyle(this.gd, {\"opacity\": this.origOpacity});\n \n } else if (keys.length >= 1) {\n \n // placeholder for new \"selection traces\"\n var traces = [];\n // this variable is set in R/highlight.R\n var selectionColour = crosstalk.group(group).var(\"plotlySelectionColour\").get() || \n this.highlight.color[0];\n\n for (var i = 0; i < this.origData.length; i++) {\n // TODO: try using Lib.extendFlat() as done in \n // https://github.com/plotly/plotly.js/pull/1136 \n var trace = JSON.parse(JSON.stringify(this.gd.data[i]));\n if (!trace.key || trace.set !== group) {\n continue;\n }\n // Get sorted array of matching indices in trace.key\n var matchFunc = getMatchFunc(trace);\n var matches = matchFunc(trace.key, keys);\n \n if (matches.length > 0) {\n // If this is a \"simple\" key, that means select the entire trace\n if (!trace._isSimpleKey) {\n trace = subsetArrayAttrs(trace, matches);\n }\n // reach into the full trace object so we can properly reflect the \n // selection attributes in every view\n var d = this.gd._fullData[i];\n \n /* \n / Recursively inherit selection attributes from various sources, \n / in order of preference:\n / (1) official plotly.js selected attribute\n / (2) highlight(selected = attrs_selected(...))\n */\n // TODO: it would be neat to have a dropdown to dynamically specify these!\n $.extend(true, trace, this.highlight.selected);\n \n // if it is defined, override color with the \"dynamic brush color\"\"\n if (d.marker) {\n trace.marker = trace.marker || {};\n trace.marker.color = selectionColour || trace.marker.color || d.marker.color;\n }\n if (d.line) {\n trace.line = trace.line || {};\n trace.line.color = selectionColour || trace.line.color || d.line.color;\n }\n if (d.textfont) {\n trace.textfont = trace.textfont || {};\n trace.textfont.color = selectionColour || trace.textfont.color || d.textfont.color;\n }\n if (d.fillcolor) {\n // TODO: should selectionColour inherit alpha from the existing fillcolor?\n trace.fillcolor = selectionColour || trace.fillcolor || d.fillcolor;\n }\n // attach a sensible name/legendgroup\n trace.name = trace.name || keys.join(\"
\");\n trace.legendgroup = trace.legendgroup || keys.join(\"
\");\n \n // keep track of mapping between this new trace and the trace it targets\n // (necessary for updating frames to reflect the selection traces)\n trace._originalIndex = i;\n trace._newIndex = this.gd._fullData.length + traces.length;\n trace._isCrosstalkTrace = true;\n traces.push(trace);\n }\n }\n \n if (traces.length > 0) {\n \n Plotly.addTraces(this.gd, traces).then(function(gd) {\n // incrementally add selection traces to frames\n // (this is heavily inspired by Plotly.Plots.modifyFrames() \n // in src/plots/plots.js)\n var _hash = gd._transitionData._frameHash;\n var _frames = gd._transitionData._frames || [];\n \n for (var i = 0; i < _frames.length; i++) {\n \n // add to _frames[i].traces *if* this frame references selected trace(s)\n var newIndices = [];\n for (var j = 0; j < traces.length; j++) {\n var tr = traces[j];\n if (_frames[i].traces.indexOf(tr._originalIndex) > -1) {\n newIndices.push(tr._newIndex);\n _frames[i].traces.push(tr._newIndex);\n }\n }\n \n // nothing to do...\n if (newIndices.length === 0) {\n continue;\n }\n \n var ctr = 0;\n var nFrameTraces = _frames[i].data.length;\n \n for (var j = 0; j < nFrameTraces; j++) {\n var frameTrace = _frames[i].data[j];\n if (!frameTrace.key || frameTrace.set !== group) {\n continue;\n }\n \n var matchFunc = getMatchFunc(frameTrace);\n var matches = matchFunc(frameTrace.key, keys);\n \n if (matches.length > 0) {\n if (!trace._isSimpleKey) {\n frameTrace = subsetArrayAttrs(frameTrace, matches);\n }\n var d = gd._fullData[newIndices[ctr]];\n if (d.marker) {\n frameTrace.marker = d.marker;\n }\n if (d.line) {\n frameTrace.line = d.line;\n }\n if (d.textfont) {\n frameTrace.textfont = d.textfont;\n }\n ctr = ctr + 1;\n _frames[i].data.push(frameTrace);\n }\n }\n \n // update gd._transitionData._frameHash\n _hash[_frames[i].name] = _frames[i];\n }\n \n });\n \n // dim traces that have a set matching the set of selection sets\n var tracesToDim = [],\n opacities = [],\n sets = Object.keys(this.groupSelections),\n n = this.origData.length;\n \n for (var i = 0; i < n; i++) {\n var opacity = this.origOpacity[i] || 1;\n // have we already dimmed this trace? Or is this even worth doing?\n if (opacity !== this.gd._fullData[i].opacity || this.highlight.opacityDim === 1) {\n continue;\n }\n // is this set an element of the set of selection sets?\n var matches = findMatches(sets, [this.gd.data[i].set]);\n if (matches.length) {\n tracesToDim.push(i);\n opacities.push(opacity * this.highlight.opacityDim);\n }\n }\n \n if (tracesToDim.length > 0) {\n Plotly.restyle(this.gd, {\"opacity\": opacities}, tracesToDim);\n // turn off the selected/unselected API\n Plotly.restyle(this.gd, {\"selectedpoints\": null});\n }\n \n }\n \n }\n};\n\n/* \nNote: in all of these match functions, we assume needleSet (i.e. the selected keys)\nis a 1D (or flat) array. The real difference is the meaning of haystack.\nfindMatches() does the usual thing you'd expect for \nlinked brushing on a scatterplot matrix. findSimpleMatches() returns a match iff \nhaystack is a subset of the needleSet. findNestedMatches() returns \n*/\n\nfunction getMatchFunc(trace) {\n return (trace._isNestedKey) ? findNestedMatches : \n (trace._isSimpleKey) ? findSimpleMatches : findMatches;\n}\n\n// find matches for \"flat\" keys\nfunction findMatches(haystack, needleSet) {\n var matches = [];\n haystack.forEach(function(obj, i) {\n if (obj === null || needleSet.indexOf(obj) >= 0) {\n matches.push(i);\n }\n });\n return matches;\n}\n\n// find matches for \"simple\" keys\nfunction findSimpleMatches(haystack, needleSet) {\n var match = haystack.every(function(val) {\n return val === null || needleSet.indexOf(val) >= 0;\n });\n // yes, this doesn't make much sense other than conforming \n // to the output type of the other match functions\n return (match) ? [0] : []\n}\n\n// find matches for a \"nested\" haystack (2D arrays)\nfunction findNestedMatches(haystack, needleSet) {\n var matches = [];\n for (var i = 0; i < haystack.length; i++) {\n var hay = haystack[i];\n var match = hay.every(function(val) { \n return val === null || needleSet.indexOf(val) >= 0; \n });\n if (match) {\n matches.push(i);\n }\n }\n return matches;\n}\n\nfunction isPlainObject(obj) {\n return (\n Object.prototype.toString.call(obj) === '[object Object]' &&\n Object.getPrototypeOf(obj) === Object.prototype\n );\n}\n\nfunction inIframe() {\n return window && window.self !== window.top;\n}\n\nfunction subsetArrayAttrs(obj, indices) {\n var newObj = {};\n Object.keys(obj).forEach(function(k) {\n var val = obj[k];\n\n if (k.charAt(0) === \"_\") {\n newObj[k] = val;\n } else if (k === \"transforms\" && Array.isArray(val)) {\n newObj[k] = val.map(function(transform) {\n return subsetArrayAttrs(transform, indices);\n });\n } else if (k === \"colorscale\" && Array.isArray(val)) {\n newObj[k] = val;\n } else if (isPlainObject(val)) {\n newObj[k] = subsetArrayAttrs(val, indices);\n } else if (Array.isArray(val)) {\n newObj[k] = subsetArray(val, indices);\n } else {\n newObj[k] = val;\n }\n });\n return newObj;\n}\n\nfunction subsetArray(arr, indices) {\n var result = [];\n for (var i = 0; i < indices.length; i++) {\n result.push(arr[indices[i]]);\n }\n return result;\n}\n\n// Convenience function for removing plotly's brush \nfunction removeBrush(el) {\n var outlines = el.querySelectorAll(\".select-outline\");\n for (var i = 0; i < outlines.length; i++) {\n outlines[i].remove();\n }\n}\n\n\n// https://davidwalsh.name/javascript-debounce-function\n\n// Returns a function, that, as long as it continues to be invoked, will not\n// be triggered. The function will be called after it stops being called for\n// N milliseconds. If `immediate` is passed, trigger the function on the\n// leading edge, instead of the trailing.\nfunction debounce(func, wait, immediate) {\n var timeout;\n return function() {\n var context = this, args = arguments;\n var later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n};\n\nmodule.exports = widgetDefinition"]} \ No newline at end of file +{"version":3,"sources":["node_modules/browser-pack/_prelude.js","theSrc/scripts/plotly.js","theSrc/scripts/widgetdefinition.js"],"names":["r","e","n","t","o","i","f","c","require","u","a","Error","code","p","exports","call","length","1","module","_widgetdefinition","HTMLWidgets","widget","_widgetdefinition2","default","widgetDefinition","name","type","initialize","el","width","height","resize","instance","autosize","Plotly","relayout","renderValue","x","lay","layout","crosstalk","var","set","highlight","window","PLOTLYENV","BASE_URL","base_url","persistent","onmousemove","event","shiftKey","persistentShift","graphDiv","document","getElementById","id","setAttribute","addPostRenderHandler","modebars","querySelectorAll","style","zIndex","selectize","dynamic","plotly","pickerDiv","flex","createElement","class","pickerInput","placeholder","pickerLabel","for","innerHTML","appendChild","ids","Object","keys","container","label","group","selectDiv","select","multiple","parentElement","insertBefore","picker","$","colors","color","opts","value","showColour","palette","allowedCols","join","colourpicker","changeDelay","grps","ctGroups","on","eventDataWithKey","eventData","undefined","hasOwnProperty","points","map","pt","obj","curveNumber","pointNumber","y","z","customdata","attrsToAttach","trace","data","_isSimpleKey","key","attr","Array","isArray","pointNumbers","idx","purge","plot","catch","then","shinyMode","Shiny","addCustomMessageHandler","msg","gd","method","args","concat","apply","react","mapboxIDs","_fullLayout","_subplots","mapbox","_fitBounds","_subplot","fitBounds","bounds","options","eventClearMap","eventDataFunctionMap","legendEventData","d","legendgroup","legendgrps","traces","push","setInputValue","plotly_deselect","plotly_unhover","plotly_doubleclick","evt","input","source","priority","plotly_click","plotly_sunburstclick","plotly_hover","plotly_selected","plotly_selecting","plotly_brushed","range","lassoPoints","plotly_brushing","plotly_legendclick","plotly_legenddoubleclick","plotly_clickannotation","fullAnnotation","shinyEvents","eventDataPreProcessor","JSON","stringify","traceManager","TraceManager","allSets","curveIdx","newSet","indexOf","selection","SelectionHandle","FilterHandle","removeBrush","updateFilter","prototype","diff","this","filter","oldValue","selectionHistory","get","receiverID","plotlySelectionColour","ev","updateSelection","clear","addItems","close","selectizeID","turnOn","selectedKeys","keysBySet","keyFlat","ptNum","_isNestedKey","pointsToKeys","sender","debounce","func","wait","immediate","timeout","context","arguments","callNow","clearTimeout","setTimeout","off","items","searchField","valueField","labelField","maxItems","find","currentItems","groupSelections","removeItem","newItems","origData","parse","origOpacity","opacity","getMatchFunc","findNestedMatches","findSimpleMatches","findMatches","haystack","needleSet","matches","forEach","every","val","subsetArrayAttrs","indices","newObj","k","charAt","transform","toString","getPrototypeOf","arr","result","subsetArray","outlines","remove","matchFunc","redraw","nNewTraces","tracesToRemove","_isCrosstalkTrace","deleteTraces","restyle","selectionColour","_fullData","extend","selected","marker","line","textfont","fillcolor","_originalIndex","_newIndex","addTraces","_hash","_transitionData","_frameHash","_frames","newIndices","j","tr","ctr","nFrameTraces","frameTrace","tracesToDim","opacities","sets","opacityDim","selectedpoints"],"mappings":"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","file":"plotly.js","sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i 0) {\n var ev = JSON.stringify(event);\n for (var i = 0; i < selectionHistory.length; i++) {\n var sel = JSON.stringify(selectionHistory[i]);\n if (sel == ev) {\n return;\n }\n }\n }\n \n // accumulate history for persistent selection\n if (!x.highlight.persistent) {\n selectionHistory = [event];\n } else {\n selectionHistory.push(event);\n }\n crosstalk.var(\"plotlySelectionHistory\").set(selectionHistory);\n \n // do the actual updating of traces, frames, and the selectize widget\n traceManager.updateSelection(set, e.value);\n // https://github.com/selectize/selectize.js/blob/master/docs/api.md#methods_items\n if (x.selectize) {\n if (!x.highlight.persistent || e.value === null) {\n selectize.clear(true);\n }\n selectize.addItems(e.value, true);\n selectize.close();\n }\n }\n selection.on(\"change\", selectionChange);\n \n // Set a crosstalk variable selection value, triggering an update\n var turnOn = function(e) {\n if (e) {\n var selectedKeys = pointsToKeys(e.points);\n // Keys are group names, values are array of selected keys from group.\n for (var set in selectedKeys) {\n if (selectedKeys.hasOwnProperty(set)) {\n selection.set(selectedKeys[set].value, {sender: el});\n }\n }\n }\n };\n if (x.highlight.debounce > 0) {\n turnOn = debounce(turnOn, x.highlight.debounce);\n }\n graphDiv.on(x.highlight.on, turnOn);\n \n graphDiv.on(x.highlight.off, function turnOff(e) {\n // remove any visual clues\n removeBrush(el);\n // remove any selection history\n crosstalk.var(\"plotlySelectionHistory\").set(null);\n // trigger the actual removal of selection traces\n selection.set(null, {sender: el});\n });\n \n // register a callback for selectize so that there is bi-directional\n // communication between the widget and direct manipulation events\n if (x.selectize) {\n var selectizeID = Object.keys(x.selectize)[i];\n var items = x.selectize[selectizeID].items;\n var first = [{value: \"\", label: \"(All)\"}];\n var opts = {\n options: first.concat(items),\n searchField: \"label\",\n valueField: \"value\",\n labelField: \"label\",\n maxItems: 50\n };\n var select = $(\"#\" + selectizeID).find(\"select\")[0];\n var selectize = $(select).selectize(opts)[0].selectize;\n // NOTE: this callback is triggered when *directly* altering \n // dropdown items\n selectize.on(\"change\", function() {\n var currentItems = traceManager.groupSelections[set] || [];\n if (!x.highlight.persistent) {\n removeBrush(el);\n for (var i = 0; i < currentItems.length; i++) {\n selectize.removeItem(currentItems[i], true);\n }\n }\n var newItems = selectize.items.filter(function(idx) { \n return currentItems.indexOf(idx) < 0;\n });\n if (newItems.length > 0) {\n traceManager.updateSelection(set, newItems);\n } else {\n // Item has been removed...\n // TODO: this logic won't work for dynamically changing palette \n traceManager.updateSelection(set, null);\n traceManager.updateSelection(set, selectize.items);\n }\n });\n }\n } // end of selectionChange\n\n graphDiv.on(\"plotly_afterplot\", function() {\n // Used by Displayr to determine when widget is ready to be snapshot for testing\n graphDiv.setAttribute(\"rhtmlwidget-status\", \"ready\");\n });\n } // end of renderValue\n}\n\n/**\n * @param graphDiv The Plotly graph div\n * @param highlight An object with options for updating selection(s)\n */\nfunction TraceManager(graphDiv, highlight) {\n // The Plotly graph div\n this.gd = graphDiv;\n\n // Preserve the original data.\n // TODO: try using Lib.extendFlat() as done in \n // https://github.com/plotly/plotly.js/pull/1136 \n this.origData = JSON.parse(JSON.stringify(graphDiv.data));\n \n // avoid doing this over and over\n this.origOpacity = [];\n for (var i = 0; i < this.origData.length; i++) {\n this.origOpacity[i] = this.origData[i].opacity === 0 ? 0 : (this.origData[i].opacity || 1);\n }\n\n // key: group name, value: null or array of keys representing the\n // most recently received selection for that group.\n this.groupSelections = {};\n \n // selection parameters (e.g., transient versus persistent selection)\n this.highlight = highlight;\n}\n\nTraceManager.prototype.close = function() {\n // TODO: Unhook all event handlers\n};\n\nTraceManager.prototype.updateFilter = function(group, keys) {\n\n if (typeof(keys) === \"undefined\" || keys === null) {\n \n this.gd.data = JSON.parse(JSON.stringify(this.origData));\n \n } else {\n \n var traces = [];\n for (var i = 0; i < this.origData.length; i++) {\n var trace = this.origData[i];\n if (!trace.key || trace.set !== group) {\n continue;\n }\n var matchFunc = getMatchFunc(trace);\n var matches = matchFunc(trace.key, keys);\n \n if (matches.length > 0) {\n if (!trace._isSimpleKey) {\n // subsetArrayAttrs doesn't mutate trace (it makes a modified clone)\n trace = subsetArrayAttrs(trace, matches);\n }\n traces.push(trace);\n }\n }\n }\n \n this.gd.data = traces;\n Plotly.redraw(this.gd);\n \n // NOTE: we purposely do _not_ restore selection(s), since on filter,\n // axis likely will update, changing the pixel -> data mapping, leading \n // to a likely mismatch in the brush outline and highlighted marks\n \n};\n\nTraceManager.prototype.updateSelection = function(group, keys) {\n \n if (keys !== null && !Array.isArray(keys)) {\n throw new Error(\"Invalid keys argument; null or array expected\");\n }\n \n // if selection has been cleared, or if this is transient\n // selection, delete the \"selection traces\"\n var nNewTraces = this.gd.data.length - this.origData.length;\n if (keys === null || !this.highlight.persistent && nNewTraces > 0) {\n var tracesToRemove = [];\n for (var i = 0; i < this.gd.data.length; i++) {\n if (this.gd.data[i]._isCrosstalkTrace) tracesToRemove.push(i);\n }\n Plotly.deleteTraces(this.gd, tracesToRemove);\n this.groupSelections[group] = keys;\n } else {\n // add to the groupSelection, rather than overwriting it\n // TODO: can this be removed?\n this.groupSelections[group] = this.groupSelections[group] || [];\n for (var i = 0; i < keys.length; i++) {\n var k = keys[i];\n if (this.groupSelections[group].indexOf(k) < 0) {\n this.groupSelections[group].push(k);\n }\n }\n }\n \n if (keys === null) {\n \n Plotly.restyle(this.gd, {\"opacity\": this.origOpacity});\n \n } else if (keys.length >= 1) {\n \n // placeholder for new \"selection traces\"\n var traces = [];\n // this variable is set in R/highlight.R\n var selectionColour = crosstalk.group(group).var(\"plotlySelectionColour\").get() || \n this.highlight.color[0];\n\n for (var i = 0; i < this.origData.length; i++) {\n // TODO: try using Lib.extendFlat() as done in \n // https://github.com/plotly/plotly.js/pull/1136 \n var trace = JSON.parse(JSON.stringify(this.gd.data[i]));\n if (!trace.key || trace.set !== group) {\n continue;\n }\n // Get sorted array of matching indices in trace.key\n var matchFunc = getMatchFunc(trace);\n var matches = matchFunc(trace.key, keys);\n \n if (matches.length > 0) {\n // If this is a \"simple\" key, that means select the entire trace\n if (!trace._isSimpleKey) {\n trace = subsetArrayAttrs(trace, matches);\n }\n // reach into the full trace object so we can properly reflect the \n // selection attributes in every view\n var d = this.gd._fullData[i];\n \n /* \n / Recursively inherit selection attributes from various sources, \n / in order of preference:\n / (1) official plotly.js selected attribute\n / (2) highlight(selected = attrs_selected(...))\n */\n // TODO: it would be neat to have a dropdown to dynamically specify these!\n $.extend(true, trace, this.highlight.selected);\n \n // if it is defined, override color with the \"dynamic brush color\"\"\n if (d.marker) {\n trace.marker = trace.marker || {};\n trace.marker.color = selectionColour || trace.marker.color || d.marker.color;\n }\n if (d.line) {\n trace.line = trace.line || {};\n trace.line.color = selectionColour || trace.line.color || d.line.color;\n }\n if (d.textfont) {\n trace.textfont = trace.textfont || {};\n trace.textfont.color = selectionColour || trace.textfont.color || d.textfont.color;\n }\n if (d.fillcolor) {\n // TODO: should selectionColour inherit alpha from the existing fillcolor?\n trace.fillcolor = selectionColour || trace.fillcolor || d.fillcolor;\n }\n // attach a sensible name/legendgroup\n trace.name = trace.name || keys.join(\"
\");\n trace.legendgroup = trace.legendgroup || keys.join(\"
\");\n \n // keep track of mapping between this new trace and the trace it targets\n // (necessary for updating frames to reflect the selection traces)\n trace._originalIndex = i;\n trace._newIndex = this.gd._fullData.length + traces.length;\n trace._isCrosstalkTrace = true;\n traces.push(trace);\n }\n }\n \n if (traces.length > 0) {\n \n Plotly.addTraces(this.gd, traces).then(function(gd) {\n // incrementally add selection traces to frames\n // (this is heavily inspired by Plotly.Plots.modifyFrames() \n // in src/plots/plots.js)\n var _hash = gd._transitionData._frameHash;\n var _frames = gd._transitionData._frames || [];\n \n for (var i = 0; i < _frames.length; i++) {\n \n // add to _frames[i].traces *if* this frame references selected trace(s)\n var newIndices = [];\n for (var j = 0; j < traces.length; j++) {\n var tr = traces[j];\n if (_frames[i].traces.indexOf(tr._originalIndex) > -1) {\n newIndices.push(tr._newIndex);\n _frames[i].traces.push(tr._newIndex);\n }\n }\n \n // nothing to do...\n if (newIndices.length === 0) {\n continue;\n }\n \n var ctr = 0;\n var nFrameTraces = _frames[i].data.length;\n \n for (var j = 0; j < nFrameTraces; j++) {\n var frameTrace = _frames[i].data[j];\n if (!frameTrace.key || frameTrace.set !== group) {\n continue;\n }\n \n var matchFunc = getMatchFunc(frameTrace);\n var matches = matchFunc(frameTrace.key, keys);\n \n if (matches.length > 0) {\n if (!trace._isSimpleKey) {\n frameTrace = subsetArrayAttrs(frameTrace, matches);\n }\n var d = gd._fullData[newIndices[ctr]];\n if (d.marker) {\n frameTrace.marker = d.marker;\n }\n if (d.line) {\n frameTrace.line = d.line;\n }\n if (d.textfont) {\n frameTrace.textfont = d.textfont;\n }\n ctr = ctr + 1;\n _frames[i].data.push(frameTrace);\n }\n }\n \n // update gd._transitionData._frameHash\n _hash[_frames[i].name] = _frames[i];\n }\n \n });\n \n // dim traces that have a set matching the set of selection sets\n var tracesToDim = [],\n opacities = [],\n sets = Object.keys(this.groupSelections),\n n = this.origData.length;\n \n for (var i = 0; i < n; i++) {\n var opacity = this.origOpacity[i] || 1;\n // have we already dimmed this trace? Or is this even worth doing?\n if (opacity !== this.gd._fullData[i].opacity || this.highlight.opacityDim === 1) {\n continue;\n }\n // is this set an element of the set of selection sets?\n var matches = findMatches(sets, [this.gd.data[i].set]);\n if (matches.length) {\n tracesToDim.push(i);\n opacities.push(opacity * this.highlight.opacityDim);\n }\n }\n \n if (tracesToDim.length > 0) {\n Plotly.restyle(this.gd, {\"opacity\": opacities}, tracesToDim);\n // turn off the selected/unselected API\n Plotly.restyle(this.gd, {\"selectedpoints\": null});\n }\n \n }\n \n }\n};\n\n/* \nNote: in all of these match functions, we assume needleSet (i.e. the selected keys)\nis a 1D (or flat) array. The real difference is the meaning of haystack.\nfindMatches() does the usual thing you'd expect for \nlinked brushing on a scatterplot matrix. findSimpleMatches() returns a match iff \nhaystack is a subset of the needleSet. findNestedMatches() returns \n*/\n\nfunction getMatchFunc(trace) {\n return (trace._isNestedKey) ? findNestedMatches : \n (trace._isSimpleKey) ? findSimpleMatches : findMatches;\n}\n\n// find matches for \"flat\" keys\nfunction findMatches(haystack, needleSet) {\n var matches = [];\n haystack.forEach(function(obj, i) {\n if (obj === null || needleSet.indexOf(obj) >= 0) {\n matches.push(i);\n }\n });\n return matches;\n}\n\n// find matches for \"simple\" keys\nfunction findSimpleMatches(haystack, needleSet) {\n var match = haystack.every(function(val) {\n return val === null || needleSet.indexOf(val) >= 0;\n });\n // yes, this doesn't make much sense other than conforming \n // to the output type of the other match functions\n return (match) ? [0] : []\n}\n\n// find matches for a \"nested\" haystack (2D arrays)\nfunction findNestedMatches(haystack, needleSet) {\n var matches = [];\n for (var i = 0; i < haystack.length; i++) {\n var hay = haystack[i];\n var match = hay.every(function(val) { \n return val === null || needleSet.indexOf(val) >= 0; \n });\n if (match) {\n matches.push(i);\n }\n }\n return matches;\n}\n\nfunction isPlainObject(obj) {\n return (\n Object.prototype.toString.call(obj) === '[object Object]' &&\n Object.getPrototypeOf(obj) === Object.prototype\n );\n}\n\nfunction subsetArrayAttrs(obj, indices) {\n var newObj = {};\n Object.keys(obj).forEach(function(k) {\n var val = obj[k];\n\n if (k.charAt(0) === \"_\") {\n newObj[k] = val;\n } else if (k === \"transforms\" && Array.isArray(val)) {\n newObj[k] = val.map(function(transform) {\n return subsetArrayAttrs(transform, indices);\n });\n } else if (k === \"colorscale\" && Array.isArray(val)) {\n newObj[k] = val;\n } else if (isPlainObject(val)) {\n newObj[k] = subsetArrayAttrs(val, indices);\n } else if (Array.isArray(val)) {\n newObj[k] = subsetArray(val, indices);\n } else {\n newObj[k] = val;\n }\n });\n return newObj;\n}\n\nfunction subsetArray(arr, indices) {\n var result = [];\n for (var i = 0; i < indices.length; i++) {\n result.push(arr[indices[i]]);\n }\n return result;\n}\n\n// Convenience function for removing plotly's brush \nfunction removeBrush(el) {\n var outlines = el.querySelectorAll(\".select-outline\");\n for (var i = 0; i < outlines.length; i++) {\n outlines[i].remove();\n }\n}\n\n\n// https://davidwalsh.name/javascript-debounce-function\n\n// Returns a function, that, as long as it continues to be invoked, will not\n// be triggered. The function will be called after it stops being called for\n// N milliseconds. If `immediate` is passed, trigger the function on the\n// leading edge, instead of the trailing.\nfunction debounce(func, wait, immediate) {\n\tvar timeout;\n\treturn function() {\n\t\tvar context = this, args = arguments;\n\t\tvar later = function() {\n\t\t\ttimeout = null;\n\t\t\tif (!immediate) func.apply(context, args);\n\t\t};\n\t\tvar callNow = immediate && !timeout;\n\t\tclearTimeout(timeout);\n\t\ttimeout = setTimeout(later, wait);\n\t\tif (callNow) func.apply(context, args);\n\t};\n};\n\nmodule.exports = widgetDefinition"]} \ No newline at end of file diff --git a/man/TeX.Rd b/man/TeX.Rd index 38b454b6d6..e0ce9772fa 100644 --- a/man/TeX.Rd +++ b/man/TeX.Rd @@ -16,10 +16,12 @@ ensures the provided string is surrounded with \code{$} (this is what plotly.js uses to declare a string as TeX). } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} plot_ly(x = c(1, 2, 3, 4), y = c(1, 4, 9, 16)) \%>\% layout(title = TeX("\\\\text{Some mathjax: }\\\\alpha+\\\\beta x")) \%>\% config(mathjax = "cdn") +\dontshow{\}) # examplesIf} } \seealso{ \link{config} diff --git a/man/add_data.Rd b/man/add_data.Rd index 8e496f37b0..892695cd8a 100644 --- a/man/add_data.Rd +++ b/man/add_data.Rd @@ -15,6 +15,8 @@ add_data(p, data = NULL) Add data to a plotly visualization } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} plot_ly() \%>\% add_data(economics) \%>\% add_trace(x = ~date, y = ~pce) +\dontshow{\}) # examplesIf} } diff --git a/man/add_trace.Rd b/man/add_trace.Rd index 935d79104f..5c36652c78 100644 --- a/man/add_trace.Rd +++ b/man/add_trace.Rd @@ -165,6 +165,7 @@ If \code{z} is a raster object (see \code{\link[=as.raster]{as.raster()}}), the Add trace(s) to a plotly visualization } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # the `plot_ly()` function initiates an object, and if no trace type # is specified, it sets a sensible default @@ -270,7 +271,7 @@ plot_ly(z = ~volcano) \%>\% plot_ly(x = c(0, 0, 1), y = c(0, 1, 0), z = c(0, 0, 0)) \%>\% add_mesh() } - +\dontshow{\}) # examplesIf} } \references{ \url{https://plotly-r.com/overview.html} diff --git a/man/animation.Rd b/man/animation.Rd index baaea3cb2e..b0b9c9abf7 100644 --- a/man/animation.Rd +++ b/man/animation.Rd @@ -65,6 +65,7 @@ Both the play button and slider component transition between frames according rules specified by \code{\link[=animation_opts]{animation_opts()}}. } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} df <- data.frame( x = c(1, 2, 2, 1, 1, 2), @@ -94,7 +95,7 @@ if (interactive()) { #' # for more, see https://plotly.com/r/animating-views.html - +\dontshow{\}) # examplesIf} } \author{ Carson Sievert diff --git a/man/api.Rd b/man/api.Rd index e17414db4b..6cd01dfb4a 100644 --- a/man/api.Rd +++ b/man/api.Rd @@ -92,6 +92,7 @@ plotly objects via \code{api_download_plot()}/\code{api_download_grid()}. For anything else, use \code{api()}. } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \dontrun{ @@ -152,7 +153,7 @@ api("files/cpsievert:14681/copy", "POST") api("folders", "POST", list(path = "/starts/at/root/and/ends/here")) } - +\dontshow{\}) # examplesIf} } \references{ \url{https://api.plot.ly/v2} diff --git a/man/as_widget.Rd b/man/as_widget.Rd index ec17ef2d82..61714c5281 100644 --- a/man/as_widget.Rd +++ b/man/as_widget.Rd @@ -15,9 +15,10 @@ as_widget(x, ...) Convert a list to a plotly htmlwidget object } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} trace <- list(x = 1, y = 1) obj <- list(data = list(trace), layout = list(title = "my plot")) as_widget(obj) - +\dontshow{\}) # examplesIf} } diff --git a/man/colorbar.Rd b/man/colorbar.Rd index c090b03a45..a2f7d53f51 100644 --- a/man/colorbar.Rd +++ b/man/colorbar.Rd @@ -21,6 +21,7 @@ multiple colorbars.} Modify the colorbar } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} p <- plot_ly(mtcars, x = ~wt, y = ~mpg, color = ~cyl) @@ -38,6 +39,7 @@ corr <- cor(diamonds[vapply(diamonds, is.numeric, logical(1))]) plot_ly(x = rownames(corr), y = colnames(corr), z = corr) \%>\% add_heatmap() \%>\% colorbar(limits = c(-1, 1)) +\dontshow{\}) # examplesIf} } \author{ Carson Sievert diff --git a/man/config.Rd b/man/config.Rd index fc9083bd9e..e3ac82959f 100644 --- a/man/config.Rd +++ b/man/config.Rd @@ -40,6 +40,7 @@ for an \strong{rmarkdown} example and Set the default configuration for plotly } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # remove the plotly logo and collaborate button from modebar config(plot_ly(), displaylogo = FALSE, collaborate = FALSE) @@ -65,7 +66,7 @@ config(p, locale = "de") config(p, locale = "es") # chinese config(p, locale = "zh-CN") - +\dontshow{\}) # examplesIf} } \author{ Carson Sievert diff --git a/man/export.Rd b/man/export.Rd index b8fb536213..fa9cf5c8ee 100644 --- a/man/export.Rd +++ b/man/export.Rd @@ -21,7 +21,7 @@ jpeg/png/pdf arguments are passed along to \code{webshot::webshot()}. Otherwise, they are ignored.} } \description{ -This function is in the process of being deprecated (use \link{orca} instead). +This function is deprecated, use \link{save_image} instead. } \details{ For SVG plots, a screenshot is taken via \code{webshot::webshot()}. diff --git a/man/group2NA.Rd b/man/group2NA.Rd index 792ad9334f..ac2ffb658f 100644 --- a/man/group2NA.Rd +++ b/man/group2NA.Rd @@ -45,6 +45,7 @@ In this case, one should also take care to make sure is set to \code{FALSE}. } \examples{ +\dontshow{if (interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # note the insertion of new rows with missing values group2NA(mtcars, "vs", "cyl") @@ -59,5 +60,5 @@ plot_ly(tx, x = ~date, y = ~median) \%>\% add_lines() # add_lines() will ensure paths are sorted by x, but this is equivalent tx <- group2NA(txhousing, "city", ordered = "date") plot_ly(tx, x = ~date, y = ~median) \%>\% add_paths() - +\dontshow{\}) # examplesIf} } diff --git a/man/hide_colorbar.Rd b/man/hide_colorbar.Rd index 1ac269c475..39432261ff 100644 --- a/man/hide_colorbar.Rd +++ b/man/hide_colorbar.Rd @@ -13,10 +13,12 @@ hide_colorbar(p) Hide color bar(s) } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} p <- plot_ly(mtcars, x = ~wt, y = ~cyl, color = ~cyl) hide_colorbar(p) +\dontshow{\}) # examplesIf} } \seealso{ \code{\link[=hide_legend]{hide_legend()}} diff --git a/man/hide_legend.Rd b/man/hide_legend.Rd index e9e699e8e0..62b3fe6169 100644 --- a/man/hide_legend.Rd +++ b/man/hide_legend.Rd @@ -13,9 +13,11 @@ hide_legend(p) Hide legend } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} p <- plot_ly(mtcars, x = ~wt, y = ~cyl, color = ~factor(cyl)) hide_legend(p) +\dontshow{\}) # examplesIf} } \seealso{ \code{\link[=hide_colorbar]{hide_colorbar()}} diff --git a/man/highlight.Rd b/man/highlight.Rd index f10ecd337c..35f36f9807 100644 --- a/man/highlight.Rd +++ b/man/highlight.Rd @@ -55,8 +55,10 @@ highlighting selections. See \code{\link[=toRGB]{toRGB()}} for valid color specifications. If \code{NULL} (the default), the color of selected marks are not altered.} -\item{selectize}{provide a selectize.js widget for selecting keys? Note that -the label used for this widget derives from the groupName of the SharedData object.} +\item{selectize}{whether or not to render a selectize.js widget for selecting +\code{\link[=highlight_key]{highlight_key()}} values. A list of additional selectize.js options may +also be provided. The label used for this widget should be set via the +\code{groupName} argument of \code{\link[=highlight_key]{highlight_key()}}.} \item{defaultValues}{a vector of values for setting a "default selection". These values should match the key attribute.} @@ -82,6 +84,7 @@ other htmlwidgets will respect these options, such as persistent selection in leaflet (see \code{demo("highlight-leaflet", package = "plotly")}). } \examples{ +\dontshow{if (interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # These examples are designed to show you how to highlight/brush a *single* # view. For examples of multiple linked views, see `demo(package = "plotly")` @@ -104,7 +107,7 @@ s <- attrs_selected( ) highlight(layout(gg, showlegend = TRUE), selected = s) - +\dontshow{\}) # examplesIf} } \references{ \url{https://plotly-r.com/client-side-linking.html} diff --git a/man/orca.Rd b/man/orca.Rd index ccfcd1c86c..efd96093d2 100644 --- a/man/orca.Rd +++ b/man/orca.Rd @@ -80,7 +80,7 @@ for specifying display and/or electron options, such as \code{--enable-webgl} or \item{quiet}{Suppress all logging info.} } \description{ -Superseded by \code{\link[=kaleido]{kaleido()}}. +This function is deprecated, use \code{\link[=save_image]{save_image()}} instead. } \section{Methods}{ @@ -107,6 +107,7 @@ The \code{orca_serve()} function returns an object with two fields: } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \dontrun{ # NOTE: in a headless environment, you may need to set `more_args="--enable-webgl"` @@ -132,7 +133,7 @@ server$close() unlink("test1.pdf") unlink("test2.pdf") } - +\dontshow{\}) # examplesIf} } \author{ Carson Sievert diff --git a/man/partial_bundle.Rd b/man/partial_bundle.Rd index 8335890a6d..1dd56819c9 100644 --- a/man/partial_bundle.Rd +++ b/man/partial_bundle.Rd @@ -31,6 +31,7 @@ bundles are used, the most recent bundle will override the other bundles. See the examples section for an example. } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # ---------------------------------------------------------------------- # This function is always safe to use when rendering a single @@ -68,7 +69,7 @@ p2 <- plot_ly(z = ~volcano) \%>\% partial_bundle() browsable(tagList(p1, p2)) } - +\dontshow{\}) # examplesIf} } \author{ Carson Sievert diff --git a/man/plot_dendro.Rd b/man/plot_dendro.Rd index 2e5e1dabf5..2bcee03240 100644 --- a/man/plot_dendro.Rd +++ b/man/plot_dendro.Rd @@ -25,6 +25,7 @@ interactive dendrogram. Selecting a node selects all the labels (i.e. leafs) under that node. } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \dontrun{ hc <- hclust(dist(USArrests), "ave") @@ -33,7 +34,7 @@ plot_dendro(dend1, height = 600) \%>\% hide_legend() \%>\% highlight(persistent = TRUE, dynamic = TRUE) } - +\dontshow{\}) # examplesIf} } \seealso{ \code{\link[=plot_ly]{plot_ly()}}, \code{\link[=plot_mapbox]{plot_mapbox()}}, \code{\link[=ggplotly]{ggplotly()}} diff --git a/man/plot_geo.Rd b/man/plot_geo.Rd index e851ea7e97..b62cfa754b 100644 --- a/man/plot_geo.Rd +++ b/man/plot_geo.Rd @@ -22,12 +22,13 @@ the scattergeo trace type, and enables higher level geometries like \code{\link[=add_polygons]{add_polygons()}} to work } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} map_data("world", "canada") \%>\% group_by(group) \%>\% plot_geo(x = ~long, y = ~lat) \%>\% add_markers(size = I(1)) - +\dontshow{\}) # examplesIf} } \seealso{ \code{\link[=plot_ly]{plot_ly()}}, \code{\link[=plot_mapbox]{plot_mapbox()}}, \code{\link[=ggplotly]{ggplotly()}} diff --git a/man/plot_ly.Rd b/man/plot_ly.Rd index 1154d6728b..b32d197483 100644 --- a/man/plot_ly.Rd +++ b/man/plot_ly.Rd @@ -133,6 +133,7 @@ help inform default axis/scale titles (e.g., \code{plot_ly(x = mtcars$wt)} vs \code{plot_ly(x = ~mtcars$wt)}) } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \dontrun{ # plot_ly() tries to create a sensible plot based on the information you @@ -169,7 +170,7 @@ add_markers(p, symbol = ~species) add_paths(p, linetype = ~species) } - +\dontshow{\}) # examplesIf} } \references{ \url{https://plotly-r.com/overview.html} diff --git a/man/plotly-shiny.Rd b/man/plotly-shiny.Rd index 167a1c9174..bd2faae247 100644 --- a/man/plotly-shiny.Rd +++ b/man/plotly-shiny.Rd @@ -11,7 +11,8 @@ plotlyOutput( width = "100\%", height = "400px", inline = FALSE, - reportTheme = TRUE + reportTheme = TRUE, + fill = !inline ) renderPlotly(expr, env = parent.frame(), quoted = FALSE) @@ -31,6 +32,9 @@ height is computed with HTML/CSS.} \item{reportTheme}{whether or not to report CSS styles (if a sufficient version of shiny and htmlwidgets is available).} +\item{fill}{see \code{\link[htmlwidgets:htmlwidgets-shiny]{htmlwidgets::shinyWidgetOutput()}} for explanation (requires +a recent version of htmlwidgets).} + \item{expr}{An expression that generates a plotly} \item{env}{The environment in which to evaluate \code{expr}.} diff --git a/man/plotlyProxy.Rd b/man/plotlyProxy.Rd index 65709e000f..ce3317ac24 100644 --- a/man/plotlyProxy.Rd +++ b/man/plotlyProxy.Rd @@ -36,11 +36,12 @@ visit \url{https://plotly.com/javascript/plotlyjs-function-reference/}} Modify a plotly object inside a shiny app } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} if (require("shiny") && interactive()) { plotly_example("shiny", "proxy_relayout") plotly_example("shiny", "proxy_mapbox") } - +\dontshow{\}) # examplesIf} } diff --git a/man/plotly_build.Rd b/man/plotly_build.Rd index 2d86e8e96e..01bd27da18 100644 --- a/man/plotly_build.Rd +++ b/man/plotly_build.Rd @@ -18,11 +18,12 @@ provided by \code{ggplotly}/\code{plot_ly} or for debugging rendering errors. } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} p <- plot_ly(economics, x = ~date, y = ~pce) # the unevaluated plotly object str(p) # the evaluated data str(plotly_build(p)$x$data) - +\dontshow{\}) # examplesIf} } diff --git a/man/plotly_data.Rd b/man/plotly_data.Rd index 5ff41e4570..dca16810f8 100644 --- a/man/plotly_data.Rd +++ b/man/plotly_data.Rd @@ -95,6 +95,7 @@ a plotly visualization (if there are multiple data frames, by default, it returns the most recent one). } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # use group_by() to define groups of visual markings p <- txhousing \%>\% @@ -137,5 +138,5 @@ p \%>\% slice(1) \%>\% add_markers(name = "first observation") p \%>\% filter(cyl == 4) \%>\% plotly_data() p \%>\% filter(cyl == 4) \%>\% add_markers(name = "four cylinders") - +\dontshow{\}) # examplesIf} } diff --git a/man/plotly_json.Rd b/man/plotly_json.Rd index 57bdeb7a3b..76031c7fe8 100644 --- a/man/plotly_json.Rd +++ b/man/plotly_json.Rd @@ -21,7 +21,9 @@ This function is useful for obtaining/viewing/debugging JSON sent to plotly.js. } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} plotly_json(plot_ly()) plotly_json(plot_ly(), FALSE) +\dontshow{\}) # examplesIf} } diff --git a/man/rangeslider.Rd b/man/rangeslider.Rd index 24d8d28197..870554ac80 100644 --- a/man/rangeslider.Rd +++ b/man/rangeslider.Rd @@ -20,6 +20,7 @@ rangeslider(p, start = NULL, end = NULL, ...) Add a range slider to the x-axis } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} plot_ly(x = time(USAccDeaths), y = USAccDeaths) \%>\% add_lines() \%>\% @@ -34,7 +35,7 @@ plot_ly(d, x = ~time, y = ~y) \%>\% add_lines() \%>\% rangeslider(d$time[5], d$time[50]) - +\dontshow{\}) # examplesIf} } \author{ Carson Sievert diff --git a/man/raster2uri.Rd b/man/raster2uri.Rd index 02ff6d95b9..fb8e7f6180 100644 --- a/man/raster2uri.Rd +++ b/man/raster2uri.Rd @@ -18,6 +18,7 @@ This is especially convenient for embedding raster images on a plot in a self-contained fashion (i.e., so they don't depend on external URL links). } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # a red gradient (from ?as.raster) r <- as.raster(matrix(hcl(0, 80, seq(50, 80, 10)), nrow = 4, ncol = 5)) @@ -35,6 +36,7 @@ plot_ly(x = 1, y = 1) \%>\% xanchor = "left", yanchor = "bottom" )) ) +\dontshow{\}) # examplesIf} } \references{ \url{https://plotly-r.com/embedding-images.html} diff --git a/man/reexports.Rd b/man/reexports.Rd index 67f762b2b0..ba9c115313 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -29,14 +29,61 @@ \alias{reexports} \alias{\%>\%} \title{Objects exported from other packages} +\usage{ +mutate(.data, ...) + +mutate_(.data, ..., .dots = list()) + +transmute(.data, ...) + +transmute_(.data, ..., .dots = list()) + +select(.data, ...) + +select_(.data, ..., .dots = list()) + +rename(.data, ...) + +rename_(.data, ..., .dots = list()) + +group_by(.data, ..., .add = FALSE, .drop = group_by_drop_default(.data)) + +group_by_(.data, ..., .dots = list(), add = FALSE) + +groups(x) + +ungroup(x, ...) + +summarise(.data, ..., .by = NULL, .groups = NULL) + +summarise_(.data, ..., .dots = list()) + +do(.data, ...) + +do_(.data, ..., .dots = list()) + +arrange(.data, ..., .by_group = FALSE) + +arrange_(.data, ..., .dots = list()) + +distinct(.data, ..., .keep_all = FALSE) + +distinct_(.data, ..., .dots, .keep_all = FALSE) + +slice(.data, ..., .by = NULL, .preserve = FALSE) + +slice_(.data, ..., .dots = list()) + +filter(.data, ..., .by = NULL, .preserve = FALSE) + +filter_(.data, ..., .dots = list()) +} \keyword{internal} \description{ These objects are imported from other packages. Follow the links below to see their documentation. \describe{ - \item{dplyr}{\code{\link[dplyr]{arrange}}, \code{\link[dplyr:se-deprecated]{arrange_}}, \code{\link[dplyr]{distinct}}, \code{\link[dplyr:se-deprecated]{distinct_}}, \code{\link[dplyr]{do}}, \code{\link[dplyr:se-deprecated]{do_}}, \code{\link[dplyr]{filter}}, \code{\link[dplyr:se-deprecated]{filter_}}, \code{\link[dplyr]{group_by}}, \code{\link[dplyr:se-deprecated]{group_by_}}, \code{\link[dplyr:group_data]{groups}}, \code{\link[dplyr]{mutate}}, \code{\link[dplyr:se-deprecated]{mutate_}}, \code{\link[dplyr]{rename}}, \code{\link[dplyr:se-deprecated]{rename_}}, \code{\link[dplyr]{select}}, \code{\link[dplyr:se-deprecated]{select_}}, \code{\link[dplyr]{slice}}, \code{\link[dplyr:se-deprecated]{slice_}}, \code{\link[dplyr]{summarise}}, \code{\link[dplyr:se-deprecated]{summarise_}}, \code{\link[dplyr:mutate]{transmute}}, \code{\link[dplyr:se-deprecated]{transmute_}}, \code{\link[dplyr:group_by]{ungroup}}} - \item{magrittr}{\code{\link[magrittr:pipe]{\%>\%}}} }} diff --git a/man/remove_typedarray_polyfill.Rd b/man/remove_typedarray_polyfill.Rd index dc29214909..82d3e77c88 100644 --- a/man/remove_typedarray_polyfill.Rd +++ b/man/remove_typedarray_polyfill.Rd @@ -19,6 +19,7 @@ The polyfill seems to be only relevant for those rendering plots via phantomjs and RStudio on some Windows platforms. } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \dontrun{ p1 <- plot_ly() @@ -29,4 +30,5 @@ file.info(t1)$size htmlwidgets::saveWidget(p2, t1) file.info(t1)$size } +\dontshow{\}) # examplesIf} } diff --git a/man/save_image.Rd b/man/save_image.Rd index 06a0e2596d..baebd94f09 100644 --- a/man/save_image.Rd +++ b/man/save_image.Rd @@ -45,15 +45,19 @@ method for converting R plots into static images. \code{save_image()} provides a \section{Installation}{ -\code{kaleido()} requires \href{https://github.com/plotly/Kaleido/}{the kaleido python package} to be usable via the \pkg{reticulate} package. Here is a recommended way to do the installation:\preformatted{install.packages('reticulate') -reticulate::install_miniconda() -reticulate::conda_install('r-reticulate', 'python-kaleido') -reticulate::conda_install('r-reticulate', 'plotly', channel = 'plotly') -reticulate::use_miniconda('r-reticulate') -} +\code{kaleido()} requires \href{https://github.com/plotly/Kaleido/}{the kaleido python package} to be usable via the +\pkg{reticulate} package. If you're starting from scratch, you install +eveything you need with the following R code: + +\if{html}{\out{
}}\preformatted{install.packages("reticulate") +library(reticulate) +use_python(install_python()) +py_install(c("kaleido", "plotly")) +}\if{html}{\out{
}} } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \dontrun{ # Save a single image @@ -71,5 +75,5 @@ reticulate::use_miniconda('r-reticulate') # R/Python objects and shutdown subprocesses rm(scope); gc() } - +\dontshow{\}) # examplesIf} } diff --git a/man/schema.Rd b/man/schema.Rd index 9dbc71d189..ae8e9cbef2 100644 --- a/man/schema.Rd +++ b/man/schema.Rd @@ -16,6 +16,7 @@ The schema contains valid attributes names, their value type, default values (if any), and min/max values (if applicable). } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} s <- schema() # retrieve acceptable `layout.mapbox.style` values @@ -28,5 +29,5 @@ if (!is.na(Sys.getenv('MAPBOX_TOKEN', NA))) { } - +\dontshow{\}) # examplesIf} } diff --git a/man/showRGB.Rd b/man/showRGB.Rd index 6434c9156b..6cfe8f07d2 100644 --- a/man/showRGB.Rd +++ b/man/showRGB.Rd @@ -16,8 +16,10 @@ Useful for viewing colors after they've been converted to plotly.js' color format -- "rgba(255, 255, 255, 1)" } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} showRGB(toRGB(colors()), labels = FALSE) +\dontshow{\}) # examplesIf} } \author{ Carson Sievert diff --git a/man/style.Rd b/man/style.Rd index 58beec5a6f..aff55e6b47 100644 --- a/man/style.Rd +++ b/man/style.Rd @@ -19,6 +19,7 @@ Modify trace(s) of an existing plotly visualization. Useful when used in conjunction with \code{\link[=get_figure]{get_figure()}}. } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # style() is especially useful in conjunction with ggplotly() # It allows you to leverage the underlying plotly.js library to change @@ -46,7 +47,7 @@ style(p, marker = list(line = list(color = "blue"))) style(p, marker.line.color = "blue") # this clobbers the previously supplied marker.line.color style(p, marker.line = list(width = 2.5), marker.size = 10) - +\dontshow{\}) # examplesIf} } \seealso{ \code{\link[=api_download_plot]{api_download_plot()}} diff --git a/man/subplot.Rd b/man/subplot.Rd index 3ebca397e4..d093109f62 100644 --- a/man/subplot.Rd +++ b/man/subplot.Rd @@ -60,6 +60,7 @@ A plotly object View multiple plots in a single view } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # pass any number of plotly objects to subplot() p1 <- plot_ly(economics, x = ~date, y = ~uempmed) @@ -88,8 +89,8 @@ economics_long \%>\% do(p = plot_ly(., x = ~date, y = ~value)) \%>\% subplot(nrows = NROW(.), shareX = TRUE) -# learn more at https://plotly.com/r/subplot.html - +# learn more at https://plotly.com/r/subplots/ +\dontshow{\}) # examplesIf} } \author{ Carson Sievert diff --git a/man/toRGB.Rd b/man/toRGB.Rd index 1380dc705a..210c48ec59 100644 --- a/man/toRGB.Rd +++ b/man/toRGB.Rd @@ -18,6 +18,7 @@ hexadecimal colour value (if is.na(x), return "transparent" for compatibility wi Convert R colours to RGBA hexadecimal colour values } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} toRGB("steelblue") # [1] "rgba(70,130,180,1)" @@ -31,7 +32,7 @@ m <- list( ) plot_ly(x = 1, y = 1, marker = m) - +\dontshow{\}) # examplesIf} } \seealso{ \code{\link[=showRGB]{showRGB()}} diff --git a/man/toWebGL.Rd b/man/toWebGL.Rd index 7b047cabcb..09bf27dfd5 100644 --- a/man/toWebGL.Rd +++ b/man/toWebGL.Rd @@ -13,9 +13,10 @@ toWebGL(p) Convert trace types to WebGL } \examples{ +\dontshow{if (interactive() || !identical(.Platform$OS.type, "windows")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # currently no bargl trace type toWebGL(ggplot() + geom_bar(aes(1:10))) toWebGL(qplot(1:10, 1:10)) - +\dontshow{\}) # examplesIf} } diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-minor-major.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-minor-major.svg index f0d7eef4a6..a101d1160d 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-minor-major.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-minor-major.svg @@ -1 +1 @@ -ctrltrt1trt23.54.04.55.05.56.0groupweight +ctrltrt1trt23.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-minor.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-minor.svg index c241809a66..86bb073e55 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-minor.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-minor.svg @@ -1 +1 @@ -ctrltrt1trt23.54.04.55.05.56.0groupweight +ctrltrt1trt23.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-x.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-x.svg index 457c8ef4bd..a066656087 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-x.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-x.svg @@ -1 +1 @@ -ctrltrt1trt23.54.04.55.05.56.0groupweight +ctrltrt1trt23.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-y.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-y.svg index 6a927a043c..f37ee2e2a5 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-y.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-y.svg @@ -1 +1 @@ -ctrltrt1trt23.54.04.55.05.56.0groupweight +ctrltrt1trt23.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-coord-ylim.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-coord-ylim.svg index 0546ba361c..e68a7cecbb 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-coord-ylim.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-coord-ylim.svg @@ -1 +1 @@ -ctrltrt1trt25.05.56.06.57.07.5groupweight +ctrltrt1trt25.05.56.06.57.07.5groupweight diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-custom-formatter.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-custom-formatter.svg index 5bf1c6c44d..9bada9ef53 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-custom-formatter.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-custom-formatter.svg @@ -1 +1 @@ -ctrltrt1trt23:304:004:305:005:306:00groupweight +ctrltrt1trt23:304:004:305:005:306:00groupweight diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-flevels.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-flevels.svg index 534e55efc6..d7e693bf9d 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-flevels.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-flevels.svg @@ -1 +1 @@ -trt2trt1ctrl3.54.04.55.05.56.0groupweight +trt2trt1ctrl3.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-fonts.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-fonts.svg index 97adb0109e..1882834967 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-fonts.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-fonts.svg @@ -1 +1 @@ -ctrltrt1trt23.54.04.55.05.56.0 group weight +ctrltrt1trt23.54.04.55.05.56.0 group weight diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-label-funs.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-label-funs.svg index 3753200564..0cbdc2ac10 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-label-funs.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-label-funs.svg @@ -1 +1 @@ -ctrltrt1trt2350%400%450%500%550%600%groupweight +ctrltrt1trt2350%400%450%500%550%600%groupweight diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-linear-axes.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-linear-axes.svg index 20083ff15a..4d690dbb0d 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-linear-axes.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-linear-axes.svg @@ -1 +1 @@ -012345050000010000001500000xvalyval +012345050000010000001500000xvalyval diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-log2-coord.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-log2-coord.svg index ad7f36fa5c..c5b3aed832 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-log2-coord.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-log2-coord.svg @@ -1 +1 @@ -0123451e+062e+063e+06xvalyval +0123451e+062e+063e+06xvalyval diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-log2-labels.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-log2-labels.svg index 142897f141..f90bfda233 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-log2-labels.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-log2-labels.svg @@ -1 +1 @@ -0123455.0010.0015.0020.00xvalyval +0123452^52^102^152^20xvalyval diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-log2-scale.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-log2-scale.svg index a3cf8d5b79..e4824f44cb 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-log2-scale.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-log2-scale.svg @@ -1 +1 @@ -012345642048655362097152xvalyval +012345642048655362097152xvalyval diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-no-x-title.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-no-x-title.svg index 3cbaa95330..3ccde61f03 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-no-x-title.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-no-x-title.svg @@ -1 +1 @@ -ctrltrt1trt23.54.04.55.05.56.0Weight (Kg) +ctrltrt1trt23.54.04.55.05.56.0Weight (Kg) diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-hide.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-hide.svg index 22bf7e6c39..b7daaed970 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-hide.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-hide.svg @@ -1 +1 @@ -ctrltrt1trt25.05.56.06.57.07.5groupweight +ctrltrt1trt25.05.56.06.57.07.5groupweight diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-name.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-name.svg index f2e8e9a753..00611de2f5 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-name.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-name.svg @@ -1 +1 @@ -ctrltrt1trt23.54.04.55.05.56.0Weight (Kg) +ctrltrt1trt23.54.04.55.05.56.0Weight (Kg) diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-y-log10-labels.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-y-log10-labels.svg index 0e42df6c1f..887896d2af 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-y-log10-labels.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-y-log10-labels.svg @@ -1 +1 @@ -0123451.002.003.004.005.006.00xvalyval +01234510^110^210^310^410^510^6xvalyval diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-y-log10.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-y-log10.svg index a758a127a6..d39c3a35de 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-y-log10.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-scale-y-log10.svg @@ -1 +1 @@ -0123451e+021e+041e+06xvalyval +0123451e+021e+041e+06xvalyval diff --git a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-ylim-hide.svg b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-ylim-hide.svg index 22bf7e6c39..b7daaed970 100644 --- a/tests/testthat/_snaps/cookbook-axes/cookbook-axes-ylim-hide.svg +++ b/tests/testthat/_snaps/cookbook-axes/cookbook-axes-ylim-hide.svg @@ -1 +1 @@ -ctrltrt1trt25.05.56.06.57.07.5groupweight +ctrltrt1trt25.05.56.06.57.07.5groupweight diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-dodge-color-err4.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-dodge-color-err4.svg index e0dded05d8..e2302135fb 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-dodge-color-err4.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-dodge-color-err4.svg @@ -1 +1 @@ -controltreatment051015groupABcondresult +controltreatment051015groupABcondresult diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-dodge-color-error.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-dodge-color-error.svg index 1b7267cd65..1dc8185811 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-dodge-color-error.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-dodge-color-error.svg @@ -1 +1 @@ -controltreatment0510groupABcondresult +controltreatment0510groupABcondresult diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-dodge-color.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-dodge-color.svg index 420edab7f6..6f17146f7c 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-dodge-color.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-dodge-color.svg @@ -1 +1 @@ -controltreatment0510groupABcondresult +controltreatment0510groupABcondresult diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-error-diff.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-error-diff.svg index ca2d611da7..6e9db2ac57 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-error-diff.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-error-diff.svg @@ -1 +1 @@ -controltreatment0.02.55.07.510.012.5condresult +controltreatment0.02.55.07.510.012.5condresult diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-error-narrow.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-error-narrow.svg index 2d99f7bfd7..33b394fc81 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-error-narrow.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-error-narrow.svg @@ -1 +1 @@ -controltreatment0.02.55.07.510.012.5condresult +controltreatment0.02.55.07.510.012.5condresult diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-error-wide.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-error-wide.svg index ca2d611da7..6e9db2ac57 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-error-wide.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-bar-error-wide.svg @@ -1 +1 @@ -controltreatment0.02.55.07.510.012.5condresult +controltreatment0.02.55.07.510.012.5condresult diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-basic-bar.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-basic-bar.svg index 8bacd9ccd6..e5c7ab1926 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-basic-bar.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-basic-bar.svg @@ -1 +1 @@ -controltreatment036912condresult +controltreatment036912condresult diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-basic-horizontal-line.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-basic-horizontal-line.svg index ede802bf90..0b1955a570 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-basic-horizontal-line.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-basic-horizontal-line.svg @@ -1 +1 @@ -controltreatment0.02.55.07.510.012.5condresult +controltreatment0.02.55.07.510.012.5condresult diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-dashed-red-line.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-dashed-red-line.svg index 9248c079d0..b6bf220a47 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-dashed-red-line.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-dashed-red-line.svg @@ -1 +1 @@ -controltreatment0.02.55.07.510.012.5condresult +controltreatment0.02.55.07.510.012.5condresult diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-basic.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-basic.svg index d541f6f0af..9741892726 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-basic.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-basic.svg @@ -1 +1 @@ -81012910111213condcontroltreatmentxvalyval +81012910111213condcontroltreatmentxvalyval diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-facet-hline-vline.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-facet-hline-vline.svg index 82e3c7b6c7..5ed1c004f6 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-facet-hline-vline.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-facet-hline-vline.svg @@ -1 +1 @@ -8101291011121381012condcontroltreatmentxvalyvalcontroltreatment +8101291011121381012condcontroltreatmentxvalyvalcontroltreatment diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-facet-hline.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-facet-hline.svg index 7494965fb2..e3f13cd02b 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-facet-hline.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-facet-hline.svg @@ -1 +1 @@ -8101291011121381012condcontroltreatmentxvalyvalcontroltreatment +8101291011121381012condcontroltreatmentxvalyvalcontroltreatment diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-facet.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-facet.svg index 5441b02f76..de6a32ea85 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-facet.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-facet.svg @@ -1 +1 @@ -8101291011121381012condcontroltreatmentxvalyvalcontroltreatment +8101291011121381012condcontroltreatmentxvalyvalcontroltreatment diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-hline-vline.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-hline-vline.svg index 904829216a..ce4c4400e1 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-hline-vline.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-hline-vline.svg @@ -1 +1 @@ -81012910111213condcontroltreatmentxvalyval +81012910111213condcontroltreatmentxvalyval diff --git a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-hline.svg b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-hline.svg index 59691c783f..e8a933e41c 100644 --- a/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-hline.svg +++ b/tests/testthat/_snaps/cookbook-lines/cookbook-axes-scatter-hline.svg @@ -1 +1 @@ -81012910111213condcontroltreatmentxvalyval +81012910111213condcontroltreatmentxvalyval diff --git a/tests/testthat/_snaps/cookbook-scatterplots/color.svg b/tests/testthat/_snaps/cookbook-scatterplots/color.svg index c42ed48037..4bbfd50829 100644 --- a/tests/testthat/_snaps/cookbook-scatterplots/color.svg +++ b/tests/testthat/_snaps/cookbook-scatterplots/color.svg @@ -1 +1 @@ -01020300510152025condABxvaryvar +01020300510152025condABxvaryvar diff --git a/tests/testthat/_snaps/cookbook-scatterplots/full-range.svg b/tests/testthat/_snaps/cookbook-scatterplots/full-range.svg index 62e3c94e08..fa6aee11f8 100644 --- a/tests/testthat/_snaps/cookbook-scatterplots/full-range.svg +++ b/tests/testthat/_snaps/cookbook-scatterplots/full-range.svg @@ -1 +1 @@ -010203001020condABxvaryvar +010203001020condABxvaryvar diff --git a/tests/testthat/_snaps/cookbook-scatterplots/geom-jitter.svg b/tests/testthat/_snaps/cookbook-scatterplots/geom-jitter.svg index 5927395b31..08c4cac223 100644 --- a/tests/testthat/_snaps/cookbook-scatterplots/geom-jitter.svg +++ b/tests/testthat/_snaps/cookbook-scatterplots/geom-jitter.svg @@ -1 +1 @@ -01020300510152025xrndyrnd +01020300510152025xrndyrnd diff --git a/tests/testthat/_snaps/cookbook-scatterplots/hollow.svg b/tests/testthat/_snaps/cookbook-scatterplots/hollow.svg index 65d2de3008..c3dda960c5 100644 --- a/tests/testthat/_snaps/cookbook-scatterplots/hollow.svg +++ b/tests/testthat/_snaps/cookbook-scatterplots/hollow.svg @@ -1 +1 @@ -01020300510152025xvaryvar +01020300510152025xvaryvar diff --git a/tests/testthat/_snaps/cookbook-scatterplots/jitter.svg b/tests/testthat/_snaps/cookbook-scatterplots/jitter.svg index 5927395b31..08c4cac223 100644 --- a/tests/testthat/_snaps/cookbook-scatterplots/jitter.svg +++ b/tests/testthat/_snaps/cookbook-scatterplots/jitter.svg @@ -1 +1 @@ -01020300510152025xrndyrnd +01020300510152025xrndyrnd diff --git a/tests/testthat/_snaps/cookbook-scatterplots/loess.svg b/tests/testthat/_snaps/cookbook-scatterplots/loess.svg index 6bf599e4de..cc7d446776 100644 --- a/tests/testthat/_snaps/cookbook-scatterplots/loess.svg +++ b/tests/testthat/_snaps/cookbook-scatterplots/loess.svg @@ -1 +1 @@ -010203001020xvaryvar +010203001020xvaryvar diff --git a/tests/testthat/_snaps/cookbook-scatterplots/overlap.svg b/tests/testthat/_snaps/cookbook-scatterplots/overlap.svg index eaf629ce74..702e6ebd52 100644 --- a/tests/testthat/_snaps/cookbook-scatterplots/overlap.svg +++ b/tests/testthat/_snaps/cookbook-scatterplots/overlap.svg @@ -1 +1 @@ -01020300510152025xrndyrnd +01020300510152025xrndyrnd diff --git a/tests/testthat/_snaps/cookbook-scatterplots/scale-color-hue.svg b/tests/testthat/_snaps/cookbook-scatterplots/scale-color-hue.svg index a5596b8994..794061e96d 100644 --- a/tests/testthat/_snaps/cookbook-scatterplots/scale-color-hue.svg +++ b/tests/testthat/_snaps/cookbook-scatterplots/scale-color-hue.svg @@ -1 +1 @@ -01020300510152025condABxvaryvar +01020300510152025condABxvaryvar diff --git a/tests/testthat/_snaps/cookbook-scatterplots/shape-manual.svg b/tests/testthat/_snaps/cookbook-scatterplots/shape-manual.svg index 64053d126b..ff8115fa16 100644 --- a/tests/testthat/_snaps/cookbook-scatterplots/shape-manual.svg +++ b/tests/testthat/_snaps/cookbook-scatterplots/shape-manual.svg @@ -1 +1 @@ -01020300510152025condABxvaryvar +01020300510152025condABxvaryvar diff --git a/tests/testthat/_snaps/cookbook-scatterplots/shape.svg b/tests/testthat/_snaps/cookbook-scatterplots/shape.svg index f56d222584..edc54d24a7 100644 --- a/tests/testthat/_snaps/cookbook-scatterplots/shape.svg +++ b/tests/testthat/_snaps/cookbook-scatterplots/shape.svg @@ -1 +1 @@ -01020300510152025condABxvaryvar +01020300510152025condABxvaryvar diff --git a/tests/testthat/_snaps/cookbook-scatterplots/smooth-lm-se-false.svg b/tests/testthat/_snaps/cookbook-scatterplots/smooth-lm-se-false.svg index aef0a48e9c..2e40d6e55d 100644 --- a/tests/testthat/_snaps/cookbook-scatterplots/smooth-lm-se-false.svg +++ b/tests/testthat/_snaps/cookbook-scatterplots/smooth-lm-se-false.svg @@ -1 +1 @@ -01020300510152025xvaryvar +01020300510152025xvaryvar diff --git a/tests/testthat/_snaps/cookbook-scatterplots/smooth-lm.svg b/tests/testthat/_snaps/cookbook-scatterplots/smooth-lm.svg index c81653df41..05871f8bf3 100644 --- a/tests/testthat/_snaps/cookbook-scatterplots/smooth-lm.svg +++ b/tests/testthat/_snaps/cookbook-scatterplots/smooth-lm.svg @@ -1 +1 @@ -010203001020xvaryvar +010203001020xvaryvar diff --git a/tests/testthat/_snaps/geom-errorbar-flipped-aes/errobar-flipped-aes.svg b/tests/testthat/_snaps/geom-errorbar-flipped-aes/errobar-flipped-aes.svg index ff1aaec4c2..0a3c10272e 100644 --- a/tests/testthat/_snaps/geom-errorbar-flipped-aes/errobar-flipped-aes.svg +++ b/tests/testthat/_snaps/geom-errorbar-flipped-aes/errobar-flipped-aes.svg @@ -1 +1 @@ -2.502.753.003.253.50setosaversicolorvirginicaSpecies +2.502.753.003.253.50setosaversicolorvirginicaSpecies diff --git a/tests/testthat/_snaps/geom-errorbar-issue-1751/errobar-no-aes-y.svg b/tests/testthat/_snaps/geom-errorbar-issue-1751/errobar-no-aes-y.svg index c7941592be..292285897c 100644 --- a/tests/testthat/_snaps/geom-errorbar-issue-1751/errobar-no-aes-y.svg +++ b/tests/testthat/_snaps/geom-errorbar-issue-1751/errobar-no-aes-y.svg @@ -1 +1 @@ -FirmicutesSpirochaetes0.20.30.40.50.6Names +FirmicutesSpirochaetes0.20.30.40.50.6Names diff --git a/tests/testthat/_snaps/ggalluvial/stratum-alluvium-color.svg b/tests/testthat/_snaps/ggalluvial/stratum-alluvium-color.svg index cb49c6e6e7..4d361e74de 100644 --- a/tests/testthat/_snaps/ggalluvial/stratum-alluvium-color.svg +++ b/tests/testthat/_snaps/ggalluvial/stratum-alluvium-color.svg @@ -1 +1 @@ -NoYesMaleFemale1st2nd3rdCrew0500100015002000SurvivedSexClassClass1st2nd3rdCrewTitanic survival by class and sexFreq +NoYesMaleFemale1st2nd3rdCrew0500100015002000SurvivedSexClassClass1st2nd3rdCrewTitanic survival by class and sexFreq diff --git a/tests/testthat/_snaps/ggalluvial/stratum-alluvium.svg b/tests/testthat/_snaps/ggalluvial/stratum-alluvium.svg index 12d6c570db..5373864dff 100644 --- a/tests/testthat/_snaps/ggalluvial/stratum-alluvium.svg +++ b/tests/testthat/_snaps/ggalluvial/stratum-alluvium.svg @@ -1 +1 @@ -NoYesMaleFemale1st2nd3rdCrew0500100015002000SurvivedSexClassTitanic survival by class and sexFreq +NoYesMaleFemale1st2nd3rdCrew0500100015002000SurvivedSexClassTitanic survival by class and sexFreq diff --git a/tests/testthat/_snaps/ggplot-abline/cookbook-axes-multiple-abline.svg b/tests/testthat/_snaps/ggplot-abline/cookbook-axes-multiple-abline.svg index 9d82f364af..9ee86c7b41 100644 --- a/tests/testthat/_snaps/ggplot-abline/cookbook-axes-multiple-abline.svg +++ b/tests/testthat/_snaps/ggplot-abline/cookbook-axes-multiple-abline.svg @@ -1 +1 @@ --5.0-2.50.02.55.0-5.0-2.50.02.55.0 +-5.0-2.50.02.55.0-5.0-2.50.02.55.0 diff --git a/tests/testthat/_snaps/ggplot-abline/cookbook-axes-single-abline.svg b/tests/testthat/_snaps/ggplot-abline/cookbook-axes-single-abline.svg index b74f85f3d7..60dbaa3a33 100644 --- a/tests/testthat/_snaps/ggplot-abline/cookbook-axes-single-abline.svg +++ b/tests/testthat/_snaps/ggplot-abline/cookbook-axes-single-abline.svg @@ -1 +1 @@ -01230123xy +01230123xy diff --git a/tests/testthat/_snaps/ggplot-area/area-area-fillcolor.svg b/tests/testthat/_snaps/ggplot-area/area-area-fillcolor.svg index 92873ddac8..8160dcf346 100644 --- a/tests/testthat/_snaps/ggplot-area/area-area-fillcolor.svg +++ b/tests/testthat/_snaps/ggplot-area/area-area-fillcolor.svg @@ -1 +1 @@ -187519001925195019750200400600yearlevel +187519001925195019750200400600yearlevel diff --git a/tests/testthat/_snaps/ggplot-area/area-simple.svg b/tests/testthat/_snaps/ggplot-area/area-simple.svg index 5730c6fcba..89af7b902f 100644 --- a/tests/testthat/_snaps/ggplot-area/area-simple.svg +++ b/tests/testthat/_snaps/ggplot-area/area-simple.svg @@ -1 +1 @@ -187519001925195019750200400600yearlevel +187519001925195019750200400600yearlevel diff --git a/tests/testthat/_snaps/ggplot-area/area-traces-order.svg b/tests/testthat/_snaps/ggplot-area/area-traces-order.svg index 48426b9a11..fff3b035ab 100644 --- a/tests/testthat/_snaps/ggplot-area/area-traces-order.svg +++ b/tests/testthat/_snaps/ggplot-area/area-traces-order.svg @@ -1 +1 @@ -0123450.000.250.500.751.00cutFairGoodVery GoodPremiumIdealcaratfreq +0123450.000.250.500.751.00cutFairGoodVery GoodPremiumIdealcaratfreq diff --git a/tests/testthat/_snaps/ggplot-bar/bar-aes-colour-guides-fill-false.svg b/tests/testthat/_snaps/ggplot-bar/bar-aes-colour-guides-fill-false.svg index e61d04b8b1..1a1656ef74 100644 --- a/tests/testthat/_snaps/ggplot-bar/bar-aes-colour-guides-fill-false.svg +++ b/tests/testthat/_snaps/ggplot-bar/bar-aes-colour-guides-fill-false.svg @@ -1 +1 @@ -LunchDinner051015timeLunchDinnertimetotal_bill +LunchDinner051015timeLunchDinnertimetotal_bill diff --git a/tests/testthat/_snaps/ggplot-bar/bar-aes-fill-guides-color-none.svg b/tests/testthat/_snaps/ggplot-bar/bar-aes-fill-guides-color-none.svg index 9210ff2e47..0ae4078c30 100644 --- a/tests/testthat/_snaps/ggplot-bar/bar-aes-fill-guides-color-none.svg +++ b/tests/testthat/_snaps/ggplot-bar/bar-aes-fill-guides-color-none.svg @@ -1 +1 @@ -LunchDinner051015timeLunchDinnertimetotal_bill +LunchDinner051015timeLunchDinnertimetotal_bill diff --git a/tests/testthat/_snaps/ggplot-bar/bar-black-outline.svg b/tests/testthat/_snaps/ggplot-bar/bar-black-outline.svg index 9210ff2e47..0ae4078c30 100644 --- a/tests/testthat/_snaps/ggplot-bar/bar-black-outline.svg +++ b/tests/testthat/_snaps/ggplot-bar/bar-black-outline.svg @@ -1 +1 @@ -LunchDinner051015timeLunchDinnertimetotal_bill +LunchDinner051015timeLunchDinnertimetotal_bill diff --git a/tests/testthat/_snaps/ggplot-bar/bar-category-names.svg b/tests/testthat/_snaps/ggplot-bar/bar-category-names.svg index c87920ec85..a93d6da437 100644 --- a/tests/testthat/_snaps/ggplot-bar/bar-category-names.svg +++ b/tests/testthat/_snaps/ggplot-bar/bar-category-names.svg @@ -1 +1 @@ -FairGoodVery GoodPremiumIdeal02000400060008000cutprice +FairGoodVery GoodPremiumIdeal02000400060008000cutprice diff --git a/tests/testthat/_snaps/ggplot-bar/bar-color.svg b/tests/testthat/_snaps/ggplot-bar/bar-color.svg index 4207f7be9e..a3e65f9fc8 100644 --- a/tests/testthat/_snaps/ggplot-bar/bar-color.svg +++ b/tests/testthat/_snaps/ggplot-bar/bar-color.svg @@ -1 +1 @@ -LunchDinner051015timeLunchDinnertimetotal_bill +LunchDinner051015timeLunchDinnertimetotal_bill diff --git a/tests/testthat/_snaps/ggplot-bar/bar-coord-flip.svg b/tests/testthat/_snaps/ggplot-bar/bar-coord-flip.svg index 8d9169aadf..6bb07e13dd 100644 --- a/tests/testthat/_snaps/ggplot-bar/bar-coord-flip.svg +++ b/tests/testthat/_snaps/ggplot-bar/bar-coord-flip.svg @@ -1 +1 @@ -0510468countfactor(cyl) +0510468countfactor(cyl) diff --git a/tests/testthat/_snaps/ggplot-bar/bar-dates.svg b/tests/testthat/_snaps/ggplot-bar/bar-dates.svg index a1d36da629..055d232f0a 100644 --- a/tests/testthat/_snaps/ggplot-bar/bar-dates.svg +++ b/tests/testthat/_snaps/ggplot-bar/bar-dates.svg @@ -1 +1 @@ -Jan 01Jan 15Feb 01Feb 1502040fieldBioMathmonthpapers +Jan 01Jan 15Feb 01Feb 1502040fieldBioMathmonthpapers diff --git a/tests/testthat/_snaps/ggplot-bar/bar-dodge.svg b/tests/testthat/_snaps/ggplot-bar/bar-dodge.svg index a9c8866335..565421be6f 100644 --- a/tests/testthat/_snaps/ggplot-bar/bar-dodge.svg +++ b/tests/testthat/_snaps/ggplot-bar/bar-dodge.svg @@ -1 +1 @@ -CanadaGermanyUSA0102030fieldBioMathcountrypapers +CanadaGermanyUSA0102030fieldBioMathcountrypapers diff --git a/tests/testthat/_snaps/ggplot-bar/bar-identity.svg b/tests/testthat/_snaps/ggplot-bar/bar-identity.svg index 70cd8f1dea..f75af064e0 100644 --- a/tests/testthat/_snaps/ggplot-bar/bar-identity.svg +++ b/tests/testthat/_snaps/ggplot-bar/bar-identity.svg @@ -1 +1 @@ -CanadaGermanyUSA0102030fieldBioMathcountrypapers +CanadaGermanyUSA0102030fieldBioMathcountrypapers diff --git a/tests/testthat/_snaps/ggplot-bar/bar-nocolor.svg b/tests/testthat/_snaps/ggplot-bar/bar-nocolor.svg index b34edcfd91..80a0f70555 100644 --- a/tests/testthat/_snaps/ggplot-bar/bar-nocolor.svg +++ b/tests/testthat/_snaps/ggplot-bar/bar-nocolor.svg @@ -1 +1 @@ -LunchDinner051015timetotal_bill +LunchDinner051015timetotal_bill diff --git a/tests/testthat/_snaps/ggplot-bar/bar-position-fill.svg b/tests/testthat/_snaps/ggplot-bar/bar-position-fill.svg index 39e333a92e..4b89d79b54 100644 --- a/tests/testthat/_snaps/ggplot-bar/bar-position-fill.svg +++ b/tests/testthat/_snaps/ggplot-bar/bar-position-fill.svg @@ -1 +1 @@ -010.000.250.500.751.00factor(cyl)468factor(vs)count +010.000.250.500.751.00factor(cyl)468factor(vs)count diff --git a/tests/testthat/_snaps/ggplot-bar/bar-position-stack.svg b/tests/testthat/_snaps/ggplot-bar/bar-position-stack.svg index 7079232fca..44e9e33df8 100644 --- a/tests/testthat/_snaps/ggplot-bar/bar-position-stack.svg +++ b/tests/testthat/_snaps/ggplot-bar/bar-position-stack.svg @@ -1 +1 @@ -01051015factor(cyl)468factor(vs)count +01051015factor(cyl)468factor(vs)count diff --git a/tests/testthat/_snaps/ggplot-bar/bar-stack.svg b/tests/testthat/_snaps/ggplot-bar/bar-stack.svg index 127dba9725..b7474e31ef 100644 --- a/tests/testthat/_snaps/ggplot-bar/bar-stack.svg +++ b/tests/testthat/_snaps/ggplot-bar/bar-stack.svg @@ -1 +1 @@ -CanadaGermanyUSA0102030fieldBioMathcountrypapers +CanadaGermanyUSA0102030fieldBioMathcountrypapers diff --git a/tests/testthat/_snaps/ggplot-boxplot/boxplot-datetime.svg b/tests/testthat/_snaps/ggplot-boxplot/boxplot-datetime.svg index 0c47c98fa4..b30bd53ae3 100644 --- a/tests/testthat/_snaps/ggplot-boxplot/boxplot-datetime.svg +++ b/tests/testthat/_snaps/ggplot-boxplot/boxplot-datetime.svg @@ -1 +1 @@ --0.4-0.20.00.20.410203040xy +-0.4-0.20.00.20.410203040xy diff --git a/tests/testthat/_snaps/ggplot-boxplot/boxplot-fillcolor.svg b/tests/testthat/_snaps/ggplot-boxplot/boxplot-fillcolor.svg index e77446a7d2..2765fb176d 100644 --- a/tests/testthat/_snaps/ggplot-boxplot/boxplot-fillcolor.svg +++ b/tests/testthat/_snaps/ggplot-boxplot/boxplot-fillcolor.svg @@ -1 +1 @@ -ABCD-2024colC1C2condrating +ABCD-2024colC1C2condrating diff --git a/tests/testthat/_snaps/ggplot-boxplot/boxplot-legends-for-fill.svg b/tests/testthat/_snaps/ggplot-boxplot/boxplot-legends-for-fill.svg index 68a85faf81..dda3c05dca 100644 --- a/tests/testthat/_snaps/ggplot-boxplot/boxplot-legends-for-fill.svg +++ b/tests/testthat/_snaps/ggplot-boxplot/boxplot-legends-for-fill.svg @@ -1 +1 @@ -468101520253035factor(cyl)468factor(cyl)mpg +468101520253035factor(cyl)468factor(cyl)mpg diff --git a/tests/testthat/_snaps/ggplot-boxplot/boxplot.svg b/tests/testthat/_snaps/ggplot-boxplot/boxplot.svg index 0d796f0a5e..0a5e327f7d 100644 --- a/tests/testthat/_snaps/ggplot-boxplot/boxplot.svg +++ b/tests/testthat/_snaps/ggplot-boxplot/boxplot.svg @@ -1 +1 @@ -468101520253035factor(cyl)mpg +468101520253035factor(cyl)mpg diff --git a/tests/testthat/_snaps/ggplot-col/col.svg b/tests/testthat/_snaps/ggplot-col/col.svg index 604aa66370..3ec40841d2 100644 --- a/tests/testthat/_snaps/ggplot-col/col.svg +++ b/tests/testthat/_snaps/ggplot-col/col.svg @@ -1 +1 @@ -71.4%20.0%48.3%28.6%80.0%51.7%ElementaryHighMiddle0.000.250.500.751.00includedexcludedincludedtypeprop +71.4%20.0%48.3%28.6%80.0%51.7%ElementaryHighMiddle0.000.250.500.751.00includedexcludedincludedtypeprop diff --git a/tests/testthat/_snaps/ggplot-contour/contour.svg b/tests/testthat/_snaps/ggplot-contour/contour.svg index 5c1aae4739..b4c92209c7 100644 --- a/tests/testthat/_snaps/ggplot-contour/contour.svg +++ b/tests/testthat/_snaps/ggplot-contour/contour.svg @@ -1 +1 @@ -02550750204060xy +02550750204060xy diff --git a/tests/testthat/_snaps/ggplot-contour/raster-contour-binned.svg b/tests/testthat/_snaps/ggplot-contour/raster-contour-binned.svg new file mode 100644 index 0000000000..5577becaa9 --- /dev/null +++ b/tests/testthat/_snaps/ggplot-contour/raster-contour-binned.svg @@ -0,0 +1 @@ +-10123-10123246810ptltrsps diff --git a/tests/testthat/_snaps/ggplot-date/date-class-date.svg b/tests/testthat/_snaps/ggplot-date/date-class-date.svg index bfed127dea..8ebd20f59e 100644 --- a/tests/testthat/_snaps/ggplot-date/date-class-date.svg +++ b/tests/testthat/_snaps/ggplot-date/date-class-date.svg @@ -1 +1 @@ -Jan 01Jan 02Jan 032.002.252.502.753.00xy +Jan 01Jan 02Jan 032.002.252.502.753.00xy diff --git a/tests/testthat/_snaps/ggplot-date/date-irregular-time-series.svg b/tests/testthat/_snaps/ggplot-date/date-irregular-time-series.svg index 8c1770ae8c..c36d00b032 100644 --- a/tests/testthat/_snaps/ggplot-date/date-irregular-time-series.svg +++ b/tests/testthat/_snaps/ggplot-date/date-irregular-time-series.svg @@ -1 +1 @@ -JanFebMar0.000.250.500.751.00dateprice +JanFebMar0.000.250.500.751.00dateprice diff --git a/tests/testthat/_snaps/ggplot-date/date-strings.svg b/tests/testthat/_snaps/ggplot-date/date-strings.svg index 9992f312a1..4f4fecaf17 100644 --- a/tests/testthat/_snaps/ggplot-date/date-strings.svg +++ b/tests/testthat/_snaps/ggplot-date/date-strings.svg @@ -1 +1 @@ -Apr 1983Jul 1983Oct 1983Jan 1984Apr 19840.02.55.07.510.0whomeyoutime.objdollars +Apr 1983Jul 1983Oct 1983Jan 1984Apr 19840.02.55.07.510.0whomeyoutime.objdollars diff --git a/tests/testthat/_snaps/ggplot-density/density-color.svg b/tests/testthat/_snaps/ggplot-density/density-color.svg index 7024b64224..0f5ad23cae 100644 --- a/tests/testthat/_snaps/ggplot-density/density-color.svg +++ b/tests/testthat/_snaps/ggplot-density/density-color.svg @@ -1 +1 @@ -23450.00.20.40.6factor(vs)01wtdensity +23450.00.20.40.6factor(vs)01wtdensity diff --git a/tests/testthat/_snaps/ggplot-density/density-fill.svg b/tests/testthat/_snaps/ggplot-density/density-fill.svg index 5cc84ba105..1094073aca 100644 --- a/tests/testthat/_snaps/ggplot-density/density-fill.svg +++ b/tests/testthat/_snaps/ggplot-density/density-fill.svg @@ -1 +1 @@ -23450.00.20.40.6factor(vs)01wtdensity +23450.00.20.40.6factor(vs)01wtdensity diff --git a/tests/testthat/_snaps/ggplot-density/density-histogram.svg b/tests/testthat/_snaps/ggplot-density/density-histogram.svg index f35c2fd108..cb689d7924 100644 --- a/tests/testthat/_snaps/ggplot-density/density-histogram.svg +++ b/tests/testthat/_snaps/ggplot-density/density-histogram.svg @@ -1 +1 @@ -23450.00.20.4wtdensity +23450.00.20.4wtdensity diff --git a/tests/testthat/_snaps/ggplot-density/density-simple.svg b/tests/testthat/_snaps/ggplot-density/density-simple.svg index 6a05645c6c..f4cea066d5 100644 --- a/tests/testthat/_snaps/ggplot-density/density-simple.svg +++ b/tests/testthat/_snaps/ggplot-density/density-simple.svg @@ -1 +1 @@ -23450.00.10.20.30.40.5wtdensity +23450.00.10.20.30.40.5wtdensity diff --git a/tests/testthat/_snaps/ggplot-density/density-traces-order.svg b/tests/testthat/_snaps/ggplot-density/density-traces-order.svg index e1befb3cd7..98ca79b7e5 100644 --- a/tests/testthat/_snaps/ggplot-density/density-traces-order.svg +++ b/tests/testthat/_snaps/ggplot-density/density-traces-order.svg @@ -1 +1 @@ -1015202530350.00.10.20.3factor(cyl)468mpgdensity +1015202530350.00.10.20.3factor(cyl)468mpgdensity diff --git a/tests/testthat/_snaps/ggplot-density2d/density2d.svg b/tests/testthat/_snaps/ggplot-density2d/density2d.svg index 31dd9ce9a7..f2fa02a93f 100644 --- a/tests/testthat/_snaps/ggplot-density2d/density2d.svg +++ b/tests/testthat/_snaps/ggplot-density2d/density2d.svg @@ -1 +1 @@ -12345406080100durationwaiting +12345406080100durationwaiting diff --git a/tests/testthat/_snaps/ggplot-errorbar-horizontal/errorbar-horizontal.svg b/tests/testthat/_snaps/ggplot-errorbar-horizontal/errorbar-horizontal.svg index e67b178ca4..9f88cdfab5 100644 --- a/tests/testthat/_snaps/ggplot-errorbar-horizontal/errorbar-horizontal.svg +++ b/tests/testthat/_snaps/ggplot-errorbar-horizontal/errorbar-horizontal.svg @@ -1 +1 @@ -1234512group12resptrt +1234512group12resptrt diff --git a/tests/testthat/_snaps/ggplot-errorbar/errorbar-unique-groups.svg b/tests/testthat/_snaps/ggplot-errorbar/errorbar-unique-groups.svg index 2ed1cbd84d..4a8f1a1fc8 100644 --- a/tests/testthat/_snaps/ggplot-errorbar/errorbar-unique-groups.svg +++ b/tests/testthat/_snaps/ggplot-errorbar/errorbar-unique-groups.svg @@ -1 +1 @@ -1212345group1234trtresp +1212345group1234trtresp diff --git a/tests/testthat/_snaps/ggplot-errorbar/errorbar.svg b/tests/testthat/_snaps/ggplot-errorbar/errorbar.svg index c649b2f318..d530cfe4d3 100644 --- a/tests/testthat/_snaps/ggplot-errorbar/errorbar.svg +++ b/tests/testthat/_snaps/ggplot-errorbar/errorbar.svg @@ -1 +1 @@ -345678915202530cylm +345678915202530cylm diff --git a/tests/testthat/_snaps/ggplot-facets/3-panels.svg b/tests/testthat/_snaps/ggplot-facets/3-panels.svg index a634bfe4e2..09b6db3468 100644 --- a/tests/testthat/_snaps/ggplot-facets/3-panels.svg +++ b/tests/testthat/_snaps/ggplot-facets/3-panels.svg @@ -1 +1 @@ -0.000.250.500.751.000.000.250.500.751.000.000.250.500.751.000.000.250.500.751.00xyabc +0.000.250.500.751.000.000.250.500.751.000.000.250.500.751.000.000.250.500.751.00xyabc diff --git a/tests/testthat/_snaps/ggplot-facets/barley.svg b/tests/testthat/_snaps/ggplot-facets/barley.svg index b1acebfdff..e381a09743 100644 --- a/tests/testthat/_snaps/ggplot-facets/barley.svg +++ b/tests/testthat/_snaps/ggplot-facets/barley.svg @@ -1 +1 @@ -SvansotaNo. 462ManchuriaNo. 475VelvetPeatlandGlabronNo. 457Wisconsin No. 38TrebiSvansotaNo. 462ManchuriaNo. 475VelvetPeatlandGlabronNo. 457Wisconsin No. 38TrebiSvansotaNo. 462ManchuriaNo. 475VelvetPeatlandGlabronNo. 457Wisconsin No. 38TrebiSvansotaNo. 462ManchuriaNo. 475VelvetPeatlandGlabronNo. 457Wisconsin No. 38TrebiSvansotaNo. 462ManchuriaNo. 475VelvetPeatlandGlabronNo. 457Wisconsin No. 38Trebi2030405060SvansotaNo. 462ManchuriaNo. 475VelvetPeatlandGlabronNo. 457Wisconsin No. 38Trebiyear19321931yieldvarietyGrand RapidsDuluthUniversity FarmMorrisCrookstonWaseca +SvansotaNo. 462ManchuriaNo. 475VelvetPeatlandGlabronNo. 457Wisconsin No. 38TrebiSvansotaNo. 462ManchuriaNo. 475VelvetPeatlandGlabronNo. 457Wisconsin No. 38TrebiSvansotaNo. 462ManchuriaNo. 475VelvetPeatlandGlabronNo. 457Wisconsin No. 38TrebiSvansotaNo. 462ManchuriaNo. 475VelvetPeatlandGlabronNo. 457Wisconsin No. 38TrebiSvansotaNo. 462ManchuriaNo. 475VelvetPeatlandGlabronNo. 457Wisconsin No. 38Trebi2030405060SvansotaNo. 462ManchuriaNo. 475VelvetPeatlandGlabronNo. 457Wisconsin No. 38Trebiyear19321931yieldvarietyGrand RapidsDuluthUniversity FarmMorrisCrookstonWaseca diff --git a/tests/testthat/_snaps/ggplot-facets/facet-grid-free-x.svg b/tests/testthat/_snaps/ggplot-facets/facet-grid-free-x.svg index 5d91940ffc..36b62aa901 100644 --- a/tests/testthat/_snaps/ggplot-facets/facet-grid-free-x.svg +++ b/tests/testthat/_snaps/ggplot-facets/facet-grid-free-x.svg @@ -1 +1 @@ -234510152025234515202530mpgwt0101 +234510152025234515202530mpgwt0101 diff --git a/tests/testthat/_snaps/ggplot-facets/facet-grid-free-y.svg b/tests/testthat/_snaps/ggplot-facets/facet-grid-free-y.svg index 49ea936cf4..cde8d9507b 100644 --- a/tests/testthat/_snaps/ggplot-facets/facet-grid-free-y.svg +++ b/tests/testthat/_snaps/ggplot-facets/facet-grid-free-y.svg @@ -1 +1 @@ -23451015202530351.52.02.53.03.5101520253035mpgwt0101 +23451015202530351.52.02.53.03.5101520253035mpgwt0101 diff --git a/tests/testthat/_snaps/ggplot-facets/facet-grid-free.svg b/tests/testthat/_snaps/ggplot-facets/facet-grid-free.svg index 749a77e2ef..91585dbb69 100644 --- a/tests/testthat/_snaps/ggplot-facets/facet-grid-free.svg +++ b/tests/testthat/_snaps/ggplot-facets/facet-grid-free.svg @@ -1 +1 @@ -2345101520251.52.02.53.03.515202530mpgwt0101 +2345101520251.52.02.53.03.515202530mpgwt0101 diff --git a/tests/testthat/_snaps/ggplot-facets/facet-grid-labeller.svg b/tests/testthat/_snaps/ggplot-facets/facet-grid-labeller.svg index b64d9dea6a..83a3d217d0 100644 --- a/tests/testthat/_snaps/ggplot-facets/facet-grid-labeller.svg +++ b/tests/testthat/_snaps/ggplot-facets/facet-grid-labeller.svg @@ -1 +1 @@ -23451015202530352345101520253035mpgwtam: 0am: 1vs: 0vs: 1 +23451015202530352345101520253035mpgwtam: 0am: 1vs: 0vs: 1 diff --git a/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-mult.svg b/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-mult.svg index bcf00858fd..50481ff749 100644 --- a/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-mult.svg +++ b/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-mult.svg @@ -1 +1 @@ -25301.52.02.53.0181920212.753.003.253.5010.012.515.017.53.54.04.55.05.5mpgwt468 +25301.52.02.53.0181920212.753.003.253.5010.012.515.017.53.54.04.55.05.5mpgwt468 diff --git a/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-x.svg b/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-x.svg index 09a466f4d0..9dc2300fe9 100644 --- a/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-x.svg +++ b/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-x.svg @@ -1 +1 @@ -10.012.515.017.52345182022241518212423452530mpgwt00011011 +10.012.515.017.52345182022241518212423452530mpgwt00011011 diff --git a/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-y-2.svg b/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-y-2.svg old mode 100755 new mode 100644 index 314a630781..7c232c6140 --- a/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-y-2.svg +++ b/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-y-2.svg @@ -1 +1 @@ -025005000750010000125005101519701980199020002010400080001200020000022500025000027500030000032500019701980199020002010510152025datevaluepcepoppsavertuempmedunemploy +025005000750010000125005101519701980199020002010400080001200020000022500025000027500030000032500019701980199020002010510152025datevaluepcepoppsavertuempmedunemploy diff --git a/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-y.svg b/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-y.svg index c61edec570..e19577ae39 100644 --- a/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-y.svg +++ b/tests/testthat/_snaps/ggplot-facets/facet-wrap-free-y.svg @@ -1 +1 @@ -3.54.04.55.05.51015202530352.42.83.23.62.502.753.003.253.501015202530351.52.02.5mpgwt00011011 +3.54.04.55.05.51015202530352.42.83.23.62.502.753.003.253.501015202530351.52.02.5mpgwt00011011 diff --git a/tests/testthat/_snaps/ggplot-facets/facet-wrap-free.svg b/tests/testthat/_snaps/ggplot-facets/facet-wrap-free.svg index 5f6f8fc2c8..0de10fef70 100644 --- a/tests/testthat/_snaps/ggplot-facets/facet-wrap-free.svg +++ b/tests/testthat/_snaps/ggplot-facets/facet-wrap-free.svg @@ -1 +1 @@ -10.012.515.017.53.54.04.55.05.5182022242.502.753.003.253.50151821242.42.83.23.625301.52.02.5mpgwt00011011 +10.012.515.017.53.54.04.55.05.5182022242.502.753.003.253.50151821242.42.83.23.625301.52.02.5mpgwt00011011 diff --git a/tests/testthat/_snaps/ggplot-facets/facet-wrap-labeller.svg b/tests/testthat/_snaps/ggplot-facets/facet-wrap-labeller.svg index 039088e077..51847ed161 100644 --- a/tests/testthat/_snaps/ggplot-facets/facet-wrap-labeller.svg +++ b/tests/testthat/_snaps/ggplot-facets/facet-wrap-labeller.svg @@ -1 +1 @@ -1015202530352345101520253035mpgwtam: 0am: 1 +1015202530352345101520253035mpgwtam: 0am: 1 diff --git a/tests/testthat/_snaps/ggplot-facets/facet-wrap.svg b/tests/testthat/_snaps/ggplot-facets/facet-wrap.svg index ac90bfffc2..00487b8afc 100644 --- a/tests/testthat/_snaps/ggplot-facets/facet-wrap.svg +++ b/tests/testthat/_snaps/ggplot-facets/facet-wrap.svg @@ -1 +1 @@ -1015202530352345101520253035101520253035mpgwt468 +1015202530352345101520253035101520253035mpgwt468 diff --git a/tests/testthat/_snaps/ggplot-function/geomfunction.svg b/tests/testthat/_snaps/ggplot-function/geomfunction.svg index 015d3ccd9a..8709acff47 100644 --- a/tests/testthat/_snaps/ggplot-function/geomfunction.svg +++ b/tests/testthat/_snaps/ggplot-function/geomfunction.svg @@ -1 +1 @@ -123451020xy +123451020xy diff --git a/tests/testthat/_snaps/ggplot-function/stat-function.svg b/tests/testthat/_snaps/ggplot-function/stat-function.svg index 16629e1848..bba0270fc1 100644 --- a/tests/testthat/_snaps/ggplot-function/stat-function.svg +++ b/tests/testthat/_snaps/ggplot-function/stat-function.svg @@ -1 +1 @@ -123451020xy +123451020xy diff --git a/tests/testthat/_snaps/ggplot-heatmap/heatmap-discrete.svg b/tests/testthat/_snaps/ggplot-heatmap/heatmap-discrete.svg index 78366c2ee6..dac93c814b 100644 --- a/tests/testthat/_snaps/ggplot-heatmap/heatmap-discrete.svg +++ b/tests/testthat/_snaps/ggplot-heatmap/heatmap-discrete.svg @@ -1 +1 @@ -amcarbcyldispdratgearhpmpgqsecvswtamcarbcyldispdratgearhpmpgqsecvswt-0.50.00.51.0corvar1var2 +amcarbcyldispdratgearhpmpgqsecvswtamcarbcyldispdratgearhpmpgqsecvswt-0.50.00.51.0corvar1var2 diff --git a/tests/testthat/_snaps/ggplot-heatmap/heatmap-midpoint.svg b/tests/testthat/_snaps/ggplot-heatmap/heatmap-midpoint.svg index 9f0074863c..bd148140f5 100644 --- a/tests/testthat/_snaps/ggplot-heatmap/heatmap-midpoint.svg +++ b/tests/testthat/_snaps/ggplot-heatmap/heatmap-midpoint.svg @@ -1 +1 @@ -0.000.250.500.751.000.000.250.500.751.000.000.250.500.751.00zxy +0.000.250.500.751.000.000.250.500.751.000.000.250.500.751.00zxy diff --git a/tests/testthat/_snaps/ggplot-heatmap/heatmap.svg b/tests/testthat/_snaps/ggplot-heatmap/heatmap.svg index 53c7493737..b5b3bb2883 100644 --- a/tests/testthat/_snaps/ggplot-heatmap/heatmap.svg +++ b/tests/testthat/_snaps/ggplot-heatmap/heatmap.svg @@ -1 +1 @@ -MondayTuesdayWednesdayThursdayFridayMorningAfternoonEvening020406080valuedaytime +MondayTuesdayWednesdayThursdayFridayMorningAfternoonEvening020406080valuedaytime diff --git a/tests/testthat/_snaps/ggplot-heatmap/tile-no-fill.svg b/tests/testthat/_snaps/ggplot-heatmap/tile-no-fill.svg index 59eac083ca..59a2d34b17 100644 --- a/tests/testthat/_snaps/ggplot-heatmap/tile-no-fill.svg +++ b/tests/testthat/_snaps/ggplot-heatmap/tile-no-fill.svg @@ -1 +1 @@ -5100.51.01.52.02.5xy +5100.51.01.52.02.5xy diff --git a/tests/testthat/_snaps/ggplot-hex/hex-basic.svg b/tests/testthat/_snaps/ggplot-hex/hex-basic.svg index 5ca957f81a..e9f2112c61 100644 --- a/tests/testthat/_snaps/ggplot-hex/hex-basic.svg +++ b/tests/testthat/_snaps/ggplot-hex/hex-basic.svg @@ -1 +1 @@ -01234505000100001500010002000300040005000countcaratprice +01234505000100001500010002000300040005000countcaratprice diff --git a/tests/testthat/_snaps/ggplot-hex/hex-bins.svg b/tests/testthat/_snaps/ggplot-hex/hex-bins.svg index 768fc21ffa..efc8573776 100644 --- a/tests/testthat/_snaps/ggplot-hex/hex-bins.svg +++ b/tests/testthat/_snaps/ggplot-hex/hex-bins.svg @@ -1 +1 @@ -01234505000100001500020000250050007500countcaratprice +01234505000100001500020000250050007500countcaratprice diff --git a/tests/testthat/_snaps/ggplot-hex/hex-binwidth.svg b/tests/testthat/_snaps/ggplot-hex/hex-binwidth.svg index 01433f0f4f..1e3dc06b31 100644 --- a/tests/testthat/_snaps/ggplot-hex/hex-binwidth.svg +++ b/tests/testthat/_snaps/ggplot-hex/hex-binwidth.svg @@ -1 +1 @@ -0240500010000150002000050001000015000countcaratprice +0240500010000150002000050001000015000countcaratprice diff --git a/tests/testthat/_snaps/ggplot-histogram/histogram-counts.svg b/tests/testthat/_snaps/ggplot-histogram/histogram-counts.svg index 23c50b6c1a..9b334ee38d 100644 --- a/tests/testthat/_snaps/ggplot-histogram/histogram-counts.svg +++ b/tests/testthat/_snaps/ggplot-histogram/histogram-counts.svg @@ -1 +1 @@ -23450246wtcount +2345012345wtcount diff --git a/tests/testthat/_snaps/ggplot-histogram/histogram-date-bins.svg b/tests/testthat/_snaps/ggplot-histogram/histogram-date-bins.svg index c8665a3ae3..8bb51ff15e 100644 --- a/tests/testthat/_snaps/ggplot-histogram/histogram-date-bins.svg +++ b/tests/testthat/_snaps/ggplot-histogram/histogram-date-bins.svg @@ -1 +1 @@ -2013-072014-012014-072015-01020406080datecount +2013-072014-012014-072015-01020406080datecount diff --git a/tests/testthat/_snaps/ggplot-histogram/histogram-dates.svg b/tests/testthat/_snaps/ggplot-histogram/histogram-dates.svg index b58fa571d8..1980345982 100644 --- a/tests/testthat/_snaps/ggplot-histogram/histogram-dates.svg +++ b/tests/testthat/_snaps/ggplot-histogram/histogram-dates.svg @@ -1 +1 @@ -Jan 01Jan 15Feb 01Feb 15Mar 010123monthcount +Jan 01Jan 15Feb 01Feb 15Mar 010123monthcount diff --git a/tests/testthat/_snaps/ggplot-histogram/histogram-density-binwidth.svg b/tests/testthat/_snaps/ggplot-histogram/histogram-density-binwidth.svg index 82ba19fe00..f12bc523f8 100644 --- a/tests/testthat/_snaps/ggplot-histogram/histogram-density-binwidth.svg +++ b/tests/testthat/_snaps/ggplot-histogram/histogram-density-binwidth.svg @@ -1 +1 @@ -23450.00.20.40.6wtdensity +23450.00.20.40.6wtdensity diff --git a/tests/testthat/_snaps/ggplot-histogram/histogram-density.svg b/tests/testthat/_snaps/ggplot-histogram/histogram-density.svg index 51ac85d8e5..c6d455f617 100644 --- a/tests/testthat/_snaps/ggplot-histogram/histogram-density.svg +++ b/tests/testthat/_snaps/ggplot-histogram/histogram-density.svg @@ -1 +1 @@ -23450.00.51.01.5wtdensity +23450.00.30.60.91.2wtdensity diff --git a/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor-dodge.svg b/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor-dodge.svg index ca74cd6861..45d0c3ac1d 100644 --- a/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor-dodge.svg +++ b/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor-dodge.svg @@ -1 +1 @@ -234501234factor(vs)01wtcount +23450123factor(vs)01wtcount diff --git a/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor-facets.svg b/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor-facets.svg index d4082381ce..4ea40fbedf 100644 --- a/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor-facets.svg +++ b/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor-facets.svg @@ -1 +1 @@ -234502462345factor(vs)01wtcount01 +23450123452345factor(vs)01wtcount01 diff --git a/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor-identity.svg b/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor-identity.svg index 19de855334..7d418f0672 100644 --- a/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor-identity.svg +++ b/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor-identity.svg @@ -1 +1 @@ -234501234factor(vs)01wtcount +23450123factor(vs)01wtcount diff --git a/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor.svg b/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor.svg index b7dca71a96..3e68da3804 100644 --- a/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor.svg +++ b/tests/testthat/_snaps/ggplot-histogram/histogram-fill-factor.svg @@ -1 +1 @@ -23450246factor(vs)01wtcount +2345012345factor(vs)01wtcount diff --git a/tests/testthat/_snaps/ggplot-histogram/histogram-fill.svg b/tests/testthat/_snaps/ggplot-histogram/histogram-fill.svg index 8ef8074014..1302eee0a7 100644 --- a/tests/testthat/_snaps/ggplot-histogram/histogram-fill.svg +++ b/tests/testthat/_snaps/ggplot-histogram/histogram-fill.svg @@ -1 +1 @@ -234502460246countwtcount +2345012345012345countwtcount diff --git a/tests/testthat/_snaps/ggplot-histogram/histogram-fixed-fill-color.svg b/tests/testthat/_snaps/ggplot-histogram/histogram-fixed-fill-color.svg index 9f9f80adec..bdbff1c26a 100644 --- a/tests/testthat/_snaps/ggplot-histogram/histogram-fixed-fill-color.svg +++ b/tests/testthat/_snaps/ggplot-histogram/histogram-fixed-fill-color.svg @@ -1 +1 @@ -23450246wtcount +2345012345wtcount diff --git a/tests/testthat/_snaps/ggplot-histogram/histogram-posixt-bins.svg b/tests/testthat/_snaps/ggplot-histogram/histogram-posixt-bins.svg index c8665a3ae3..8bb51ff15e 100644 --- a/tests/testthat/_snaps/ggplot-histogram/histogram-posixt-bins.svg +++ b/tests/testthat/_snaps/ggplot-histogram/histogram-posixt-bins.svg @@ -1 +1 @@ -2013-072014-012014-072015-01020406080datecount +2013-072014-012014-072015-01020406080datecount diff --git a/tests/testthat/_snaps/ggplot-histogram/histogram-vline.svg b/tests/testthat/_snaps/ggplot-histogram/histogram-vline.svg index af63a897ee..24655e26a8 100644 --- a/tests/testthat/_snaps/ggplot-histogram/histogram-vline.svg +++ b/tests/testthat/_snaps/ggplot-histogram/histogram-vline.svg @@ -1 +1 @@ -23450246wtcount +2345012345wtcount diff --git a/tests/testthat/_snaps/ggplot-hline/hline-factor.svg b/tests/testthat/_snaps/ggplot-hline/hline-factor.svg index ede802bf90..0b1955a570 100644 --- a/tests/testthat/_snaps/ggplot-hline/hline-factor.svg +++ b/tests/testthat/_snaps/ggplot-hline/hline-factor.svg @@ -1 +1 @@ -controltreatment0.02.55.07.510.012.5condresult +controltreatment0.02.55.07.510.012.5condresult diff --git a/tests/testthat/_snaps/ggplot-hline/hline-multiple.svg b/tests/testthat/_snaps/ggplot-hline/hline-multiple.svg index adb80b42f2..216997380d 100644 --- a/tests/testthat/_snaps/ggplot-hline/hline-multiple.svg +++ b/tests/testthat/_snaps/ggplot-hline/hline-multiple.svg @@ -1 +1 @@ -01230123xy +01230123xy diff --git a/tests/testthat/_snaps/ggplot-hline/hline.svg b/tests/testthat/_snaps/ggplot-hline/hline.svg index 3d5ec05e4f..6524268763 100644 --- a/tests/testthat/_snaps/ggplot-hline/hline.svg +++ b/tests/testthat/_snaps/ggplot-hline/hline.svg @@ -1 +1 @@ -01230123xy +01230123xy diff --git a/tests/testthat/_snaps/ggplot-hline/split-hline-vline-abline.svg b/tests/testthat/_snaps/ggplot-hline/split-hline-vline-abline.svg index 29987b5fa6..b82fab37a1 100644 --- a/tests/testthat/_snaps/ggplot-hline/split-hline-vline-abline.svg +++ b/tests/testthat/_snaps/ggplot-hline/split-hline-vline-abline.svg @@ -1 +1 @@ -01230123xy +01230123xy diff --git a/tests/testthat/_snaps/ggplot-jitter/jitter-basic.svg b/tests/testthat/_snaps/ggplot-jitter/jitter-basic.svg index e4367c1212..23c1798316 100644 --- a/tests/testthat/_snaps/ggplot-jitter/jitter-basic.svg +++ b/tests/testthat/_snaps/ggplot-jitter/jitter-basic.svg @@ -1 +1 @@ -45678203040cylhwy +45678203040cylhwy diff --git a/tests/testthat/_snaps/ggplot-labels/factor-labels.svg b/tests/testthat/_snaps/ggplot-labels/factor-labels.svg index eecef86a59..024f1c52a7 100644 --- a/tests/testthat/_snaps/ggplot-labels/factor-labels.svg +++ b/tests/testthat/_snaps/ggplot-labels/factor-labels.svg @@ -1 +1 @@ -abcde05000100001500020000Cutcount +abcde05000100001500020000Cutcount diff --git a/tests/testthat/_snaps/ggplot-labels/labels-angles.svg b/tests/testthat/_snaps/ggplot-labels/labels-angles.svg old mode 100755 new mode 100644 index ade134eefa..0fbd285591 --- a/tests/testthat/_snaps/ggplot-labels/labels-angles.svg +++ b/tests/testthat/_snaps/ggplot-labels/labels-angles.svg @@ -1 +1 @@ -40506015.017.520.0bill_length_mmbill_depth_mm +40506015.017.520.0bill_length_mmbill_depth_mm diff --git a/tests/testthat/_snaps/ggplot-labels/labels-ggtitle.svg b/tests/testthat/_snaps/ggplot-labels/labels-ggtitle.svg old mode 100755 new mode 100644 index b6930b30c0..31096ee68d --- a/tests/testthat/_snaps/ggplot-labels/labels-ggtitle.svg +++ b/tests/testthat/_snaps/ggplot-labels/labels-ggtitle.svg @@ -1 +1 @@ -40506015.017.520.0My amazing plot!bill_length_mmbill_depth_mm +40506015.017.520.0My amazing plot!bill_length_mmbill_depth_mm diff --git a/tests/testthat/_snaps/ggplot-labels/labels-scale-x-continuous-name.svg b/tests/testthat/_snaps/ggplot-labels/labels-scale-x-continuous-name.svg deleted file mode 100644 index c6a2e2fa76..0000000000 --- a/tests/testthat/_snaps/ggplot-labels/labels-scale-x-continuous-name.svg +++ /dev/null @@ -1 +0,0 @@ -40506015.017.520.0bill lengthbill_depth_mm diff --git a/tests/testthat/_snaps/ggplot-labels/labels-ylab.svg b/tests/testthat/_snaps/ggplot-labels/labels-ylab.svg index 1ce257ca25..c56fc48a7d 100644 --- a/tests/testthat/_snaps/ggplot-labels/labels-ylab.svg +++ b/tests/testthat/_snaps/ggplot-labels/labels-ylab.svg @@ -1 +1 @@ -40506015.017.520.0bill_length_mmbill depth +40506015.017.520.0bill_length_mmbill depth diff --git a/tests/testthat/_snaps/ggplot-labels/labs-element-blank.svg b/tests/testthat/_snaps/ggplot-labels/labs-element-blank.svg index 09547ea0f8..0f28e2b07a 100644 --- a/tests/testthat/_snaps/ggplot-labels/labs-element-blank.svg +++ b/tests/testthat/_snaps/ggplot-labels/labs-element-blank.svg @@ -1 +1 @@ -40506015.017.520.0speciesAdelieChinstrapGentoo +40506015.017.520.0speciesAdelieChinstrapGentoo diff --git a/tests/testthat/_snaps/ggplot-legend/guide-aes-none.svg b/tests/testthat/_snaps/ggplot-legend/guide-aes-none.svg index a20c3f2006..8faa71dc34 100644 --- a/tests/testthat/_snaps/ggplot-legend/guide-aes-none.svg +++ b/tests/testthat/_snaps/ggplot-legend/guide-aes-none.svg @@ -1 +1 @@ -Jan 02Jan 04Jan 06Jan 08Jan 10-2-1012SeriesMeanQCSeriesASeriesBDateValues +Jan 02Jan 04Jan 06Jan 08Jan 10-2-1012colourMeanQCSeriesASeriesBDateMean diff --git a/tests/testthat/_snaps/ggplot-legend/legend-hide-legend.svg b/tests/testthat/_snaps/ggplot-legend/legend-hide-legend.svg deleted file mode 100644 index 0fe238e7ff..0000000000 --- a/tests/testthat/_snaps/ggplot-legend/legend-hide-legend.svg +++ /dev/null @@ -1 +0,0 @@ -40506015.017.520.0bill_length_mmbill_depth_mm diff --git a/tests/testthat/_snaps/ggplot-legend/legend-hide.svg b/tests/testthat/_snaps/ggplot-legend/legend-hide.svg index 1eac5ec625..88c041570e 100644 --- a/tests/testthat/_snaps/ggplot-legend/legend-hide.svg +++ b/tests/testthat/_snaps/ggplot-legend/legend-hide.svg @@ -1 +1 @@ -1015202530352345mpgwt +1015202530352345mpgwt diff --git a/tests/testthat/_snaps/ggplot-legend/legend-many-legend-items.svg b/tests/testthat/_snaps/ggplot-legend/legend-many-legend-items.svg index 68d634ed8a..412e5e9a70 100644 --- a/tests/testthat/_snaps/ggplot-legend/legend-many-legend-items.svg +++ b/tests/testthat/_snaps/ggplot-legend/legend-many-legend-items.svg @@ -1 +1 @@ -AARAAUAHRAHUALRALUHARHAUHHRHHUHLRHLULARLAULHRLHU050100150200categoryAARAAUAHRAHUALRALUHARHAUHHRHHUHLRHLULARLAULHRLHUcategorycount +AARAAUAHRAHUALRALUHARHAUHHRHHUHLRHLULARLAULHRLHU050100150200categoryAARAAUAHRAHUALRALUHARHAUHHRHHUHLRHLULARLAULHRLHUcategorycount diff --git a/tests/testthat/_snaps/ggplot-legend/legend-one-entry.svg b/tests/testthat/_snaps/ggplot-legend/legend-one-entry.svg old mode 100755 new mode 100644 index 8fe7fb905f..ca23482179 --- a/tests/testthat/_snaps/ggplot-legend/legend-one-entry.svg +++ b/tests/testthat/_snaps/ggplot-legend/legend-one-entry.svg @@ -1 +1 @@ -40506015.017.520.0AllAll speciesbill_length_mmbill_depth_mm +40506015.017.520.0AllAll speciesbill_length_mmbill_depth_mm diff --git a/tests/testthat/_snaps/ggplot-legend/legend-varying-aes-guide.svg b/tests/testthat/_snaps/ggplot-legend/legend-varying-aes-guide.svg new file mode 100644 index 0000000000..f9a6aa8e5b --- /dev/null +++ b/tests/testthat/_snaps/ggplot-legend/legend-varying-aes-guide.svg @@ -0,0 +1 @@ +0.40.60.81.0bluegreenredxz diff --git a/tests/testthat/_snaps/ggplot-legend/legend-very-long-legend-items.svg b/tests/testthat/_snaps/ggplot-legend/legend-very-long-legend-items.svg index a51cdf9442..1d3c009246 100644 --- a/tests/testthat/_snaps/ggplot-legend/legend-very-long-legend-items.svg +++ b/tests/testthat/_snaps/ggplot-legend/legend-very-long-legend-items.svg @@ -1 +1 @@ -ABCDEFGHIJ0246cat2AAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCcat1count +ABCDEFGHIJ0246cat2AAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCcat1count diff --git a/tests/testthat/_snaps/ggplot-legend/respect-guides.svg b/tests/testthat/_snaps/ggplot-legend/respect-guides.svg new file mode 100644 index 0000000000..7d581ec51f --- /dev/null +++ b/tests/testthat/_snaps/ggplot-legend/respect-guides.svg @@ -0,0 +1 @@ +0.000.250.500.750.81.01.21.51.8Period(1Year,Fast)(1Year,Slow)(3Month,Fast)(3Month,Slow)Value diff --git a/tests/testthat/_snaps/ggplot-legend/scatter-legend.svg b/tests/testthat/_snaps/ggplot-legend/scatter-legend.svg index 957ecb8e73..0ca901f7d3 100644 --- a/tests/testthat/_snaps/ggplot-legend/scatter-legend.svg +++ b/tests/testthat/_snaps/ggplot-legend/scatter-legend.svg @@ -1 +1 @@ -1015202530352345factor(vs)factor(cyl)(0,4)(0,6)(0,8)(1,4)(1,6)mpgwt +1015202530352345factor(vs)factor(cyl)(0,4)(0,6)(0,8)(1,4)(1,6)mpgwt diff --git a/tests/testthat/_snaps/ggplot-lines/line-milliseconds.svg b/tests/testthat/_snaps/ggplot-lines/line-milliseconds.svg index 596b7e2547..583ea7cc6b 100644 --- a/tests/testthat/_snaps/ggplot-lines/line-milliseconds.svg +++ b/tests/testthat/_snaps/ggplot-lines/line-milliseconds.svg @@ -1 +1 @@ -00:00:00Jan 1, 197000:00:1500:00:3000:00:4500:01:0000:01:1500:01:30−1−0.500.51ty +00:00:00Jan 1, 197000:00:1500:00:3000:00:4500:01:0000:01:1500:01:30−1−0.500.51ty diff --git a/tests/testthat/_snaps/ggplot-lines/linetype-colors.svg b/tests/testthat/_snaps/ggplot-lines/linetype-colors.svg index 6cc2c9f04d..ca2886acd8 100644 --- a/tests/testthat/_snaps/ggplot-lines/linetype-colors.svg +++ b/tests/testthat/_snaps/ggplot-lines/linetype-colors.svg @@ -1 +1 @@ --2-10120.000.250.500.751.00variabley1y2xvalue +-2-10120.000.250.500.751.00variabley1y2xvalue diff --git a/tests/testthat/_snaps/ggplot-lines/linetype-types.svg b/tests/testthat/_snaps/ggplot-lines/linetype-types.svg index 6dab503d86..da9da6022d 100644 --- a/tests/testthat/_snaps/ggplot-lines/linetype-types.svg +++ b/tests/testthat/_snaps/ggplot-lines/linetype-types.svg @@ -1 +1 @@ -246246as.factor(x)123456xy +246246as.factor(x)123456xy diff --git a/tests/testthat/_snaps/ggplot-map/map-facet.svg b/tests/testthat/_snaps/ggplot-map/map-facet.svg index b375480779..b882328a6a 100644 --- a/tests/testthat/_snaps/ggplot-map/map-facet.svg +++ b/tests/testthat/_snaps/ggplot-map/map-facet.svg @@ -1 +1 @@ -253035404550-120-100-80253035404550-120-100-80100200300valuexyAssaultMurderRapeUrbanPop +253035404550-120-100-80253035404550-120-100-80100200300valueAssaultMurderRapeUrbanPop diff --git a/tests/testthat/_snaps/ggplot-path/path-colored-groups-stay-together.svg b/tests/testthat/_snaps/ggplot-path/path-colored-groups-stay-together.svg index 5ec7af553f..f7db9c2f5a 100644 --- a/tests/testthat/_snaps/ggplot-path/path-colored-groups-stay-together.svg +++ b/tests/testthat/_snaps/ggplot-path/path-colored-groups-stay-together.svg @@ -1 +1 @@ --2-1012-2-1012gpositivenegativexy +-2-1012-2-1012gpositivenegativexy diff --git a/tests/testthat/_snaps/ggplot-path/path-colors.svg b/tests/testthat/_snaps/ggplot-path/path-colors.svg index fa7349a704..687e7d1e91 100644 --- a/tests/testthat/_snaps/ggplot-path/path-colors.svg +++ b/tests/testthat/_snaps/ggplot-path/path-colors.svg @@ -1 +1 @@ -1.001.251.501.752.001.001.251.501.752.001.001.251.501.752.00yxy +1.001.251.501.752.001.001.251.501.752.001.001.251.501.752.00yxy diff --git a/tests/testthat/_snaps/ggplot-path/path-colors2.svg b/tests/testthat/_snaps/ggplot-path/path-colors2.svg index bdbb31640b..ed58f0bf38 100644 --- a/tests/testthat/_snaps/ggplot-path/path-colors2.svg +++ b/tests/testthat/_snaps/ggplot-path/path-colors2.svg @@ -1 +1 @@ -1.001.251.501.752.001.001.251.501.752.00paste0("FOO", y)FOO1FOO2xy +1.001.251.501.752.001.001.251.501.752.00paste0("FOO", y)FOO1FOO2xy diff --git a/tests/testthat/_snaps/ggplot-path/path-line-symbols.svg b/tests/testthat/_snaps/ggplot-path/path-line-symbols.svg index 9c5fd660e5..13cd9fdaa2 100644 --- a/tests/testthat/_snaps/ggplot-path/path-line-symbols.svg +++ b/tests/testthat/_snaps/ggplot-path/path-line-symbols.svg @@ -1 +1 @@ -LunchDinner14151617sexFemaleMaletimetotal_bill +LunchDinner14151617sexFemaleMaletimetotal_bill diff --git a/tests/testthat/_snaps/ggplot-path/path-lines-diff-from-paths.svg b/tests/testthat/_snaps/ggplot-path/path-lines-diff-from-paths.svg index 64dfa51f37..de8924b03b 100644 --- a/tests/testthat/_snaps/ggplot-path/path-lines-diff-from-paths.svg +++ b/tests/testthat/_snaps/ggplot-path/path-lines-diff-from-paths.svg @@ -1 +1 @@ -1.01.52.02.53.00.000.250.500.751.00xy +1.01.52.02.53.00.000.250.500.751.00xy diff --git a/tests/testthat/_snaps/ggplot-point/all-shapes.svg b/tests/testthat/_snaps/ggplot-point/all-shapes.svg index 5d4609088a..b2d160f56b 100644 --- a/tests/testthat/_snaps/ggplot-point/all-shapes.svg +++ b/tests/testthat/_snaps/ggplot-point/all-shapes.svg @@ -1 +1 @@ --0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.0500123456789101112131415161718192021222324xy0123456789101112131415161718192021222324 +-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.050-0.050-0.0250.0000.0250.0500123456789101112131415161718192021222324xy0123456789101112131415161718192021222324 diff --git a/tests/testthat/_snaps/ggplot-point/open-shapes.svg b/tests/testthat/_snaps/ggplot-point/open-shapes.svg index e00266818e..057f058ca8 100644 --- a/tests/testthat/_snaps/ggplot-point/open-shapes.svg +++ b/tests/testthat/_snaps/ggplot-point/open-shapes.svg @@ -1 +1 @@ -1015202530352345mpgwt +1015202530352345mpgwt diff --git a/tests/testthat/_snaps/ggplot-point/point-flip.svg b/tests/testthat/_snaps/ggplot-point/point-flip.svg old mode 100755 new mode 100644 index 4f22b75dce..e647a0631e --- a/tests/testthat/_snaps/ggplot-point/point-flip.svg +++ b/tests/testthat/_snaps/ggplot-point/point-flip.svg @@ -1 +1 @@ -050001000015000123pricecarat +050001000015000123pricecarat diff --git a/tests/testthat/_snaps/ggplot-point/point-size-alpha.svg b/tests/testthat/_snaps/ggplot-point/point-size-alpha.svg index fb8826dd88..3d18e14f40 100644 --- a/tests/testthat/_snaps/ggplot-point/point-size-alpha.svg +++ b/tests/testthat/_snaps/ggplot-point/point-size-alpha.svg @@ -1 +1 @@ -456782345cylwt +456782345cylwt diff --git a/tests/testthat/_snaps/ggplot-point/point-size-alpha2.svg b/tests/testthat/_snaps/ggplot-point/point-size-alpha2.svg index e4e6424e2e..3d182154b9 100644 --- a/tests/testthat/_snaps/ggplot-point/point-size-alpha2.svg +++ b/tests/testthat/_snaps/ggplot-point/point-size-alpha2.svg @@ -1 +1 @@ -060810-1012xy +060810-1012xy diff --git a/tests/testthat/_snaps/ggplot-polygons/polygon-aes-color.svg b/tests/testthat/_snaps/ggplot-polygons/polygon-aes-color.svg index 7231b5a716..45ef65ec40 100644 --- a/tests/testthat/_snaps/ggplot-polygons/polygon-aes-color.svg +++ b/tests/testthat/_snaps/ggplot-polygons/polygon-aes-color.svg @@ -1 +1 @@ -101112130.000.250.500.751.00lableftrightxy +101112130.000.250.500.751.00lableftrightxy diff --git a/tests/testthat/_snaps/ggplot-polygons/polygon-aes-fill.svg b/tests/testthat/_snaps/ggplot-polygons/polygon-aes-fill.svg index 5042d54dbf..b6d0ebed72 100644 --- a/tests/testthat/_snaps/ggplot-polygons/polygon-aes-fill.svg +++ b/tests/testthat/_snaps/ggplot-polygons/polygon-aes-fill.svg @@ -1 +1 @@ -101112130.000.250.500.751.00lableftrightxy +101112130.000.250.500.751.00lableftrightxy diff --git a/tests/testthat/_snaps/ggplot-polygons/polygon-black.svg b/tests/testthat/_snaps/ggplot-polygons/polygon-black.svg index f1972bde00..17df596ffb 100644 --- a/tests/testthat/_snaps/ggplot-polygons/polygon-black.svg +++ b/tests/testthat/_snaps/ggplot-polygons/polygon-black.svg @@ -1 +1 @@ -101112130.000.250.500.751.00xy +101112130.000.250.500.751.00xy diff --git a/tests/testthat/_snaps/ggplot-polygons/polygon-color-aes-fill.svg b/tests/testthat/_snaps/ggplot-polygons/polygon-color-aes-fill.svg index 8138b1e61e..242041bb17 100644 --- a/tests/testthat/_snaps/ggplot-polygons/polygon-color-aes-fill.svg +++ b/tests/testthat/_snaps/ggplot-polygons/polygon-color-aes-fill.svg @@ -1 +1 @@ -101112130.000.250.500.751.00lableftrightxy +101112130.000.250.500.751.00lableftrightxy diff --git a/tests/testthat/_snaps/ggplot-polygons/polygon-color-fill-aes-linetype.svg b/tests/testthat/_snaps/ggplot-polygons/polygon-color-fill-aes-linetype.svg index 9465f76437..3bb952748d 100644 --- a/tests/testthat/_snaps/ggplot-polygons/polygon-color-fill-aes-linetype.svg +++ b/tests/testthat/_snaps/ggplot-polygons/polygon-color-fill-aes-linetype.svg @@ -1 +1 @@ -101112130.000.250.500.751.00lableftrightxy +101112130.000.250.500.751.00lableftrightxy diff --git a/tests/testthat/_snaps/ggplot-polygons/polygon-color-fill-aes-size.svg b/tests/testthat/_snaps/ggplot-polygons/polygon-color-fill-aes-size.svg index eeed59b7f1..bdd5692218 100644 --- a/tests/testthat/_snaps/ggplot-polygons/polygon-color-fill-aes-size.svg +++ b/tests/testthat/_snaps/ggplot-polygons/polygon-color-fill-aes-size.svg @@ -1 +1 @@ -101112130.000.250.500.751.00lableftrightxy +101112130.000.250.500.751.00lableftrightxy diff --git a/tests/testthat/_snaps/ggplot-polygons/polygon-star-fill-color.svg b/tests/testthat/_snaps/ggplot-polygons/polygon-star-fill-color.svg index 03f2d08b34..94d80d36fa 100644 --- a/tests/testthat/_snaps/ggplot-polygons/polygon-star-fill-color.svg +++ b/tests/testthat/_snaps/ggplot-polygons/polygon-star-fill-color.svg @@ -1 +1 @@ -048120.00.51.01.52.0groupleftrightxy +048120.00.51.01.52.0groupleftrightxy diff --git a/tests/testthat/_snaps/ggplot-polygons/polygon-star-group-color.svg b/tests/testthat/_snaps/ggplot-polygons/polygon-star-group-color.svg index d7fa657933..55c1c16df8 100644 --- a/tests/testthat/_snaps/ggplot-polygons/polygon-star-group-color.svg +++ b/tests/testthat/_snaps/ggplot-polygons/polygon-star-group-color.svg @@ -1 +1 @@ -048120.00.51.01.52.0xy +048120.00.51.01.52.0xy diff --git a/tests/testthat/_snaps/ggplot-polygons/polygon-star-group.svg b/tests/testthat/_snaps/ggplot-polygons/polygon-star-group.svg index f3493f31f1..d7ef8f8995 100644 --- a/tests/testthat/_snaps/ggplot-polygons/polygon-star-group.svg +++ b/tests/testthat/_snaps/ggplot-polygons/polygon-star-group.svg @@ -1 +1 @@ -048120.00.51.01.52.0xy +048120.00.51.01.52.0xy diff --git a/tests/testthat/_snaps/ggplot-polygons/polygons-canada-borders.svg b/tests/testthat/_snaps/ggplot-polygons/polygons-canada-borders.svg index afa5dd0510..9092b3fff5 100644 --- a/tests/testthat/_snaps/ggplot-polygons/polygons-canada-borders.svg +++ b/tests/testthat/_snaps/ggplot-polygons/polygons-canada-borders.svg @@ -1 +1 @@ --125-100-75-504050607080longlat +-125-100-75-504050607080 diff --git a/tests/testthat/_snaps/ggplot-rect/rect-black.svg b/tests/testthat/_snaps/ggplot-rect/rect-black.svg index 92ac20958d..6f2bb7cbba 100644 --- a/tests/testthat/_snaps/ggplot-rect/rect-black.svg +++ b/tests/testthat/_snaps/ggplot-rect/rect-black.svg @@ -1 +1 @@ -369369 +369369 diff --git a/tests/testthat/_snaps/ggplot-rect/rect-black4.svg b/tests/testthat/_snaps/ggplot-rect/rect-black4.svg index cf663a74e3..ff6e03978d 100644 --- a/tests/testthat/_snaps/ggplot-rect/rect-black4.svg +++ b/tests/testthat/_snaps/ggplot-rect/rect-black4.svg @@ -1 +1 @@ -12340.000.250.500.751.00 +12340.000.250.500.751.00 diff --git a/tests/testthat/_snaps/ggplot-rect/rect-color.svg b/tests/testthat/_snaps/ggplot-rect/rect-color.svg index aa9b5d5753..0637a71c77 100644 --- a/tests/testthat/_snaps/ggplot-rect/rect-color.svg +++ b/tests/testthat/_snaps/ggplot-rect/rect-color.svg @@ -1 +1 @@ -12340.000.250.500.751.00statuscoolnot +12340.000.250.500.751.00statuscoolnot diff --git a/tests/testthat/_snaps/ggplot-rect/rect-fill-color.svg b/tests/testthat/_snaps/ggplot-rect/rect-fill-color.svg index 910c1d0b3f..cfa53d7b4c 100644 --- a/tests/testthat/_snaps/ggplot-rect/rect-fill-color.svg +++ b/tests/testthat/_snaps/ggplot-rect/rect-fill-color.svg @@ -1 +1 @@ -12340.000.250.500.751.00statuscoolnot +12340.000.250.500.751.00statuscoolnot diff --git a/tests/testthat/_snaps/ggplot-rect/rect-fill-hex-alpha.svg b/tests/testthat/_snaps/ggplot-rect/rect-fill-hex-alpha.svg index 0871b4dfe5..361eaae375 100644 --- a/tests/testthat/_snaps/ggplot-rect/rect-fill-hex-alpha.svg +++ b/tests/testthat/_snaps/ggplot-rect/rect-fill-hex-alpha.svg @@ -1 +1 @@ -1.001.251.501.752.001.001.251.501.752.00 +1.001.251.501.752.001.001.251.501.752.00 diff --git a/tests/testthat/_snaps/ggplot-rect/rect-fill.svg b/tests/testthat/_snaps/ggplot-rect/rect-fill.svg index 8102e9a2c8..e6d89c35ea 100644 --- a/tests/testthat/_snaps/ggplot-rect/rect-fill.svg +++ b/tests/testthat/_snaps/ggplot-rect/rect-fill.svg @@ -1 +1 @@ -12340.000.250.500.751.00statuscoolnot +12340.000.250.500.751.00statuscoolnot diff --git a/tests/testthat/_snaps/ggplot-ribbon/ribbon-alpha.svg b/tests/testthat/_snaps/ggplot-ribbon/ribbon-alpha.svg index 4e4ee12974..4489454ac1 100644 --- a/tests/testthat/_snaps/ggplot-ribbon/ribbon-alpha.svg +++ b/tests/testthat/_snaps/ggplot-ribbon/ribbon-alpha.svg @@ -1 +1 @@ -18751900192519501975575.0577.5580.0582.5year +18751900192519501975575.0577.5580.0582.5year diff --git a/tests/testthat/_snaps/ggplot-ribbon/ribbon-colour.svg b/tests/testthat/_snaps/ggplot-ribbon/ribbon-colour.svg index b5ee09d283..c7e2d06bac 100644 --- a/tests/testthat/_snaps/ggplot-ribbon/ribbon-colour.svg +++ b/tests/testthat/_snaps/ggplot-ribbon/ribbon-colour.svg @@ -1 +1 @@ --5.0-2.50.02.55.0576578580582factor(decade)1880189019001910192019301940195019601970diff +-5.0-2.50.02.55.0576578580582factor(decade)1880189019001910192019301940195019601970diff diff --git a/tests/testthat/_snaps/ggplot-ribbon/ribbon-fill.svg b/tests/testthat/_snaps/ggplot-ribbon/ribbon-fill.svg index b318846e69..ae0455e51e 100644 --- a/tests/testthat/_snaps/ggplot-ribbon/ribbon-fill.svg +++ b/tests/testthat/_snaps/ggplot-ribbon/ribbon-fill.svg @@ -1 +1 @@ --5.0-2.50.02.55.0576578580582factor(decade)1880189019001910192019301940195019601970diff +-5.0-2.50.02.55.0576578580582factor(decade)1880189019001910192019301940195019601970diff diff --git a/tests/testthat/_snaps/ggplot-ribbon/ribbon-group.svg b/tests/testthat/_snaps/ggplot-ribbon/ribbon-group.svg index c1bd65537f..8c765840e9 100644 --- a/tests/testthat/_snaps/ggplot-ribbon/ribbon-group.svg +++ b/tests/testthat/_snaps/ggplot-ribbon/ribbon-group.svg @@ -1 +1 @@ --5.0-2.50.02.55.0576578580582diff +-5.0-2.50.02.55.0576578580582diff diff --git a/tests/testthat/_snaps/ggplot-segment/segment-multiple-non-numeric.svg b/tests/testthat/_snaps/ggplot-segment/segment-multiple-non-numeric.svg index 79d8ce82d2..4ce79186eb 100644 --- a/tests/testthat/_snaps/ggplot-segment/segment-multiple-non-numeric.svg +++ b/tests/testthat/_snaps/ggplot-segment/segment-multiple-non-numeric.svg @@ -1 +1 @@ -0.81.21.62.0901001101201301.001.251.501.752.00campaigncampaigndonation +0.81.21.62.0901001101201301.001.251.501.752.00campaigncampaigndonation diff --git a/tests/testthat/_snaps/ggplot-segment/segment.svg b/tests/testthat/_snaps/ggplot-segment/segment.svg index 2dd5777cf5..290b7b3b32 100644 --- a/tests/testthat/_snaps/ggplot-segment/segment.svg +++ b/tests/testthat/_snaps/ggplot-segment/segment.svg @@ -1 +1 @@ -0.000.250.500.751.000.000.250.500.751.00xy +0.000.250.500.751.000.000.250.500.751.00xy diff --git a/tests/testthat/_snaps/ggplot-sf/sf-aspect.svg b/tests/testthat/_snaps/ggplot-sf/sf-aspect.svg index 4102cc0b67..faa3ae8cbf 100644 --- a/tests/testthat/_snaps/ggplot-sf/sf-aspect.svg +++ b/tests/testthat/_snaps/ggplot-sf/sf-aspect.svg @@ -1 +1 @@ -84 ° W82 ° W80 ° W78 ° W76 ° W34.0 ° N34.5 ° N35.0 ° N35.5 ° N36.0 ° N36.5 ° N +84 ° W82 ° W80 ° W78 ° W76 ° W34.0 ° N34.5 ° N35.0 ° N35.5 ° N36.0 ° N36.5 ° N diff --git a/tests/testthat/_snaps/ggplot-sf/sf-axis-ticks.svg b/tests/testthat/_snaps/ggplot-sf/sf-axis-ticks.svg index b695954579..fd55356dab 100644 --- a/tests/testthat/_snaps/ggplot-sf/sf-axis-ticks.svg +++ b/tests/testthat/_snaps/ggplot-sf/sf-axis-ticks.svg @@ -1 +1 @@ -100 ° W 80 ° W 60 ° W 40 ° W 20 ° W40 ° N50 ° N60 ° N +100 ° W 80 ° W 60 ° W 40 ° W 20 ° W40 ° N50 ° N60 ° N diff --git a/tests/testthat/_snaps/ggplot-sf/sf-fill-text.svg b/tests/testthat/_snaps/ggplot-sf/sf-fill-text.svg index 2eb8628863..bd5af427f0 100644 --- a/tests/testthat/_snaps/ggplot-sf/sf-fill-text.svg +++ b/tests/testthat/_snaps/ggplot-sf/sf-fill-text.svg @@ -1 +1 @@ -84 ° W82 ° W80 ° W78 ° W76 ° W34.0 ° N34.5 ° N35.0 ° N35.5 ° N36.0 ° N36.5 ° N0.050.100.150.20AREA +84 ° W82 ° W80 ° W78 ° W76 ° W34.0 ° N34.5 ° N35.0 ° N35.5 ° N36.0 ° N36.5 ° N0.050.100.150.20AREA diff --git a/tests/testthat/_snaps/ggplot-sf/sf-geom-collection.svg b/tests/testthat/_snaps/ggplot-sf/sf-geom-collection.svg index 0c2b2ed82a..f1f00e98c5 100644 --- a/tests/testthat/_snaps/ggplot-sf/sf-geom-collection.svg +++ b/tests/testthat/_snaps/ggplot-sf/sf-geom-collection.svg @@ -1 +1 @@ -1234567-0.5-0.4-0.3-0.2-0.1 0.0 +1234567-0.5-0.4-0.3-0.2-0.1 0.0 diff --git a/tests/testthat/_snaps/ggplot-sf/sf-points.svg b/tests/testthat/_snaps/ggplot-sf/sf-points.svg index e62d92ead3..e7e38dba0f 100644 --- a/tests/testthat/_snaps/ggplot-sf/sf-points.svg +++ b/tests/testthat/_snaps/ggplot-sf/sf-points.svg @@ -1 +1 @@ -84 ° W82 ° W80 ° W78 ° W76 ° W34.0 ° N34.5 ° N35.0 ° N35.5 ° N36.0 ° N36.5 ° Nxy +84 ° W82 ° W80 ° W78 ° W76 ° W34.0 ° N34.5 ° N35.0 ° N35.5 ° N36.0 ° N36.5 ° N diff --git a/tests/testthat/_snaps/ggplot-sf/sf-theme-map.svg b/tests/testthat/_snaps/ggplot-sf/sf-theme-map.svg index 997109f4cb..3ca3ecc161 100644 --- a/tests/testthat/_snaps/ggplot-sf/sf-theme-map.svg +++ b/tests/testthat/_snaps/ggplot-sf/sf-theme-map.svg @@ -1 +1 @@ - + diff --git a/tests/testthat/_snaps/ggplot-sf/sf.svg b/tests/testthat/_snaps/ggplot-sf/sf.svg index 4102cc0b67..faa3ae8cbf 100644 --- a/tests/testthat/_snaps/ggplot-sf/sf.svg +++ b/tests/testthat/_snaps/ggplot-sf/sf.svg @@ -1 +1 @@ -84 ° W82 ° W80 ° W78 ° W76 ° W34.0 ° N34.5 ° N35.0 ° N35.5 ° N36.0 ° N36.5 ° N +84 ° W82 ° W80 ° W78 ° W76 ° W34.0 ° N34.5 ° N35.0 ° N35.5 ° N36.0 ° N36.5 ° N diff --git a/tests/testthat/_snaps/ggplot-size/size-global-scaling.svg b/tests/testthat/_snaps/ggplot-size/size-global-scaling.svg index 7be249954f..dfe2446ba1 100644 --- a/tests/testthat/_snaps/ggplot-size/size-global-scaling.svg +++ b/tests/testthat/_snaps/ggplot-size/size-global-scaling.svg @@ -1 +1 @@ -2340.40.81.21.6countrypopulationParaguayPeruPhilippineseduilln +2340.40.81.21.6populationcountryParaguayPeruPhilippineseduilln diff --git a/tests/testthat/_snaps/ggplot-size/size-is-a-vector.svg b/tests/testthat/_snaps/ggplot-size/size-is-a-vector.svg index fd237980dd..fd03bfd113 100644 --- a/tests/testthat/_snaps/ggplot-size/size-is-a-vector.svg +++ b/tests/testthat/_snaps/ggplot-size/size-is-a-vector.svg @@ -1 +1 @@ -40506015.017.520.0bill_length_mmbill_depth_mm +40506015.017.520.0bill_length_mmbill_depth_mm diff --git a/tests/testthat/_snaps/ggplot-smooth/smooth-basic.svg b/tests/testthat/_snaps/ggplot-smooth/smooth-basic.svg index 2506f47c2e..44a3885a75 100644 --- a/tests/testthat/_snaps/ggplot-smooth/smooth-basic.svg +++ b/tests/testthat/_snaps/ggplot-smooth/smooth-basic.svg @@ -1 +1 @@ -101520253035123456mpgwt +101520253035123456mpgwt diff --git a/tests/testthat/_snaps/ggplot-smooth/smooth-colour.svg b/tests/testthat/_snaps/ggplot-smooth/smooth-colour.svg old mode 100755 new mode 100644 index 67cc0b12d4..f4e756f2fd --- a/tests/testthat/_snaps/ggplot-smooth/smooth-colour.svg +++ b/tests/testthat/_snaps/ggplot-smooth/smooth-colour.svg @@ -1 +1 @@ -12305000100001500020000cutFairGoodVery GoodPremiumIdealcaratprice +12305000100001500020000cutFairGoodVery GoodPremiumIdealcaratprice diff --git a/tests/testthat/_snaps/ggplot-smooth/smooth-facet.svg b/tests/testthat/_snaps/ggplot-smooth/smooth-facet.svg old mode 100755 new mode 100644 index 007e99bd59..e79f872772 --- a/tests/testthat/_snaps/ggplot-smooth/smooth-facet.svg +++ b/tests/testthat/_snaps/ggplot-smooth/smooth-facet.svg @@ -1 +1 @@ -0500010000150002000012305000100001500020000123123cutFairGoodVery GoodPremiumIdealcaratpriceFairGoodVery GoodPremiumIdeal +0500010000150002000012305000100001500020000123123cutFairGoodVery GoodPremiumIdealcaratpriceFairGoodVery GoodPremiumIdeal diff --git a/tests/testthat/_snaps/ggplot-smooth/smooth-fill2.svg b/tests/testthat/_snaps/ggplot-smooth/smooth-fill2.svg old mode 100755 new mode 100644 index 7b70b851a9..eff0152619 --- a/tests/testthat/_snaps/ggplot-smooth/smooth-fill2.svg +++ b/tests/testthat/_snaps/ggplot-smooth/smooth-fill2.svg @@ -1 +1 @@ -12305000100001500020000cutFairGoodVery GoodPremiumIdealcaratprice +12305000100001500020000cutFairGoodVery GoodPremiumIdealcaratprice diff --git a/tests/testthat/_snaps/ggplot-smooth/smooth-group.svg b/tests/testthat/_snaps/ggplot-smooth/smooth-group.svg old mode 100755 new mode 100644 index 2be5891b6a..1136e92a57 --- a/tests/testthat/_snaps/ggplot-smooth/smooth-group.svg +++ b/tests/testthat/_snaps/ggplot-smooth/smooth-group.svg @@ -1 +1 @@ -12305000100001500020000caratprice +12305000100001500020000caratprice diff --git a/tests/testthat/_snaps/ggplot-smooth/smooth-se-false.svg b/tests/testthat/_snaps/ggplot-smooth/smooth-se-false.svg index beb87bd962..35eb4f06e1 100644 --- a/tests/testthat/_snaps/ggplot-smooth/smooth-se-false.svg +++ b/tests/testthat/_snaps/ggplot-smooth/smooth-se-false.svg @@ -1 +1 @@ -1015202530352345mpgwt +1015202530352345mpgwt diff --git a/tests/testthat/_snaps/ggplot-step/step-ecdf-multiple.svg b/tests/testthat/_snaps/ggplot-step/step-ecdf-multiple.svg index dbbec4d359..b849d2e983 100644 --- a/tests/testthat/_snaps/ggplot-step/step-ecdf-multiple.svg +++ b/tests/testthat/_snaps/ggplot-step/step-ecdf-multiple.svg @@ -1 +1 @@ --200200.000.250.500.751.00g12xy +-200200.000.250.500.751.00g12xecdf diff --git a/tests/testthat/_snaps/ggplot-step/step-ecdf.svg b/tests/testthat/_snaps/ggplot-step/step-ecdf.svg index 3ae8e62107..f9b84e1c8f 100644 --- a/tests/testthat/_snaps/ggplot-step/step-ecdf.svg +++ b/tests/testthat/_snaps/ggplot-step/step-ecdf.svg @@ -1 +1 @@ --200200.000.250.500.751.00xy +-200200.000.250.500.751.00xecdf diff --git a/tests/testthat/_snaps/ggplot-step/step-gg-hv.svg b/tests/testthat/_snaps/ggplot-step/step-gg-hv.svg index 218b1391a6..1dc4c90100 100644 --- a/tests/testthat/_snaps/ggplot-step/step-gg-hv.svg +++ b/tests/testthat/_snaps/ggplot-step/step-gg-hv.svg @@ -1 +1 @@ -4008001200160050100150200factor(Tree)12agecircumference +4008001200160050100150200factor(Tree)12agecircumference diff --git a/tests/testthat/_snaps/ggplot-step/step-gg-hvh.svg b/tests/testthat/_snaps/ggplot-step/step-gg-hvh.svg index 0195372ccc..33f830c206 100644 --- a/tests/testthat/_snaps/ggplot-step/step-gg-hvh.svg +++ b/tests/testthat/_snaps/ggplot-step/step-gg-hvh.svg @@ -1 +1 @@ -4008001200160050100150200factor(Tree)12agecircumference +4008001200160050100150200factor(Tree)12agecircumference diff --git a/tests/testthat/_snaps/ggplot-step/step-gg-vh.svg b/tests/testthat/_snaps/ggplot-step/step-gg-vh.svg index 46a47cb1b8..dd11fbcab9 100644 --- a/tests/testthat/_snaps/ggplot-step/step-gg-vh.svg +++ b/tests/testthat/_snaps/ggplot-step/step-gg-vh.svg @@ -1 +1 @@ -4008001200160050100150200factor(Tree)12agecircumference +4008001200160050100150200factor(Tree)12agecircumference diff --git a/tests/testthat/_snaps/ggplot-step/step-gg-vhv.svg b/tests/testthat/_snaps/ggplot-step/step-gg-vhv.svg index d10f58a217..44493a5b23 100644 --- a/tests/testthat/_snaps/ggplot-step/step-gg-vhv.svg +++ b/tests/testthat/_snaps/ggplot-step/step-gg-vhv.svg @@ -1 +1 @@ -4008001200160050100150200factor(Tree)12agecircumference +4008001200160050100150200factor(Tree)12agecircumference diff --git a/tests/testthat/_snaps/ggplot-summary/stat-summary.svg b/tests/testthat/_snaps/ggplot-summary/stat-summary.svg new file mode 100644 index 0000000000..3734737f5e --- /dev/null +++ b/tests/testthat/_snaps/ggplot-summary/stat-summary.svg @@ -0,0 +1 @@ +setosaversicolorvirginica5678SpeciesSepal.Length diff --git a/tests/testthat/_snaps/ggplot-text/text-colour.svg b/tests/testthat/_snaps/ggplot-text/text-colour.svg index 87e8ad8072..ceca677a50 100644 --- a/tests/testthat/_snaps/ggplot-text/text-colour.svg +++ b/tests/testthat/_snaps/ggplot-text/text-colour.svg @@ -1 +1 @@ -HUNTSVILLEMOBILEBIRMINGHAMMONTGOMERYTUCSONPEORIA01020-505DivisionEast South CentralAaMountainAacoord.1coord.2 +HUNTSVILLEMOBILEBIRMINGHAMMONTGOMERYTUCSONPEORIA01020-505DivisionEast South CentralAaMountainAacoord.1coord.2 diff --git a/tests/testthat/_snaps/ggplot-text/text.svg b/tests/testthat/_snaps/ggplot-text/text.svg index 0c3e6682de..da7f524e10 100644 --- a/tests/testthat/_snaps/ggplot-text/text.svg +++ b/tests/testthat/_snaps/ggplot-text/text.svg @@ -1 +1 @@ -Mazda RX4Mazda RX4 WagDatsun 710Hornet 4 DriveHornet SportaboutValiantDuster 360Merc 240DMerc 230Merc 280Merc 280CMerc 450SEMerc 450SLMerc 450SLCCadillac FleetwoodLincoln ContinentalChrysler ImperialFiat 128Honda CivicToyota CorollaToyota CoronaDodge ChallengerAMC JavelinCamaro Z28Pontiac FirebirdFiat X1-9Porsche 914-2Lotus EuropaFord Pantera LFerrari DinoMaserati BoraVolvo 142E2345101520253035wtmpg +Mazda RX4Mazda RX4 WagDatsun 710Hornet 4 DriveHornet SportaboutValiantDuster 360Merc 240DMerc 230Merc 280Merc 280CMerc 450SEMerc 450SLMerc 450SLCCadillac FleetwoodLincoln ContinentalChrysler ImperialFiat 128Honda CivicToyota CorollaToyota CoronaDodge ChallengerAMC JavelinCamaro Z28Pontiac FirebirdFiat X1-9Porsche 914-2Lotus EuropaFord Pantera LFerrari DinoMaserati BoraVolvo 142E2345101520253035wtmpg diff --git a/tests/testthat/_snaps/ggplot-theme/theme-background.svg b/tests/testthat/_snaps/ggplot-theme/theme-background.svg old mode 100755 new mode 100644 index 334203e35b..574fb1ab96 --- a/tests/testthat/_snaps/ggplot-theme/theme-background.svg +++ b/tests/testthat/_snaps/ggplot-theme/theme-background.svg @@ -1 +1 @@ -405060170180190200210220230bill_length_mmflipper_length_mm +405060170180190200210220230bill_length_mmflipper_length_mm diff --git a/tests/testthat/_snaps/ggplot-theme/theme-marker-default.svg b/tests/testthat/_snaps/ggplot-theme/theme-marker-default.svg index 4f7b23bbeb..8120ead62a 100644 --- a/tests/testthat/_snaps/ggplot-theme/theme-marker-default.svg +++ b/tests/testthat/_snaps/ggplot-theme/theme-marker-default.svg @@ -1 +1 @@ -2340.40.81.21.6countrypopulationParaguayPeruPhilippineseduilln +2340.40.81.21.6populationcountryParaguayPeruPhilippineseduilln diff --git a/tests/testthat/_snaps/ggplot-theme/theme-panel-border-1.svg b/tests/testthat/_snaps/ggplot-theme/theme-panel-border-1.svg deleted file mode 100644 index e70a58a863..0000000000 --- a/tests/testthat/_snaps/ggplot-theme/theme-panel-border-1.svg +++ /dev/null @@ -1 +0,0 @@ -405060170180190200210220230bill_length_mmflipper_length_mm diff --git a/tests/testthat/_snaps/ggplot-theme/theme-panel-border-2.svg b/tests/testthat/_snaps/ggplot-theme/theme-panel-border-2.svg index e3829aa2e9..05f2aceb78 100644 --- a/tests/testthat/_snaps/ggplot-theme/theme-panel-border-2.svg +++ b/tests/testthat/_snaps/ggplot-theme/theme-panel-border-2.svg @@ -1 +1 @@ -40506015.017.520.0bill_length_mmbill_depth_mm +40506015.017.520.0bill_length_mmbill_depth_mm diff --git a/tests/testthat/_snaps/ggplot-theme/theme-ticks-and-grids.svg b/tests/testthat/_snaps/ggplot-theme/theme-ticks-and-grids.svg index db97c407e8..bac9a647cb 100644 --- a/tests/testthat/_snaps/ggplot-theme/theme-ticks-and-grids.svg +++ b/tests/testthat/_snaps/ggplot-theme/theme-ticks-and-grids.svg @@ -1 +1 @@ -405060170180190200210220230bill_length_mmflipper_length_mm +405060170180190200210220230bill_length_mmflipper_length_mm diff --git a/tests/testthat/_snaps/ggplot-theme/theme-ticks-default.svg b/tests/testthat/_snaps/ggplot-theme/theme-ticks-default.svg index e70a58a863..835bc4940d 100644 --- a/tests/testthat/_snaps/ggplot-theme/theme-ticks-default.svg +++ b/tests/testthat/_snaps/ggplot-theme/theme-ticks-default.svg @@ -1 +1 @@ -405060170180190200210220230bill_length_mmflipper_length_mm +405060170180190200210220230bill_length_mmflipper_length_mm diff --git a/tests/testthat/_snaps/ggplot-theme/theme-zeroline-default.svg b/tests/testthat/_snaps/ggplot-theme/theme-zeroline-default.svg index e70a58a863..835bc4940d 100644 --- a/tests/testthat/_snaps/ggplot-theme/theme-zeroline-default.svg +++ b/tests/testthat/_snaps/ggplot-theme/theme-zeroline-default.svg @@ -1 +1 @@ -405060170180190200210220230bill_length_mmflipper_length_mm +405060170180190200210220230bill_length_mmflipper_length_mm diff --git a/tests/testthat/_snaps/ggplot-ticks/continuous-x-missing.svg b/tests/testthat/_snaps/ggplot-ticks/continuous-x-missing.svg index 605826dd68..e7699649bc 100644 --- a/tests/testthat/_snaps/ggplot-ticks/continuous-x-missing.svg +++ b/tests/testthat/_snaps/ggplot-ticks/continuous-x-missing.svg @@ -1 +1 @@ -151617181920212223100200300400qsecdisp +151617181920212223100200300400qsecdisp diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-boxes-facet-grid.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-boxes-facet-grid.svg index dfe4483a60..359835b4b2 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-boxes-facet-grid.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-boxes-facet-grid.svg @@ -1 +1 @@ -ctrltrt1trt23.54.04.55.05.56.0ctrltrt1trt2groupweightcontroltreatment +ctrltrt1trt23.54.04.55.05.56.0ctrltrt1trt2groupweightcontroltreatment diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-boxes-scales-free.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-boxes-scales-free.svg index e7f78d8ae4..0eb029b5a2 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-boxes-scales-free.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-boxes-scales-free.svg @@ -1 +1 @@ -ctrl3.54.04.55.05.56.0trt1trt2groupweightcontroltreatment +ctrl3.54.04.55.05.56.0trt1trt2groupweightcontroltreatment diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-boxes-space-free.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-boxes-space-free.svg index e7f78d8ae4..0eb029b5a2 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-boxes-space-free.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-boxes-space-free.svg @@ -1 +1 @@ -ctrl3.54.04.55.05.56.0trt1trt2groupweightcontroltreatment +ctrl3.54.04.55.05.56.0trt1trt2groupweightcontroltreatment diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-boxes.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-boxes.svg index c241809a66..86bb073e55 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-boxes.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-boxes.svg @@ -1 +1 @@ -ctrltrt1trt23.54.04.55.05.56.0groupweight +ctrltrt1trt23.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-breaks-less.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-breaks-less.svg index b7aba9837a..f2e21ffbd3 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-breaks-less.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-breaks-less.svg @@ -1 +1 @@ -trt1ctrl3.54.04.55.05.56.0groupweight +trt1ctrl3.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-breaks-more.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-breaks-more.svg index 40f6d87a82..052b54e17e 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-breaks-more.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-breaks-more.svg @@ -1 +1 @@ -trt1ctrltrt23.54.04.55.05.56.0groupweight +trt1ctrltrt23.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-breaks-nochange.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-breaks-nochange.svg index 40f6d87a82..052b54e17e 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-breaks-nochange.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-breaks-nochange.svg @@ -1 +1 @@ -trt1ctrltrt23.54.04.55.05.56.0groupweight +trt1ctrltrt23.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-evenly-spaced-ticks.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-evenly-spaced-ticks.svg index 56468c2ee2..95595145d2 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-evenly-spaced-ticks.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-evenly-spaced-ticks.svg @@ -1 +1 @@ -ctrltrt1trt24.0000004.0909094.1818184.2727274.3636364.4545454.5454554.6363644.7272734.8181824.9090915.000000groupweight +ctrltrt1trt24.0000004.0909094.1818184.2727274.3636364.4545454.5454554.6363644.7272734.8181824.9090915.000000groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-flip-grid-free.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-flip-grid-free.svg index 581e4ec6d1..915134426d 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-flip-grid-free.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-flip-grid-free.svg @@ -1 +1 @@ -ctrl3.54.04.55.05.56.0trt1trt2weightgroupcontroltreatment +ctrl3.54.04.55.05.56.0trt1trt2weightgroupcontroltreatment diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-flip-grid.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-flip-grid.svg index 1575e6421b..bb1439462f 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-flip-grid.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-flip-grid.svg @@ -1 +1 @@ -ctrltrt1trt23.54.04.55.05.56.0ctrltrt1trt2weightgroupcontroltreatment +ctrltrt1trt23.54.04.55.05.56.0ctrltrt1trt2weightgroupcontroltreatment diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-flip.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-flip.svg index d639c93a1f..7773483cc0 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-flip.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-flip.svg @@ -1 +1 @@ -3.54.04.55.05.56.0ctrltrt1trt2weightgroup +3.54.04.55.05.56.0ctrltrt1trt2weightgroup diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-hide-ticks-labels.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-hide-ticks-labels.svg index 1db7aab1ec..0f75a8dc6b 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-hide-ticks-labels.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-hide-ticks-labels.svg @@ -1 +1 @@ -3.54.04.55.05.56.0groupweight +3.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-hide-ticks-lines-labels.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-hide-ticks-lines-labels.svg index 6926445f0d..1ebd2e95b6 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-hide-ticks-lines-labels.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-hide-ticks-lines-labels.svg @@ -1 +1 @@ -1233.54.04.55.05.56.0groupweight +3.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-limits-gap.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-limits-gap.svg index 2025075bf7..4a1387a668 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-limits-gap.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-limits-gap.svg @@ -1 +1 @@ -trt1trt2GAPctrl3.54.04.55.05.56.0groupweight +trt1trt2GAPctrl3.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-limits-hide.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-limits-hide.svg index 298bf0df58..0f9390c79d 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-limits-hide.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-limits-hide.svg @@ -1 +1 @@ -trt1ctrl3.54.04.55.05.56.0groupweight +trt1ctrl3.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-line-breaks.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-line-breaks.svg index c8fab07556..6b4fd56bfe 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-line-breaks.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-line-breaks.svg @@ -1 +1 @@ -thisis veryloooooooooooongtext toillustrate0255075100xy +thisis veryloooooooooooongtext toillustrate0255075100xy diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-scale-labels.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-scale-labels.svg index f2a4573775..30f8a837cf 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-scale-labels.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-scale-labels.svg @@ -1 +1 @@ -Treatment 1ControlTreatment 23.54.04.55.05.56.0groupweight +Treatment 1ControlTreatment 23.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-uneven.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-uneven.svg index 6926445f0d..bcb9aa6440 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-uneven.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-uneven.svg @@ -1 +1 @@ -1233.54.04.55.05.56.0groupweight +ctrltrt1trt24.004.254.505.006.00groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-ycontinuous-ranges.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-ycontinuous-ranges.svg index 296a415676..c6c2394cc8 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-ycontinuous-ranges.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-ycontinuous-ranges.svg @@ -1 +1 @@ -ctrltrt1trt202468groupweight +ctrltrt1trt202468groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-ylim-ranges.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-ylim-ranges.svg index 296a415676..c6c2394cc8 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-ylim-ranges.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-ylim-ranges.svg @@ -1 +1 @@ -ctrltrt1trt202468groupweight +ctrltrt1trt202468groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-ylim-reversed-ranges.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-ylim-reversed-ranges.svg index e9c6d7c9de..6e6f10d3fe 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-ylim-reversed-ranges.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-ylim-reversed-ranges.svg @@ -1 +1 @@ -ctrltrt1trt20246groupweight +ctrltrt1trt20246groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-yreverse-limits-ranges.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-yreverse-limits-ranges.svg index 885e4705c7..5c9204bfe2 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-yreverse-limits-ranges.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-yreverse-limits-ranges.svg @@ -1 +1 @@ -ctrltrt1trt2-2.50.02.55.07.510.0groupweight +ctrltrt1trt2-2.50.02.55.07.510.0groupweight diff --git a/tests/testthat/_snaps/ggplot-ticks/ticks-yreverse-ranges.svg b/tests/testthat/_snaps/ggplot-ticks/ticks-yreverse-ranges.svg index 58c07f6906..fc6ee4aa3c 100644 --- a/tests/testthat/_snaps/ggplot-ticks/ticks-yreverse-ranges.svg +++ b/tests/testthat/_snaps/ggplot-ticks/ticks-yreverse-ranges.svg @@ -1 +1 @@ -ctrltrt1trt23.54.04.55.05.56.0groupweight +ctrltrt1trt23.54.04.55.05.56.0groupweight diff --git a/tests/testthat/_snaps/ggplot-tooltip/group-lines-hovertext.svg b/tests/testthat/_snaps/ggplot-tooltip/group-lines-hovertext.svg index fdb98d6fcb..37849921c0 100644 --- a/tests/testthat/_snaps/ggplot-tooltip/group-lines-hovertext.svg +++ b/tests/testthat/_snaps/ggplot-tooltip/group-lines-hovertext.svg @@ -1 +1 @@ -20002005201020151e+052e+053e+05datemedian +20002005201020151e+052e+053e+05datemedian diff --git a/tests/testthat/_snaps/ggplot-tooltip/heatmap-discrete-tooltip.svg b/tests/testthat/_snaps/ggplot-tooltip/heatmap-discrete-tooltip.svg index 8b41c92703..df205b1bee 100644 --- a/tests/testthat/_snaps/ggplot-tooltip/heatmap-discrete-tooltip.svg +++ b/tests/testthat/_snaps/ggplot-tooltip/heatmap-discrete-tooltip.svg @@ -1 +1 @@ -1020304680.20.40.6densitympgfactor(cyl) +1020304680.20.40.6densitympgfactor(cyl) diff --git a/tests/testthat/_snaps/ggplot-tooltip/hovertext-display.svg b/tests/testthat/_snaps/ggplot-tooltip/hovertext-display.svg index fdb98d6fcb..37849921c0 100644 --- a/tests/testthat/_snaps/ggplot-tooltip/hovertext-display.svg +++ b/tests/testthat/_snaps/ggplot-tooltip/hovertext-display.svg @@ -1 +1 @@ -20002005201020151e+052e+053e+05datemedian +20002005201020151e+052e+053e+05datemedian diff --git a/tests/testthat/_snaps/ggplot-tooltip/tooltip-date.svg b/tests/testthat/_snaps/ggplot-tooltip/tooltip-date.svg index 4567e8aa2d..e7d9d0073f 100644 --- a/tests/testthat/_snaps/ggplot-tooltip/tooltip-date.svg +++ b/tests/testthat/_snaps/ggplot-tooltip/tooltip-date.svg @@ -1 +1 @@ -00:00:0000:00:3000:01:0000:01:30-1.0-0.50.00.51.0timex +00:00:0000:00:3000:01:0000:01:30-1.0-0.50.00.51.0timex diff --git a/tests/testthat/_snaps/ggplot-tooltip/tooltip-datetime.svg b/tests/testthat/_snaps/ggplot-tooltip/tooltip-datetime.svg index 3a58cd05ba..9635ef3dd5 100644 --- a/tests/testthat/_snaps/ggplot-tooltip/tooltip-datetime.svg +++ b/tests/testthat/_snaps/ggplot-tooltip/tooltip-datetime.svg @@ -1 +1 @@ -16:3017:0017:3018:00-1.0-0.50.00.51.0timex +16:3017:0017:3018:00-1.0-0.50.00.51.0timex diff --git a/tests/testthat/_snaps/ggplot-violin/violin-aes.svg b/tests/testthat/_snaps/ggplot-violin/violin-aes.svg index c51fb9bdca..8dcbf661b4 100644 --- a/tests/testthat/_snaps/ggplot-violin/violin-aes.svg +++ b/tests/testthat/_snaps/ggplot-violin/violin-aes.svg @@ -1 +1 @@ -468101520253035factor(cyl)468factor(cyl)mpg +468101520253035factor(cyl)468factor(cyl)mpg diff --git a/tests/testthat/_snaps/ggplot-violin/violin.svg b/tests/testthat/_snaps/ggplot-violin/violin.svg index 1a8ec9197d..df755131e0 100644 --- a/tests/testthat/_snaps/ggplot-violin/violin.svg +++ b/tests/testthat/_snaps/ggplot-violin/violin.svg @@ -1 +1 @@ -468101520253035factor(cyl)mpg +468101520253035factor(cyl)mpg diff --git a/tests/testthat/_snaps/ggplot-vline/vline-multiple.svg b/tests/testthat/_snaps/ggplot-vline/vline-multiple.svg index ddb34e6b17..e7a9e532ce 100644 --- a/tests/testthat/_snaps/ggplot-vline/vline-multiple.svg +++ b/tests/testthat/_snaps/ggplot-vline/vline-multiple.svg @@ -1 +1 @@ -01230123xy +01230123xy diff --git a/tests/testthat/_snaps/ggplot-vline/vline.svg b/tests/testthat/_snaps/ggplot-vline/vline.svg index ad134a9c72..11665516e6 100644 --- a/tests/testthat/_snaps/ggplot-vline/vline.svg +++ b/tests/testthat/_snaps/ggplot-vline/vline.svg @@ -1 +1 @@ -01230123xy +01230123xy diff --git a/tests/testthat/_snaps/ggplot-ylim/ylim-one-trace.svg b/tests/testthat/_snaps/ggplot-ylim/ylim-one-trace.svg index e3584961f6..df97194e9a 100644 --- a/tests/testthat/_snaps/ggplot-ylim/ylim-one-trace.svg +++ b/tests/testthat/_snaps/ggplot-ylim/ylim-one-trace.svg @@ -1 +1 @@ -LunchDinner051015Average bill for 2 peopleTime of dayTotal bill +LunchDinner051015Average bill for 2 peopleTime of dayTotal bill diff --git a/tests/testthat/_snaps/ggridges/basic-ridgeline.svg b/tests/testthat/_snaps/ggridges/basic-ridgeline.svg new file mode 100644 index 0000000000..0f77494cac --- /dev/null +++ b/tests/testthat/_snaps/ggridges/basic-ridgeline.svg @@ -0,0 +1 @@ +1234512345xy diff --git a/tests/testthat/_snaps/ggridges/cutting-tails.svg b/tests/testthat/_snaps/ggridges/cutting-tails.svg new file mode 100644 index 0000000000..9126c02532 --- /dev/null +++ b/tests/testthat/_snaps/ggridges/cutting-tails.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/density-ridgeline.svg b/tests/testthat/_snaps/ggridges/density-ridgeline.svg new file mode 100644 index 0000000000..9d336bc53a --- /dev/null +++ b/tests/testthat/_snaps/ggridges/density-ridgeline.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/density-ridgeline2.svg b/tests/testthat/_snaps/ggridges/density-ridgeline2.svg new file mode 100644 index 0000000000..141756c0ed --- /dev/null +++ b/tests/testthat/_snaps/ggridges/density-ridgeline2.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/histogram-ridges.svg b/tests/testthat/_snaps/ggridges/histogram-ridges.svg new file mode 100644 index 0000000000..f154afb649 --- /dev/null +++ b/tests/testthat/_snaps/ggridges/histogram-ridges.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/jittering-points.svg b/tests/testthat/_snaps/ggridges/jittering-points.svg new file mode 100644 index 0000000000..7b7ebe6f9d --- /dev/null +++ b/tests/testthat/_snaps/ggridges/jittering-points.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/manual-densities-stat-identity.svg b/tests/testthat/_snaps/ggridges/manual-densities-stat-identity.svg new file mode 100644 index 0000000000..35885e928e --- /dev/null +++ b/tests/testthat/_snaps/ggridges/manual-densities-stat-identity.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/multiple-ridgelines.svg b/tests/testthat/_snaps/ggridges/multiple-ridgelines.svg new file mode 100644 index 0000000000..4e61f425af --- /dev/null +++ b/tests/testthat/_snaps/ggridges/multiple-ridgelines.svg @@ -0,0 +1 @@ +123450246xy diff --git a/tests/testthat/_snaps/ggridges/negative-height-cut.svg b/tests/testthat/_snaps/ggridges/negative-height-cut.svg new file mode 100644 index 0000000000..b18549cdbb --- /dev/null +++ b/tests/testthat/_snaps/ggridges/negative-height-cut.svg @@ -0,0 +1 @@ +1234501234xy diff --git a/tests/testthat/_snaps/ggridges/negative-height-retained.svg b/tests/testthat/_snaps/ggridges/negative-height-retained.svg new file mode 100644 index 0000000000..f4bea16da7 --- /dev/null +++ b/tests/testthat/_snaps/ggridges/negative-height-retained.svg @@ -0,0 +1 @@ +1234501234xy diff --git a/tests/testthat/_snaps/ggridges/numeric-grouping.svg b/tests/testthat/_snaps/ggridges/numeric-grouping.svg new file mode 100644 index 0000000000..673ad1628c --- /dev/null +++ b/tests/testthat/_snaps/ggridges/numeric-grouping.svg @@ -0,0 +1 @@ +456781234Sepal.LengthSpecies_num diff --git a/tests/testthat/_snaps/ggridges/overlapping-facet-touching.svg b/tests/testthat/_snaps/ggridges/overlapping-facet-touching.svg new file mode 100644 index 0000000000..54a26d7ede --- /dev/null +++ b/tests/testthat/_snaps/ggridges/overlapping-facet-touching.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginica4567845678Sepal.LengthSpeciessetosaversicolorvirginica diff --git a/tests/testthat/_snaps/ggridges/overlapping-lot.svg b/tests/testthat/_snaps/ggridges/overlapping-lot.svg new file mode 100644 index 0000000000..8d0562a06b --- /dev/null +++ b/tests/testthat/_snaps/ggridges/overlapping-lot.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/overlapping-none.svg b/tests/testthat/_snaps/ggridges/overlapping-none.svg new file mode 100644 index 0000000000..aed29008cc --- /dev/null +++ b/tests/testthat/_snaps/ggridges/overlapping-none.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/overlapping-touching.svg b/tests/testthat/_snaps/ggridges/overlapping-touching.svg new file mode 100644 index 0000000000..15f91764f7 --- /dev/null +++ b/tests/testthat/_snaps/ggridges/overlapping-touching.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/quantile-colouring-tails-only.svg b/tests/testthat/_snaps/ggridges/quantile-colouring-tails-only.svg new file mode 100644 index 0000000000..1242776c5a --- /dev/null +++ b/tests/testthat/_snaps/ggridges/quantile-colouring-tails-only.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaProbability123Sepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/quantile-colouring.svg b/tests/testthat/_snaps/ggridges/quantile-colouring.svg new file mode 100644 index 0000000000..76410aa145 --- /dev/null +++ b/tests/testthat/_snaps/ggridges/quantile-colouring.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaQuartiles1234Sepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/quantile-cut-points.svg b/tests/testthat/_snaps/ggridges/quantile-cut-points.svg new file mode 100644 index 0000000000..b73eebe3cf --- /dev/null +++ b/tests/testthat/_snaps/ggridges/quantile-cut-points.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/quantile-lines-1.svg b/tests/testthat/_snaps/ggridges/quantile-lines-1.svg new file mode 100644 index 0000000000..0a623ca927 --- /dev/null +++ b/tests/testthat/_snaps/ggridges/quantile-lines-1.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/quantile-lines-multi.svg b/tests/testthat/_snaps/ggridges/quantile-lines-multi.svg new file mode 100644 index 0000000000..783f5f0a7d --- /dev/null +++ b/tests/testthat/_snaps/ggridges/quantile-lines-multi.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/raincloud-effect.svg b/tests/testthat/_snaps/ggridges/raincloud-effect.svg new file mode 100644 index 0000000000..2879a68a67 --- /dev/null +++ b/tests/testthat/_snaps/ggridges/raincloud-effect.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/raincloud-vertical-line-points.svg b/tests/testthat/_snaps/ggridges/raincloud-vertical-line-points.svg new file mode 100644 index 0000000000..7f223979f0 --- /dev/null +++ b/tests/testthat/_snaps/ggridges/raincloud-vertical-line-points.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/stat-density.svg b/tests/testthat/_snaps/ggridges/stat-density.svg new file mode 100644 index 0000000000..4eb7470c44 --- /dev/null +++ b/tests/testthat/_snaps/ggridges/stat-density.svg @@ -0,0 +1 @@ +5678setosaversicolorvirginicaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/stat-identity.svg b/tests/testthat/_snaps/ggridges/stat-identity.svg new file mode 100644 index 0000000000..d76b6456c6 --- /dev/null +++ b/tests/testthat/_snaps/ggridges/stat-identity.svg @@ -0,0 +1 @@ +123450123xy diff --git a/tests/testthat/_snaps/ggridges/styling-points.svg b/tests/testthat/_snaps/ggridges/styling-points.svg new file mode 100644 index 0000000000..0ddcb228af --- /dev/null +++ b/tests/testthat/_snaps/ggridges/styling-points.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaSpeciesvirginicaversicolorsetosaSepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/styling-points2.svg b/tests/testthat/_snaps/ggridges/styling-points2.svg new file mode 100644 index 0000000000..7a6268547c --- /dev/null +++ b/tests/testthat/_snaps/ggridges/styling-points2.svg @@ -0,0 +1 @@ +45678setosaversicolorvirginicaPetal.LengthSpecies(virginica,1)(versicolor,1)(setosa,1)Sepal.LengthSpecies diff --git a/tests/testthat/_snaps/ggridges/varying-fill-colours.svg b/tests/testthat/_snaps/ggridges/varying-fill-colours.svg new file mode 100644 index 0000000000..30ecccd097 --- /dev/null +++ b/tests/testthat/_snaps/ggridges/varying-fill-colours.svg @@ -0,0 +1 @@ +1234502468NA4.65.66.67.68.62.33.34.35.36.312345xy diff --git a/tests/testthat/_snaps/mean-error-bars/error-rect-alpha.svg b/tests/testthat/_snaps/mean-error-bars/error-rect-alpha.svg index fbc57369a6..3a6d45697c 100644 --- a/tests/testthat/_snaps/mean-error-bars/error-rect-alpha.svg +++ b/tests/testthat/_snaps/mean-error-bars/error-rect-alpha.svg @@ -1 +1 @@ -024612345grouponetwoxy +0246-2.50.02.55.07.5grouponetwoxy diff --git a/tests/testthat/_snaps/mean-error-bars/error-simple-line-point-crazy.svg b/tests/testthat/_snaps/mean-error-bars/error-simple-line-point-crazy.svg index e5e1b819c7..923abc9ce5 100644 --- a/tests/testthat/_snaps/mean-error-bars/error-simple-line-point-crazy.svg +++ b/tests/testthat/_snaps/mean-error-bars/error-simple-line-point-crazy.svg @@ -1 +1 @@ -12341234xy +12341234xy diff --git a/tests/testthat/_snaps/mean-error-bars/error-simple-line-point.svg b/tests/testthat/_snaps/mean-error-bars/error-simple-line-point.svg index 25a0a181da..e092a3499d 100644 --- a/tests/testthat/_snaps/mean-error-bars/error-simple-line-point.svg +++ b/tests/testthat/_snaps/mean-error-bars/error-simple-line-point.svg @@ -1 +1 @@ -12341234xy +12341234xy diff --git a/tests/testthat/_snaps/mean-error-bars/error-simple-line.svg b/tests/testthat/_snaps/mean-error-bars/error-simple-line.svg index 2c117a0e68..81265d73d1 100644 --- a/tests/testthat/_snaps/mean-error-bars/error-simple-line.svg +++ b/tests/testthat/_snaps/mean-error-bars/error-simple-line.svg @@ -1 +1 @@ -12341234xy +12341234xy diff --git a/tests/testthat/_snaps/mean-error-bars/error-simple.svg b/tests/testthat/_snaps/mean-error-bars/error-simple.svg index 7340440e8a..bb1990f703 100644 --- a/tests/testthat/_snaps/mean-error-bars/error-simple.svg +++ b/tests/testthat/_snaps/mean-error-bars/error-simple.svg @@ -1 +1 @@ -12341234xy +12341234xy diff --git a/tests/testthat/_snaps/plotly-subplot/ggally-ggcorr.svg b/tests/testthat/_snaps/plotly-subplot/ggally-ggcorr.svg new file mode 100644 index 0000000000..2c517caeb1 --- /dev/null +++ b/tests/testthat/_snaps/plotly-subplot/ggally-ggcorr.svg @@ -0,0 +1 @@ +v1v2v3v4v5-1.0-0.50.00.51.0 diff --git a/tests/testthat/_snaps/plotly-subplot/plotly-subplot-ggmatrix.svg b/tests/testthat/_snaps/plotly-subplot/plotly-subplot-ggmatrix.svg index af626f8fec..b65affb2c4 100644 --- a/tests/testthat/_snaps/plotly-subplot/plotly-subplot-ggmatrix.svg +++ b/tests/testthat/_snaps/plotly-subplot/plotly-subplot-ggmatrix.svg @@ -1 +1 @@ -0.02.55.07.50.02.55.07.556780.02.55.07.50.00.51.01.52.02.52462.02.53.03.54.04.50.00.10.20.30.42.02.53.03.54.04.5Corr:-0.118246Corr:-0.428***Corr:0.872***0.00.51.01.52.02.5Corr:0.963***Corr:-0.366***Corr:0.818***setosaversicolorvirginicaSepal.LengthSepal.WidthPetal.LengthPetal.WidthSpeciesPetal.WidthPetal.LengthSepal.WidthSepal.Lengthsetosaversicolorvirginicasetosaversicolorvirginicasetosaversicolorvirginicasetosaversicolorvirginica +05101505101556780510150.00.51.01.52.02.52462.02.53.03.54.04.50.00.10.20.30.42.02.53.03.54.04.5Corr:-0.118246Corr:-0.428***Corr:0.872***0.00.51.01.52.02.5Corr:0.963***Corr:-0.366***Corr:0.818***setosaversicolorvirginicaSepal.LengthSepal.WidthPetal.LengthPetal.WidthSpeciesPetal.WidthPetal.LengthSepal.WidthSepal.Lengthsetosaversicolorvirginicasetosaversicolorvirginicasetosaversicolorvirginicasetosaversicolorvirginica diff --git a/tests/testthat/_snaps/plotly-subplot/plotly-subplot-plot-list.svg b/tests/testthat/_snaps/plotly-subplot/plotly-subplot-plot-list.svg old mode 100755 new mode 100644 index 9d2ffb8e85..f3142fa13b --- a/tests/testthat/_snaps/plotly-subplot/plotly-subplot-plot-list.svg +++ b/tests/testthat/_snaps/plotly-subplot/plotly-subplot-plot-list.svg @@ -1 +1 @@ -05k10k200k250k300k510151020197019801990200020105k10k15kpcepoppsavertuempmedunemploy +05k10k200k250k300k510151020197019801990200020105k10k15kpcepoppsavertuempmedunemploy diff --git a/tests/testthat/_snaps/plotly-subplot/plotly-subplot-width-height.svg b/tests/testthat/_snaps/plotly-subplot/plotly-subplot-width-height.svg index 1aa3afa892..0e2fe8621f 100644 --- a/tests/testthat/_snaps/plotly-subplot/plotly-subplot-width-height.svg +++ b/tests/testthat/_snaps/plotly-subplot/plotly-subplot-width-height.svg @@ -1 +1 @@ -0.02.55.07.5-3-2-1012-2020.02.55.07.510.0xcountcounty +0.02.55.07.510.0-3-2-1012-2020369xcountcounty diff --git a/tests/testthat/_snaps/plotly-symbol/plotly-symbol-symbol-manual.svg b/tests/testthat/_snaps/plotly-symbol/plotly-symbol-symbol-manual.svg index 0349fb52b6..7763ec3c7b 100644 --- a/tests/testthat/_snaps/plotly-symbol/plotly-symbol-symbol-manual.svg +++ b/tests/testthat/_snaps/plotly-symbol/plotly-symbol-symbol-manual.svg @@ -1 +1 @@ -1015202530355010015020025030035040045001mpgdisp +1015202530355010015020025030035040045001mpgdisp diff --git a/tests/testthat/_snaps/plotly/plotly-alpha-no-color.svg b/tests/testthat/_snaps/plotly/plotly-alpha-no-color.svg index 65b54f5127..9a4c149a39 100644 --- a/tests/testthat/_snaps/plotly/plotly-alpha-no-color.svg +++ b/tests/testthat/_snaps/plotly/plotly-alpha-no-color.svg @@ -1 +1 @@ -10152025303550100150200250300350400450mpgdisp +10152025303550100150200250300350400450mpgdisp diff --git a/tests/testthat/_snaps/ticktext-linebreaks/ticktext-linebreaks-no-linebreaks.svg b/tests/testthat/_snaps/ticktext-linebreaks/ticktext-linebreaks-no-linebreaks.svg index 0632ea4ef4..42e2952593 100644 --- a/tests/testthat/_snaps/ticktext-linebreaks/ticktext-linebreaks-no-linebreaks.svg +++ b/tests/testthat/_snaps/ticktext-linebreaks/ticktext-linebreaks-no-linebreaks.svg @@ -1 +1 @@ -012345ticktextticktext long_ticktext ticktextxy +012345ticktextticktext long_ticktext ticktextxy diff --git a/tests/testthat/_snaps/ticktext-linebreaks/ticktext-linebreaks-one-cat.svg b/tests/testthat/_snaps/ticktext-linebreaks/ticktext-linebreaks-one-cat.svg index a3a5456a33..88c1a9bbfd 100644 --- a/tests/testthat/_snaps/ticktext-linebreaks/ticktext-linebreaks-one-cat.svg +++ b/tests/testthat/_snaps/ticktext-linebreaks/ticktext-linebreaks-one-cat.svg @@ -1 +1 @@ -0.000.250.500.751.00ticktextlong_ticktextticktextxy +0.000.250.500.751.00ticktextlong_ticktextticktextxy diff --git a/tests/testthat/_snaps/ticktext-linebreaks/ticktext-linebreaks.svg b/tests/testthat/_snaps/ticktext-linebreaks/ticktext-linebreaks.svg index 2a0cf41390..c996497512 100644 --- a/tests/testthat/_snaps/ticktext-linebreaks/ticktext-linebreaks.svg +++ b/tests/testthat/_snaps/ticktext-linebreaks/ticktext-linebreaks.svg @@ -1 +1 @@ -012345ticktextticktextlong_ticktextticktextxy +012345ticktextticktextlong_ticktextticktextxy diff --git a/tests/testthat/helper-vdiffr.R b/tests/testthat/helper-vdiffr.R index 716b8750ab..bd0b7cac1c 100644 --- a/tests/testthat/helper-vdiffr.R +++ b/tests/testthat/helper-vdiffr.R @@ -4,6 +4,8 @@ message("Visual testing is ", if (!visual_testing) "not ", "enabled.") # start up the orca image server imageServer <- if (visual_testing) { + # https://github.com/plotly/plotly.R/issues/2179 + reticulate::py_run_string("import sys") kaleido() } else { list(transform = function(...) stop("Visual testing is disabled!")) @@ -27,7 +29,12 @@ expect_doppelganger <- function(p, name, ...) { set.seed(555) write_plotly_svg(p, path) - testthat::expect_snapshot_file(path = path, name = file, cran = FALSE) + testthat::expect_snapshot_file( + path = path, name = file, cran = FALSE, + compare = function(old, new) { + compare_file_text(old, new) || identical(rsvg::rsvg_png(old), rsvg::rsvg_png(new)) + } + ) } # run visual test and return 'built' data/layout diff --git a/tests/testthat/test-animate-highlight.R b/tests/testthat/test-animate-highlight.R index 4f55614603..824f51af99 100644 --- a/tests/testthat/test-animate-highlight.R +++ b/tests/testthat/test-animate-highlight.R @@ -81,6 +81,50 @@ test_that("group_by.plotly() retains crosstalk set", { expect_true(all(b$x$data[[1]]$key == row.names(mtcars))) }) +test_that("highlight(selectize) produces a sensible payload", { + p <- plot_ly() %>% + add_lines(data = mtcars, x = ~wt, y = ~mpg) %>% + add_markers( + data = highlight_key(mtcars, ~cyl, "Choose cylinder"), + x = ~wt, y = ~mpg + ) + + # Builds basic payload when selectize=TRUE + b <- p %>% + highlight(selectize = TRUE) %>% + plotly_build() + + selectize <- list( + items = data.frame(value = c(6, 4, 8), label = c(6, 4, 8)), + group = "Choose cylinder" + ) + + expect_length(b$x$selectize, 1) + expect_equal(b$x$selectize[[1]], selectize) + + # Copies over any list() options + b2 <- p %>% + highlight(selectize = list(plugins = list("remove_button"))) %>% + plotly_build() + + selectize$plugins <- list("remove_button") + + expect_length(b2$x$selectize, 1) + expect_equal(b2$x$selectize[[1]], selectize) + + # Can also tack on options after building, and plotly_build() won't overwrite + b2$x$selectize[[1]] <- modifyList( + b2$x$selectize[[1]], list(foo = "bar") + ) + + b2 <- plotly_build(b2) + + selectize$foo <- "bar" + + expect_equal(b2$x$selectize[[1]], selectize) + +}) + # Ignore for now https://github.com/ggobi/ggally/issues/264 @@ -392,6 +436,7 @@ test_that("animation button can be customized", { test_that("sf works with crosstalk", { skip_if_not_installed("sf") skip_if_not_installed("s2") + skip_if_not_installed("ggthemes") nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE) # shared data will make the polygons "query-able" diff --git a/tests/testthat/test-cookbook-axes.R b/tests/testthat/test-cookbook-axes.R index db50825360..5c5344ed01 100644 --- a/tests/testthat/test-cookbook-axes.R +++ b/tests/testthat/test-cookbook-axes.R @@ -34,13 +34,13 @@ test_that("factor levels determine tick order", { bp.ylim.hide <- bp + ylim(5, 7.5) test_that("ylim hides points", { info <- expect_warning(expect_traces(bp.ylim.hide, 1, "ylim.hide"), - regexp = "non-finite values") + regexp = "non-finite") }) bp.scale.hide <- bp + scale_y_continuous(limits = c(5, 7.5)) test_that("scale_y(limits) hides points", { info <- expect_warning(expect_traces(bp.scale.hide, 1, "scale.hide"), - regexp = "non-finite values") + regexp = "non-finite") expect_equivalent(range(info$layout$yaxis$tickvals), c(5, 7.5)) y <- unlist(lapply(info$data, "[[", "y")) expect_true(all(5 <= y & y <= 7.5, na.rm = TRUE)) diff --git a/tests/testthat/test-ggplot-abline.R b/tests/testthat/test-ggplot-abline.R index 654e291d8b..d0d6f0b8e3 100644 --- a/tests/testthat/test-ggplot-abline.R +++ b/tests/testthat/test-ggplot-abline.R @@ -15,12 +15,14 @@ expect_traces <- function(gg, n.traces, name) { } test_that("Second trace be the a-b line", { + skip_if_not_installed("ggplot2", "3.4.0") # linewidth introduced in 3.4.0 + x <- seq(0, 3.5, by = 0.5) y <- x * 0.95 df <- data.frame(x, y) gg <- ggplot(df) + geom_point(aes(x, y, size = x)) + - geom_abline(intercept = 1.1, slope = 0.9, colour = "red", size = 4) + geom_abline(intercept = 1.1, slope = 0.9, colour = "red", linewidth = 4) L <- expect_traces(gg, 2, "single-abline") diff --git a/tests/testthat/test-ggplot-area.R b/tests/testthat/test-ggplot-area.R index 265a97a0ad..5ab2d84b15 100644 --- a/tests/testthat/test-ggplot-area.R +++ b/tests/testthat/test-ggplot-area.R @@ -19,28 +19,29 @@ huron <- data.frame(year = 1875:1972, level = as.vector(LakeHuron)) # like getAnywhere(round_any.numeric) huron$decade <- floor(huron$year / 10) * 10 -ar <- ggplot(huron) + geom_area(aes(x = year, y = level)) +ar <- ggplot(huron) + geom_area(aes(x = year, y = level), stat = "identity") test_that("sanity check for geom_area", { L <- expect_traces(ar, 1, "simple") expect_identical(L$data[[1]]$type, "scatter") expect_identical(L$data[[1]]$mode, "lines") expect_identical(L$data[[1]]$fill, "toself") + area_defaults <- GeomArea$use_defaults(NULL) expect_true( L$data[[1]]$fillcolor == - toRGB(GeomArea$default_aes$fill, GeomArea$default_aes$alpha) + toRGB(area_defaults$fill, area_defaults$alpha) ) }) # Test alpha transparency in fill color -gg <- ggplot(huron) + geom_area(aes(x = year, y = level), alpha = 0.4) +gg <- ggplot(huron) + geom_area(aes(x = year, y = level), alpha = 0.4, stat = "identity") test_that("transparency alpha in geom_area is converted", { L <- expect_traces(gg, 1, "area-fillcolor") expect_true(L$data[[1]]$line$color == "transparent") expect_true( L$data[[1]]$fillcolor == - toRGB(GeomArea$default_aes$fill, 0.4) + toRGB(GeomArea$use_defaults(NULL)$fill, 0.4) ) }) @@ -54,7 +55,7 @@ df <- merge(x = df, y = temp, all.x = TRUE) df$freq <- df$n / df$sum.n # Generate ggplot object p <- ggplot(data = df, aes(x = carat, y = freq, fill = cut)) + - geom_area() + geom_area(stat = "identity") # Test test_that("traces are ordered correctly in geom_area", { info <- expect_traces(p, 5, "traces_order") @@ -68,3 +69,19 @@ test_that("traces are ordered correctly in geom_area", { } }) + +test_that("Can handle an 'empty' geom_area()", { + p <- ggplot(data.frame(x = 1, y = 1), aes(x, y)) + + geom_area() + + geom_point() + + l <- ggplotly(p)$x + + expect_length(l$data, 2) + + # TODO: add doppelganger test + # expect_false(l$data[[1]]$visible) + expect_true(l$data[[2]]$x == 1) + expect_true(l$data[[2]]$y == 1) + expect_true(l$data[[2]]$mode == "markers") +}) diff --git a/tests/testthat/test-ggplot-blank.R b/tests/testthat/test-ggplot-blank.R index 1f7d7660a4..c192368e05 100644 --- a/tests/testthat/test-ggplot-blank.R +++ b/tests/testthat/test-ggplot-blank.R @@ -1,6 +1,8 @@ test_that("geom_blank", { - l <- ggplotly(qplot())$x + skip_if_not_installed("ggplot2", "3.4.0") + qp <- expect_warning(qplot(), "deprecated") + l <- ggplotly(qp)$x expect_length(l$data, 1) expect_false(l$data[[1]]$visible) diff --git a/tests/testthat/test-ggplot-contour.R b/tests/testthat/test-ggplot-contour.R index 5bd48e3cf4..741aeec6c2 100644 --- a/tests/testthat/test-ggplot-contour.R +++ b/tests/testthat/test-ggplot-contour.R @@ -12,4 +12,15 @@ test_that("geom_contour is translated to a path", { expect_identical(L$data[[1]]$mode, "lines") }) - +test_that("raster/contour works with scale_fill_binned", { + xy_grid <- expand.grid(ps=seq(-1,3, length=100), + trs=seq(-1,3,length=100)) + xy_grid$ptl <- xy_grid$ps^2 + xy_grid$trs^2 + + gg <- ggplot(xy_grid) + + geom_raster(aes(y=ps,x=trs,fill=ptl), interpolate = TRUE) + + geom_contour(aes(y=ps,x=trs,z=ptl), breaks = c(2,4,6,8,10), color='black') + + scale_fill_binned(low = 'red', high = 'green', breaks = c(2,4,6,8,10)) + + expect_doppelganger_built(gg, "raster-contour-binned") +}) diff --git a/tests/testthat/test-ggplot-date.R b/tests/testthat/test-ggplot-date.R index 494e936d2f..2bd7704b17 100644 --- a/tests/testthat/test-ggplot-date.R +++ b/tests/testthat/test-ggplot-date.R @@ -1,13 +1,14 @@ test_that("datetimes are converted to e.g. 2013-01-02 05:00:00", { + withr::local_locale(c("LC_TIME" = "en_US")) in.str <- c("17 Mar 1983 06:33:44 AM", - "17 Mar 1984 01:59:55 PM") + "17 Mar 1984 01:59:55 PM") time.obj <- strptime(in.str, "%d %b %Y %I:%M:%S %p") out.str <- strftime(time.obj, "%Y-%m-%d %H:%M:%S") df <- rbind(data.frame(who = "me", time.obj, dollars = c(1.1, 5.6)), data.frame(who = "you", time.obj, dollars = c(10.2, 0))) - gg <- qplot(time.obj, dollars, data = df, color = who, geom = "line") + gg <- ggplot(aes(time.obj, dollars, color = who), data = df) + geom_line() info <- expect_doppelganger_built(gg, "date-strings") expect_equivalent(length(info$data), 2) for(trace in info$data[1:2]){ diff --git a/tests/testthat/test-ggplot-density.R b/tests/testthat/test-ggplot-density.R index 17b482f18d..823591a312 100644 --- a/tests/testthat/test-ggplot-density.R +++ b/tests/testthat/test-ggplot-density.R @@ -51,10 +51,10 @@ test_that("geom_density() respects colour aesthetic", { }) g <- base + - geom_histogram(aes(y = ..density..), binwidth = 0.5, fill = "pink") + + geom_histogram(aes(y = after_stat(density)), binwidth = 0.5, fill = "pink") + geom_density(fill = "lightblue", alpha = 0.1) -test_that("geom_histogram(aes(y = ..density..)) + geom_density() works", { +test_that("geom_histogram(aes(y = after_stat(density))) + geom_density() works", { info <- expect_traces(g, 2, "histogram") trs <- info$data type <- unique(sapply(trs, "[[", "type")) diff --git a/tests/testthat/test-ggplot-density2d.R b/tests/testthat/test-ggplot-density2d.R index 197dc20e70..ae43ab34b1 100644 --- a/tests/testthat/test-ggplot-density2d.R +++ b/tests/testthat/test-ggplot-density2d.R @@ -14,7 +14,7 @@ test_that("geom_density2d translates to path(s)", { faithful$col <- factor(sample(1:20, nrow(faithful), replace = T)) m <- ggplot(faithful, aes(x = eruptions, y = waiting)) + - stat_density_2d(aes(fill = ..level..), geom = "polygon") + + stat_density_2d(aes(fill = after_stat(level)), geom = "polygon") + geom_point(aes(colour = col)) + xlim(0.5, 6) + ylim(40, 110) diff --git a/tests/testthat/test-ggplot-dynamicTicks.R b/tests/testthat/test-ggplot-dynamicTicks.R index 488796da69..f50a6b750b 100644 --- a/tests/testthat/test-ggplot-dynamicTicks.R +++ b/tests/testthat/test-ggplot-dynamicTicks.R @@ -33,7 +33,7 @@ test_that("Categorical axis reflects custom scale mapping", { scale_x_discrete(limits = lims) expect_warning(p <- ggplotly(g, dynamicTicks = "x"), - regexp = "non-finite values") + regexp = "non-finite") axisActual <- with( p$x$layout$xaxis, list(type, tickmode, categoryorder, categoryarray) @@ -49,7 +49,7 @@ test_that("Categorical axis reflects custom scale mapping", { geom_bar() + scale_x_discrete(limits = lims, labels = labs) expect_warning(p <- ggplotly(g, dynamicTicks = "x"), - regexp = "non-finite values") + regexp = "non-finite") axisActual <- with( p$x$layout$xaxis, list(type, tickmode, categoryorder, categoryarray) @@ -96,7 +96,7 @@ test_that("Time axis inverse transforms correctly", { test_that("Inverse maps colorbar data", { p <- ggplot(mpg, aes(hwy, manufacturer)) + - stat_bin2d(aes(fill = ..density..), binwidth = c(3,1)) + stat_bin2d(aes(fill = after_stat(density)), binwidth = c(3,1)) l <- ggplotly(p, dynamicTicks = TRUE)$x diff --git a/tests/testthat/test-ggplot-hex.R b/tests/testthat/test-ggplot-hex.R index 01b9eaa154..a7aea74edc 100644 --- a/tests/testthat/test-ggplot-hex.R +++ b/tests/testthat/test-ggplot-hex.R @@ -1,6 +1,7 @@ d <- ggplot(diamonds, aes(carat, price)) test_that("geom_hex", { + skip_if_not_installed("hexbin") g <- d + geom_hex() l <- expect_doppelganger_built(g, "hex-basic") expect_true(length(l$data) > 1) @@ -8,12 +9,14 @@ test_that("geom_hex", { test_that("geom_hex with bins", { + skip_if_not_installed("hexbin") g <- d + geom_hex(bins = 10) l <- expect_doppelganger_built(g, "hex-bins") expect_true(length(l$data) > 1) }) test_that("geom_hex with binwidth", { + skip_if_not_installed("hexbin") g <- d + geom_hex(binwidth = c(1, 1000)) l <- expect_doppelganger_built(g, "hex-binwidth") expect_true(length(l$data) > 1) diff --git a/tests/testthat/test-ggplot-histogram.R b/tests/testthat/test-ggplot-histogram.R index 3e66d2787a..8a22770df5 100644 --- a/tests/testthat/test-ggplot-histogram.R +++ b/tests/testthat/test-ggplot-histogram.R @@ -21,8 +21,8 @@ test_that("geom_histogram() is a bar chart of counts with no bargap", { expect_equivalent(info$layout$barmode, "relative") }) -test_that("geom_histogram(aes(y = ..density..)) displays a density", { - info <- expect_traces(base + geom_histogram(aes(y=..density..)), 1, "density") +test_that("geom_histogram(aes(y = after_stat(density))) displays a density", { + info <- expect_traces(base + geom_histogram(aes(y=after_stat(density))), 1, "density") tr <- info$data[[1]] expect_identical(tr$type, "bar") #default binwidth @@ -33,8 +33,8 @@ test_that("geom_histogram(aes(y = ..density..)) displays a density", { expect_equal(area, 1, tolerance = 0.1) }) -test_that("geom_histogram(aes(fill = ..count..)) works", { - info <- expect_traces(base + geom_histogram(aes(fill = ..count..)), 6, "fill") +test_that("geom_histogram(aes(fill = after_stat(count))) works", { + info <- expect_traces(base + geom_histogram(aes(fill = after_stat(count))), 6, "fill") # grab just the bar traces (there should also be a colorbar) bars <- info$data[sapply(info$data, "[[", "type") == "bar"] # each traces should have the same value of y @@ -53,7 +53,7 @@ test_that("Histogram with fixed colour/fill works", { }) test_that("Specify histogram binwidth", { - gg <- base + geom_histogram(aes(y=..density..), binwidth = 0.3) + gg <- base + geom_histogram(aes(y=after_stat(density)), binwidth = 0.3) info <- expect_traces(gg, 1, "density-binwidth") tr <- info$data[[1]] area <- sum(tr$y) * 0.3 @@ -95,8 +95,10 @@ test_that("geom_histogram() with facets", { }) test_that("vline overlaid histogram", { + skip_if_not_installed("ggplot2", "3.4.0") # linewidth introduced in 3.4.0 + gg <- base + geom_histogram() + - geom_vline(aes(xintercept=mean(wt)), color="red", linetype="dashed", size=1) + geom_vline(aes(xintercept=mean(wt)), color="red", linetype="dashed", linewidth=1) info <- expect_traces(gg, 2, "vline") trs <- info$data type <- unique(sapply(trs, "[[", "type")) diff --git a/tests/testthat/test-ggplot-hline.R b/tests/testthat/test-ggplot-hline.R index 3de01cc18a..ba41144e50 100644 --- a/tests/testthat/test-ggplot-hline.R +++ b/tests/testthat/test-ggplot-hline.R @@ -5,7 +5,9 @@ df <- data.frame(x, y) gg <- ggplot(df) + geom_point(aes(x, y)) test_that("second trace be the hline", { - p <- gg + geom_hline(yintercept = 1.1, colour = "green", size = 3) + skip_if_not_installed("ggplot2", "3.4.0") # linewidth introduced in 3.4.0 + + p <- gg + geom_hline(yintercept = 1.1, colour = "green", linewidth = 3) L <- expect_doppelganger_built(p, "hline") expect_equivalent(length(L$data), 2) @@ -18,7 +20,9 @@ test_that("second trace be the hline", { }) test_that("vector yintercept results in multiple horizontal lines", { - p <- gg + geom_hline(yintercept = 1:3, colour = "red", size = 3) + skip_if_not_installed("ggplot2", "3.4.0") # linewidth introduced in 3.4.0 + + p <- gg + geom_hline(yintercept = 1:3, colour = "red", linewidth = 3) L <- expect_doppelganger_built(p, "hline-multiple") expect_equivalent(length(L$data), 2) @@ -47,6 +51,8 @@ test_that("hline can be drawn over range of factors", { test_that("hline/vline/abline split on linetype/colour/size", { + skip_if_not_installed("ggplot2", "3.4.0") # linewidth introduced in 3.4.0 + d <- tibble::tibble( x = seq(0, 3.5, by = 0.5), y = x * 0.95 @@ -54,7 +60,7 @@ test_that("hline/vline/abline split on linetype/colour/size", { gg <- ggplot(d, aes(x, y)) + geom_point() + geom_vline(xintercept = c(2.5, 3, 3.5), linetype = 1:3) + - geom_hline(yintercept = c(2.5, 3, 3.5), size = 1:3) + + geom_hline(yintercept = c(2.5, 3, 3.5), linewidth = 1:3) + geom_abline(slope = -1, intercept = c(2.5, 3, 3.5), colour = 1:3) l <- expect_doppelganger_built(gg, "split-hline-vline-abline") @@ -91,3 +97,8 @@ test_that("hline works with coord_flip", { expect_equivalent(l$data[[2]]$x, c(5, 5)) expect_equivalent(l$data[[2]]$y, c(5.95, 6.05)) }) + +test_that("geom_vline/geom_hline does not throw an error with ggplotly when no lines are found", { + p3 <- ggplot(df) + geom_hline(aes(yintercept = x), data = data.frame(x = 1)[F, , drop = FALSE]) + expect_error(plotly::ggplotly(p3), NA) +}) diff --git a/tests/testthat/test-ggplot-labels.R b/tests/testthat/test-ggplot-labels.R index 4a4a8cfb34..69ca3b4e22 100644 --- a/tests/testthat/test-ggplot-labels.R +++ b/tests/testthat/test-ggplot-labels.R @@ -51,6 +51,6 @@ test_that("empty labels work", { p <- ggplot(palmerpenguins::penguins, aes(bill_length_mm, bill_depth_mm, color = species)) + geom_point() + - labs(x = element_blank(), y = element_blank()) + labs(x = NULL, y = NULL) b <- expect_doppelganger_built(p, "labs-element-blank") }) diff --git a/tests/testthat/test-ggplot-legend.R b/tests/testthat/test-ggplot-legend.R index 11d0fd9886..9dd92ea96c 100644 --- a/tests/testthat/test-ggplot-legend.R +++ b/tests/testthat/test-ggplot-legend.R @@ -58,6 +58,40 @@ test_that("aesthetics can be discarded from legend with guide(aes = 'none')", { expect_doppelganger(p, "guide-aes-none") }) +test_that("legend can be manipulated via guides(aes = guide_xxx())", { + # Issue posted on Stackoverflow + # https://stackoverflow.com/questions/75365694/plotly-did-not-show-legend-when-converted-from-ggplot + data <- data.frame( + stringsAsFactors = FALSE, + Level = c("Fast","Fast","Fast","Fast", + "Fast","Fast","Slow","Slow","Slow", + "Slow","Slow","Slow"), + Period = c("1Year","3Month","1Year","3Month", + "1Year","3Month","1Year","3Month", + "1Year","3Month","1Year","3Month"), + X = c(0.002,0.002,0.1,0.1,0.9,0.9, + 0.002,0.002,0.1,0.1,0.9,0.9), + Y = c(1.38,1.29,1.61,1.61,1.74,0.98, + 1.14,0.97,1.09,1.1,0.94,0.58) + ) + + gg <- ggplot(data = data, + aes(x = X, + y = Y, + shape = Period, + color = Level)) + + geom_point(alpha = 0.6, size = 3) + + labs(x = " ", + y = "Value") + + scale_y_continuous(labels = scales::number_format(accuracy = 0.1)) + + guides(color = guide_legend(title = "Period", order = 1), + shape = guide_legend(title = "", order = 2)) + + theme(axis.text.x = element_text(angle = 90)) + + info <- expect_doppelganger_built(gg, "respect-guides") + + expect_equivalent(sum(sapply(info$data, "[[", "showlegend")), 4) +}) p <- ggplot(mtcars, aes(x = mpg, y = wt, color = factor(vs))) + geom_point() @@ -115,3 +149,16 @@ test_that("many legend items", { info <- expect_traces(p, length(unique(midwest$category)), "many legend items") }) + +# Make sure we can support the bugfix made in tidyverse/ggplot2#5425 +test_that("can handle varying aesthetics/scales", { + df <- data.frame(x = (1:3)/3, z = c("red", "blue", "green")) + + p <- ggplot(df) + + aes(x, z, colour = z, fill = z, size = x) + + geom_point() + + scale_discrete_identity(aesthetics = c("colour", "fill")) + + scale_size_identity() + + expect_traces(p, 1, "varying-aes-guide") +}) diff --git a/tests/testthat/test-ggplot-lines.R b/tests/testthat/test-ggplot-lines.R index 055f6711ee..e70179612a 100644 --- a/tests/testthat/test-ggplot-lines.R +++ b/tests/testthat/test-ggplot-lines.R @@ -50,7 +50,7 @@ test_that("Milliseconds are preserved with dynamic ticks", { p <- ggplotly(gg, dynamicTicks = TRUE) j <- plotly_json(p, jsonedit = FALSE) t2 <- jsonlite::fromJSON(j)$data$x[[1]] %>% - as.POSIXct(format = "%Y-%m-%d %H:%M:%OS") + as.POSIXct(format = "%Y-%m-%d %H:%M:%OS", origin = "1970-01-01 00:00:00") expect_equal(as.numeric(mean(diff(t2))), 0.1, tolerance = 0.01) expect_doppelganger_built(p, "line-milliseconds") }) diff --git a/tests/testthat/test-ggplot-point.R b/tests/testthat/test-ggplot-point.R index e4ed631db6..4a090e7c05 100644 --- a/tests/testthat/test-ggplot-point.R +++ b/tests/testthat/test-ggplot-point.R @@ -29,7 +29,7 @@ test_that("marker color is non-transparent for open shapes", { grepl("open$", info$data[[1]]$marker$symbol) ) expect_true( - info$data[[1]]$marker$color == toRGB(GeomPoint$default_aes$colour) + info$data[[1]]$marker$color == toRGB(GeomPoint$use_defaults(NULL)$colour) ) }) @@ -48,6 +48,16 @@ test_that("marker color inherits from fill, when appropriate", { }) +test_that("when marker color inherits from fill, colours are assigned correctly #2298", { + df <- data.frame(x = c(1,2), y = c(0,0), color = rep("yellow", 2), fill = 1:2) + p <- ggplot(df) + + geom_point(aes(x = x, y = y, fill = fill, color = color), size = 5, shape = 21) + + scale_fill_gradient(low = "green", high = "red") + pb <- plotly_build(p) + expect_equivalent(pb$x$data[[1]]$marker$color, c("rgba(0,255,0,1)", "rgba(255,0,0,1)")) +}) + + test_that("can plot on sub-second time scale", { d <- data.frame( x = as.POSIXct("2018-09-28 15:13:06 CDT") + 1e-3 * c(1:9, 5000), diff --git a/tests/testthat/test-ggplot-polygons.R b/tests/testthat/test-ggplot-polygons.R index 7efb53b421..82bd1728e9 100644 --- a/tests/testthat/test-ggplot-polygons.R +++ b/tests/testthat/test-ggplot-polygons.R @@ -121,9 +121,15 @@ test_that("geom_polygon(aes(linetype), fill, color)", { }) test_that("geom_polygon(aes(size), fill, colour)", { - gg <- ggplot(poly.df) + - geom_polygon(aes(x, y, size = lab), fill = "orange", colour = "black") + - scale_size_manual(values = c(left = 2, right = 3)) + skip_if_not_installed("ggplot2", "3.4.0") + size_plot <- function() { + ggplot(poly.df) + + geom_polygon(aes(x, y, size = lab), fill = "orange", colour = "black") + + scale_size_manual(values = c(left = 2, right = 3)) + } + # ggplot2 3.4.0 deprecated size, but there is no scale_linewidth_manual(), + # so I don't think it's currently possible to replicate this exact plot + gg <- expect_warning(size_plot(), "size") info <- expect_traces(gg, 2, "color-fill-aes-size") traces.by.name <- list() for(tr in info$data){ diff --git a/tests/testthat/test-ggplot-quantile.R b/tests/testthat/test-ggplot-quantile.R index 483980dac3..16b1e8b4fd 100644 --- a/tests/testthat/test-ggplot-quantile.R +++ b/tests/testthat/test-ggplot-quantile.R @@ -20,7 +20,7 @@ test_that("Basic geom_quantile() works", { expect_equivalent(tr$type, "scatter") expect_equivalent(tr$mode, "lines") expect_equivalent( - tr$line$color, toRGB(GeomQuantile$default_aes[["colour"]]) + tr$line$color, toRGB(GeomQuantile$use_defaults(NULL)[["colour"]]) ) } diff --git a/tests/testthat/test-ggplot-sf.R b/tests/testthat/test-ggplot-sf.R index 2d60ae09f2..6450c23689 100644 --- a/tests/testthat/test-ggplot-sf.R +++ b/tests/testthat/test-ggplot-sf.R @@ -90,6 +90,7 @@ test_that("sf aspect ratio is correct", { test_that("works with a blank theme", { skip_if_not_installed("sf") skip_if_not_installed("s2") + skip_if_not_installed("ggthemes") nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE) p <- ggplot(nc) + geom_sf() + diff --git a/tests/testthat/test-ggplot-summary.R b/tests/testthat/test-ggplot-summary.R new file mode 100644 index 0000000000..39f243f642 --- /dev/null +++ b/tests/testthat/test-ggplot-summary.R @@ -0,0 +1,7 @@ +test_that("stat_summary works", { + p <- ggplot(iris, aes(x = Species, y = Sepal.Length)) + + stat_summary(fun = mean, fun.max = max, fun.min = min) + + stat_summary(fun = median, geom = "crossbar", linetype = "dashed") + + expect_doppelganger_built(p, "stat-summary") +}) diff --git a/tests/testthat/test-ggplot-ticks.R b/tests/testthat/test-ggplot-ticks.R index 2038aaeb9a..ed2a0281e2 100644 --- a/tests/testthat/test-ggplot-ticks.R +++ b/tests/testthat/test-ggplot-ticks.R @@ -171,7 +171,7 @@ test_that("Set the X tick mark locations", { test_that("The breaks can be spaced unevenly", { boxes.uneven <- boxes + scale_y_continuous(breaks = c(4, 4.25, 4.5, 5, 6, 8)) - info <- expect_traces(no.breaks, 1, "uneven") + info <- expect_traces(boxes.uneven, 1, "uneven") }) test_that("R line breaks are translated to HTML line breaks", { diff --git a/tests/testthat/test-ggplot-tooltip.R b/tests/testthat/test-ggplot-tooltip.R index 1aea4acbc6..621ac1e261 100644 --- a/tests/testthat/test-ggplot-tooltip.R +++ b/tests/testthat/test-ggplot-tooltip.R @@ -47,7 +47,7 @@ test_that("can hide x values in tooltip", { }) cars <- ggplot(mtcars, aes(mpg, factor(cyl))) -p <- cars + stat_bin2d(aes(fill = ..density..), binwidth = c(3,1)) +p <- cars + stat_bin2d(aes(fill = after_stat(density)), binwidth = c(3,1)) test_that("geom_tile() displays correct info in tooltip with discrete y", { L <- expect_doppelganger_built(p, "heatmap-discrete-tooltip") diff --git a/tests/testthat/test-ggplot-vline.R b/tests/testthat/test-ggplot-vline.R index ceda7e1dfa..0829974f1f 100644 --- a/tests/testthat/test-ggplot-vline.R +++ b/tests/testthat/test-ggplot-vline.R @@ -46,3 +46,8 @@ test_that("vline works with coord_flip", { expect_equivalent(l$data[[2]]$x, c(5.95, 6.05)) expect_equivalent(l$data[[2]]$y, c(5, 5)) }) + +test_that("geom_vline/geom_hline does not throw an error with ggplotly when no lines are found", { + p <- ggplot(df) + geom_vline(aes(xintercept = x), data = data.frame(x = 1)[F, , drop = FALSE]) + expect_error(plotly::ggplotly(p), NA) +}) diff --git a/tests/testthat/test-ggplot-warnings.R b/tests/testthat/test-ggplot-warnings.R index a7780fb30d..43d9869786 100644 --- a/tests/testthat/test-ggplot-warnings.R +++ b/tests/testthat/test-ggplot-warnings.R @@ -1,4 +1,6 @@ test_that("ggplotly does not issue partial-argument-match warning", { + skip_if_not(getRversion() >= "3.6") + opts <- options(warnPartialMatchArgs = TRUE) on.exit(options(opts), add = TRUE) p <- ggplot(data.frame()) diff --git a/tests/testthat/test-ggridges.R b/tests/testthat/test-ggridges.R new file mode 100644 index 0000000000..feca915ae6 --- /dev/null +++ b/tests/testthat/test-ggridges.R @@ -0,0 +1,313 @@ +skip_if_not_installed("ggridges") +library(ggridges) + +test_that( + desc = "ggridges basic ridgelines", + code = { + + # simple ridge plot + data <- data.frame(x = 1:5, y = rep(1, 5), height = c(0, 1, 3, 4, 2)) + p <- ggplot(data, aes(x, y, height = height)) + geom_ridgeline() + + p2 <- ggplotly(p) + + expect_doppelganger(p2, 'basic_ridgeline') + + + # Negative height + data <- data.frame(x = 1:5, y = rep(1, 5), height = c(0, 1, -1, 3, 2)) + plot_base <- ggplot(data, aes(x, y, height = height)) + + ## Negative height cut off + p <- plot_base + geom_ridgeline() + + p2 <- ggplotly(p) + expect_doppelganger(p2, 'negative_height_cut') + + + ## Negative height allowed + p <- plot_base + geom_ridgeline(min_height = -2) + + p2 <- ggplotly(p) + expect_doppelganger(p2, 'negative_height_retained') + + + # Multiple ridgelines at same time + d <- data.frame( + x = rep(1:5, 3), + y = c(rep(0, 5), rep(1, 5), rep(2, 5)), + height = c(0, 1, 3, 4, 0, 1, 2, 3, 5, 4, 0, 5, 4, 4, 1) + ) + + p <- ggplot(d, aes(x, y, height = height, group = y)) + + geom_ridgeline(fill = "lightblue") + + p2 <- ggplotly(p) + expect_doppelganger(p2, 'multiple_ridgelines') + + # stat = identity (works) + p <- ggplot(d, aes(x, y, height = height, group = y)) + + geom_density_ridges(stat = "identity", scale = 1) + + p2 <- ggplotly(p) + expect_doppelganger(p2, 'stat_identity') + } +) + +test_that( + desc = "ggridges density_ridgeline", + code = { + + # Density ridgeline plots + + p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + + geom_density_ridges() + p2 <- ggplotly(p) + expect_doppelganger(p2, 'density_ridgeline') + + # geom_density_ridges2 (closed polygon) + p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + geom_density_ridges2() + p2 <- ggplotly(p) + expect_doppelganger(p2, 'density_ridgeline2') + + # Grouping aesthetic + # modified dataset that represents species as a number + iris_num <- transform(iris, Species_num = as.numeric(Species)) + + p <- ggplot(iris_num, + aes(x = Sepal.Length, + y = Species_num, + group = Species_num)) + + geom_density_ridges() + p2 <- ggplotly(p) + expect_doppelganger(p2, 'numeric_grouping') + + # Cutting trailing tails (works) + p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + + geom_density_ridges(rel_min_height = 0.01) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'cutting_tails') + + # Non-overlapping ridges (Works) + p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + + geom_density_ridges(scale = 0.9) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'overlapping_none') + + + # Exactly touching (Works) + p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + + geom_density_ridges(scale = 1) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'overlapping_touching') + + + # scale = 5, substantial overlap (Works) + p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + + geom_density_ridges(scale = 5) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'overlapping_lot') + + + # Panel scaling (Works) + p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + + geom_density_ridges(scale = 1) + facet_wrap(~Species) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'overlapping_facet_touching') + + } +) + +test_that( + desc = "ggridges fill colours", + code = { + + # Varying fill colors along the x axis + + # Example 1 (Works, but extra legend that is not shown in ggridges) + d <- data.frame( + x = rep(1:5, 3) + c(rep(0, 5), rep(0.3, 5), rep(0.6, 5)), + y = c(rep(0, 5), rep(1, 5), rep(3, 5)), + height = c(0, 1, 3, 4, 0, 1, 2, 3, 5, 4, 0, 5, 4, 4, 1)) + + p <- ggplot(d, aes(x, y, height = height, group = y, fill = factor(x+y))) + + geom_ridgeline_gradient() + + scale_fill_viridis_d(direction = -1, guide = "none") + p2 <- ggplotly(p) + expect_doppelganger(p2, 'varying_fill_colours') + + # geom_density_ridges_gradient (Doesn't work) + # p <- ggplot(lincoln_weather, aes(x = `Mean Temperature [F]`, y = Month, fill = stat(x))) + + # geom_density_ridges_gradient(scale = 3, rel_min_height = 0.01) + + # scale_fill_viridis_c(name = "Temp. [F]", option = "C") + + # labs(title = 'Temperatures in Lincoln NE in 2016') + # ggplotly(p) # gets stuck + + # Stats + + ## Quantile lines and coloring by quantiles or probabilities (Works) + + # quantile multiple lines + p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + + stat_density_ridges(quantile_lines = TRUE) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'quantile_lines_multi') + + # quantile single line + p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + + stat_density_ridges(quantile_lines = TRUE, quantiles = 2) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'quantile_lines_1') + + # quantile by cut points + p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + + stat_density_ridges(quantile_lines = TRUE, + quantiles = c(0.025, 0.975), + alpha = 0.7) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'quantile_cut_points') + + + ## Colour by quantile + # warning since ggridges uses stat(quantile) + suppressWarnings( + p <- ggplot(iris, aes(x=Sepal.Length, y=Species, fill = factor(stat(quantile)))) + + stat_density_ridges( + geom = "density_ridges_gradient", calc_ecdf = TRUE, + quantiles = 4, quantile_lines = TRUE + ) + + scale_fill_viridis_d(name = "Quartiles") + ) + + suppressWarnings( + p2 <- ggplotly(p) + ) + expect_doppelganger(p2, 'quantile_colouring') + + + # highglight tails of distributions (works) + p <- ggplot(iris, aes(x = Sepal.Length, y = Species, fill = factor(stat(quantile)))) + + stat_density_ridges( + geom = "density_ridges_gradient", + calc_ecdf = TRUE, + quantiles = c(0.025, 0.975) + ) + + scale_fill_manual( + name = "Probability", values = c("#FF0000A0", "#A0A0A0A0", "#0000FFA0"), + labels = c("(0, 0.025]", "(0.025, 0.975]", "(0.975, 1]") + ) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'quantile_colouring_tails_only') + + # mapping prob onto colour (doesn't work) + # p <- ggplot(iris, aes(x = Sepal.Length, y = Species, fill = 0.5 - abs(0.5 - stat(ecdf)))) + + # stat_density_ridges(geom = "density_ridges_gradient", calc_ecdf = TRUE) + + # scale_fill_viridis_c(name = "Tail probability", direction = -1) + # ggplotly(p) + + + } +) + + +test_that( + desc = "ggridges points", + code = { + + set.seed(123) # make jittering reproducible + # jittering points (works) + p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + + geom_density_ridges(jittered_points = TRUE) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'jittering points') + + # raincloud effect (works) + p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + + geom_density_ridges( + jittered_points = TRUE, position = "raincloud", + alpha = 0.7, scale = 0.9 + ) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'raincloud_effect') + + # rug effect (doesn't work, point shape not taken into account) + # p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + + # geom_density_ridges( + # jittered_points = TRUE, + # position = position_points_jitter(width = 0.05, height = 0), + # point_shape = '|', point_size = 3, point_alpha = 1, alpha = 0.7, + # ) + + + # styling points + p <- ggplot(iris, aes(x = Sepal.Length, y = Species, fill = Species)) + + geom_density_ridges( + aes(point_color = Species, point_fill = Species, point_shape = Species), + alpha = .2, point_alpha = 1, jittered_points = TRUE + ) + + scale_point_color_hue(l = 40) + + scale_discrete_manual(aesthetics = "point_shape", values = c(21, 22, 23)) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'styling_points') + + # styling points 2 + p <- ggplot(iris, aes(x = Sepal.Length, y = Species, fill = Species)) + + geom_density_ridges( + aes(point_shape = Species, point_fill = Species, point_size = Petal.Length), + alpha = .2, point_alpha = 1, jittered_points = TRUE + ) + + scale_point_color_hue(l = 40) + scale_point_size_continuous(range = c(0.5, 4)) + + scale_discrete_manual(aesthetics = "point_shape", values = c(21, 22, 23)) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'styling_points2') + + + # aesthetics for vertical line (works) (might need to check line on top of points) + p <- ggplot(iris, aes(x = Sepal.Length, y = Species)) + + geom_density_ridges( + jittered_points = TRUE, quantile_lines = TRUE, scale = 0.9, alpha = 0.7, + vline_size = 1, vline_color = "red", + point_size = 0.4, point_alpha = 1, + position = position_raincloud(adjust_vlines = TRUE) + ) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'raincloud_vertical_line_points') + + } +) + + +test_that( + desc = "ggridges alternate stats", + code = { + + ## stat_density_ridges (works) + suppressWarnings({ + p <- ggplot(iris, aes(x = Sepal.Length, y = Species, height = stat(density))) + + geom_density_ridges(stat = "density") + + p2 <- ggplotly(p) + }) + expect_doppelganger(p2, 'stat_density') + + + skip_if_not_installed("dplyr") + iris_densities <- iris %>% + dplyr::group_by(Species) %>% + dplyr::group_modify(~ ggplot2:::compute_density(.x$Sepal.Length, NULL)) %>% + dplyr::rename(Sepal.Length = x) + + p <- ggplot(iris_densities, aes(x = Sepal.Length, y = Species, height = density)) + + geom_density_ridges(stat = "identity") + p2 <- ggplotly(p) + expect_doppelganger(p2, 'manual_densities_stat_identity') + + ## histograms (works) + p <- ggplot(iris, aes(x = Sepal.Length, y = Species, height = stat(density))) + + geom_density_ridges(stat = "binline", bins = 20, scale = 0.95, draw_baseline = FALSE) + p2 <- ggplotly(p) + expect_doppelganger(p2, 'histogram_ridges') + + } +) + diff --git a/tests/testthat/test-plotly-group.R b/tests/testthat/test-plotly-group.R index ea8b94dab6..6ffe097705 100644 --- a/tests/testthat/test-plotly-group.R +++ b/tests/testthat/test-plotly-group.R @@ -56,7 +56,7 @@ test_that("Missing values are preserved for lines within a color variable", { m <- mtcars m$rowname <- rownames(mtcars) p <- m %>% - dplyr::group_by_("rowname") %>% + dplyr::group_by(rowname) %>% plot_ly(x = ~wt, y = ~mpg) %>% add_markers() diff --git a/tests/testthat/test-plotly-sf.R b/tests/testthat/test-plotly-sf.R index 2e44ce7964..8819432eee 100644 --- a/tests/testthat/test-plotly-sf.R +++ b/tests/testthat/test-plotly-sf.R @@ -96,8 +96,6 @@ test_that("Can plot sfc with a missing crs", { test_that("plot_ly() defaults to blank axes", { skip_if_not_installed("sf") - skip_if_not_installed("maptools") - skip_if_not_installed("rgeos") m <- sf::st_as_sf(maps::map("world", plot = FALSE, fill = TRUE)) diff --git a/tests/testthat/test-plotly-shiny.R b/tests/testthat/test-plotly-shiny.R index 513aa155fb..13369aef58 100644 --- a/tests/testthat/test-plotly-shiny.R +++ b/tests/testthat/test-plotly-shiny.R @@ -23,5 +23,5 @@ test_that("event_data shiny app works", { skip_shinytest_tests() appdir <- system.file(package = "plotly", "examples", "shiny", "event_data") - shinytest::expect_pass(shinytest::testApp(appdir)) + shiny::runTests(appdir) }) diff --git a/tests/testthat/test-plotly-subplot.R b/tests/testthat/test-plotly-subplot.R index e91b733cfe..34bb6f0856 100644 --- a/tests/testthat/test-plotly-subplot.R +++ b/tests/testthat/test-plotly-subplot.R @@ -148,7 +148,7 @@ test_that("ggplotly understands GGally", { v5 = v1 ** 2 ) expect_doppelganger( - ggcorr(data, method = c("everything", "pearson")), + GGally::ggcorr(d, method = c("everything", "pearson")), "ggally-ggcorr" ) }) @@ -274,6 +274,21 @@ test_that("shape paper repositioning", { expect_equal(y1, c(30, 0.75)) }) +test_that("raster2uri supports nativeRaster objects", { + skip_if_not_installed("png") + + r <- as.raster(matrix(c("black", "red", "green", "blue"), ncol = 4L)) + nr <- structure( + c(-16777216L, -16776961L, -16711936L, -65536L), + dim = c(1L, 4L), + class = "nativeRaster", + channels = 4L + ) + uri_r <- raster2uri(r) + uri_nr <- raster2uri(nr) + expect_equal(uri_r, uri_nr) +}) + test_that("image paper repositioning", { skip_if_not_installed("png") diff --git a/tests/testthat/test-plotly.R b/tests/testthat/test-plotly.R index f3c437694d..7d97642034 100644 --- a/tests/testthat/test-plotly.R +++ b/tests/testthat/test-plotly.R @@ -142,8 +142,7 @@ test_that("Character strings correctly mapped to a positional axis", { letters <- LETTERS[as.numeric(sort(as.character(1:26)))] p <- plot_ly(x = letters, y = seq_along(letters)) %>% add_bars(color = rep(c("a1", "a2"), length.out = 26)) - l <- expect_warning(expect_traces(p, 2, "character-axis"), - regexp = "minimal value for n is 3") + l <- expect_traces(p, 2, "character-axis") expect_equivalent(l$layout$xaxis$type, "category") expect_equivalent(l$layout$xaxis$categoryorder, "array") expect_equivalent(l$layout$xaxis$categoryarray, LETTERS) @@ -360,6 +359,7 @@ test_that("group_by() on a plotly object doesn't produce warning", { }) test_that("Check QTables dont cause errors", { + n <- 5 s <- data.frame( x = array(runif(n), dim = n), x2 = array(runif(n), dim = n), diff --git a/tests/testthat/test-rotated-ticks.R b/tests/testthat/test-rotated-ticks.R index e710fa64ac..7aadf4232e 100644 --- a/tests/testthat/test-rotated-ticks.R +++ b/tests/testthat/test-rotated-ticks.R @@ -1,3 +1,5 @@ +testthat::skip_if_not(getRversion() >= "4.3.0") + ss <- data.frame(State=paste("some long text", c("CA", "NY", "TX")), Prop.Inv=c(0, 1, 0.7), diff --git a/tests/testthat/test-ticktext-linebreaks.R b/tests/testthat/test-ticktext-linebreaks.R index 7aa2846a7f..315e2f9e4a 100644 --- a/tests/testthat/test-ticktext-linebreaks.R +++ b/tests/testthat/test-ticktext-linebreaks.R @@ -2,11 +2,7 @@ # Compute margin comp_margin <- function(gg, axisTickText) { plot <- ggfun("plot_clone")(gg) - theme <- ggfun("plot_theme")(plot) - elements <- names(which(sapply(theme, inherits, "element"))) - for (i in elements) { - theme[[i]] <- ggplot2::calc_element(i, theme) - } + theme <- calculated_theme_elements(plot) pm <- unitConvert(theme$plot.margin, "pixels") gglayout <- list( @@ -29,33 +25,47 @@ expect_margin <- function(L, gg, ticktext) { expect_equal(round(L$layout$margin$l, 10), round(margin_l, 10)) } -# Linebreaks -d <- data.frame(x = c(1, 2, 3), y = c("ticktext\nlong_ticktext\nticktext", "ticktext", "ticktext")) -gg <- ggplot(d, aes(x, y)) + geom_bar(stat = "identity") + test_that("ggplotly takes account of linebreaks in ticktext", { + testthat::skip_if_not(getRversion() >= "4.3.0") + + # Linebreaks + d <- data.frame( + x = c(1, 2, 3), + y = c("ticktext\nlong_ticktext\nticktext", "ticktext", "ticktext") + ) + gg <- ggplot(d, aes(x, y)) + geom_bar(stat = "identity") + # Visual Test L <- expect_doppelganger_built(gg, "ticktext-linebreaks") # ggplotly returns correct margin expect_margin(L, gg, "long_ticktext") }) -# Linebreaks one category -d <- data.frame(x = c(1), y = c("ticktext\nlong_ticktext\nticktext")) -gg <- ggplot(d, aes(x, y)) + geom_bar(stat = "identity") - test_that("ggplotly takes account of linebreaks in ticktext with only one category", { + testthat::skip_if_not(getRversion() >= "4.3.0") + + # Linebreaks one category + d <- data.frame(x = c(1), y = c("ticktext\nlong_ticktext\nticktext")) + gg <- ggplot(d, aes(x, y)) + geom_bar(stat = "identity") + # Visual Test L <- expect_doppelganger_built(gg, "ticktext-linebreaks-one-cat") # ggplotly returns correct margin expect_margin(L, gg, "long_ticktext") }) -# No linebreaks -d <- data.frame(x = c(1, 2, 3), y = c("ticktext long_ticktext ticktext", "ticktext", "ticktext")) -gg <- ggplot(d, aes(x, y)) + geom_bar(stat = "identity") - test_that("ggplotly works with no linebreaks in ticktext", { + testthat::skip_if_not(getRversion() >= "4.3.0") + + # No linebreaks + d <- data.frame( + x = c(1, 2, 3), + y = c("ticktext long_ticktext ticktext", "ticktext", "ticktext") + ) + gg <- ggplot(d, aes(x, y)) + geom_bar(stat = "identity") + # Visual Test L <- expect_doppelganger_built(gg, "ticktext-linebreaks-no-linebreaks") # ggplotly returns correct margin diff --git a/theSrc/scripts/widgetdefinition.js b/theSrc/scripts/widgetdefinition.js index 0bad303c6c..a5f5aaff2c 100644 --- a/theSrc/scripts/widgetdefinition.js +++ b/theSrc/scripts/widgetdefinition.js @@ -12,7 +12,7 @@ const widgetDefinition = { var height = instance.height || height; Plotly.relayout(el, {width: width, height: height}); } - }, + }, renderValue: function(el, x, instance) { @@ -158,28 +158,12 @@ const widgetDefinition = { } } - // remove "sendDataToCloud", unless user has specified they want it - x.config = x.config || {}; - if (!x.config.cloud) { - x.config.modeBarButtonsToRemove = x.config.modeBarButtonsToRemove || []; - x.config.modeBarButtonsToRemove.push("sendDataToCloud"); - } - - // if the object was passed in from another window, plotly will falsely think it isn't a "plain object" - // to get around this, we have to create a deep copy of the object - if (inIframe() && !isPlainObject(x)) - x = JSON.parse(JSON.stringify(x)) - // if no plot exists yet, create one with a particular configuration if (!instance.plotly) { - var plot = Plotly.newPlot(graphDiv, x); + var plot = Plotly.plot(graphDiv, x); instance.plotly = true; - } else if (x.layout.transition) { - - var plot = Plotly.react(graphDiv, x); - } else { // this is essentially equivalent to Plotly.newPlot(), but avoids creating @@ -191,7 +175,7 @@ const widgetDefinition = { // TODO: why is this necessary to get crosstalk working? graphDiv.data = undefined; graphDiv.layout = undefined; - var plot = Plotly.newPlot(graphDiv, x); + var plot = Plotly.plot(graphDiv, x); } // Trigger plotly.js calls defined via `plotlyProxy()` @@ -581,7 +565,7 @@ const widgetDefinition = { graphDiv.setAttribute("rhtmlwidget-status", "ready"); }); } // end of renderValue -}; // end of widget definition +} /** * @param graphDiv The Plotly graph div @@ -639,9 +623,9 @@ TraceManager.prototype.updateFilter = function(group, keys) { traces.push(trace); } } - this.gd.data = traces; } + this.gd.data = traces; Plotly.redraw(this.gd); // NOTE: we purposely do _not_ restore selection(s), since on filter, @@ -899,10 +883,6 @@ function isPlainObject(obj) { ); } -function inIframe() { - return window && window.self !== window.top; -} - function subsetArrayAttrs(obj, indices) { var newObj = {}; Object.keys(obj).forEach(function(k) { @@ -951,18 +931,18 @@ function removeBrush(el) { // N milliseconds. If `immediate` is passed, trigger the function on the // leading edge, instead of the trailing. function debounce(func, wait, immediate) { - var timeout; - return function() { - var context = this, args = arguments; - var later = function() { - timeout = null; - if (!immediate) func.apply(context, args); - }; - var callNow = immediate && !timeout; - clearTimeout(timeout); - timeout = setTimeout(later, wait); - if (callNow) func.apply(context, args); - }; + var timeout; + return function() { + var context = this, args = arguments; + var later = function() { + timeout = null; + if (!immediate) func.apply(context, args); + }; + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) func.apply(context, args); + }; }; module.exports = widgetDefinition \ No newline at end of file