Skip to content

Commit 666075b

Browse files
committed
Merge branch 'master' into gen-plotly-bundles
2 parents 93ef777 + 0454f38 commit 666075b

File tree

116 files changed

+933
-176
lines changed

Some content is hidden

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

116 files changed

+933
-176
lines changed

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

+7-20
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ jobs:
2929
# vdiffr & shinytest only runs on mac r-release since the results aren't cross-platform
3030
- {os: macOS-latest, r: 'release', visual_tests: true, node: "14.x", shinytest: true}
3131
- {os: windows-latest, r: 'release'}
32-
- {os: windows-latest, r: '4.1'}
33-
- {os: windows-latest, r: '3.6'}
32+
# - {os: windows-latest, r: 'oldrel-1'} # pak is having issues
3433
- {os: ubuntu-latest, r: 'devel'}
3534
- {os: ubuntu-latest, r: 'release'}
3635
- {os: ubuntu-latest, r: 'oldrel-1'}
@@ -48,6 +47,8 @@ jobs:
4847

4948
steps:
5049
- uses: actions/checkout@v2
50+
with:
51+
persist-credentials: false
5152

5253
- uses: r-lib/actions/setup-r@v2
5354
id: install-r
@@ -62,26 +63,10 @@ jobs:
6263
cache-version: 3
6364
needs: check
6465

65-
- name: Set up Python 3.8
66-
uses: actions/setup-python@v2
67-
with:
68-
python-version: 3.8
69-
7066
- name: Install kaleido
7167
if: matrix.config.visual_tests == true
7268
run: |
73-
sudo chown -R $UID $CONDA # https://github.com/nextstrain/conda/issues/5
74-
Rscript -e "reticulate::install_miniconda()"
75-
Rscript -e "reticulate::conda_install('r-reticulate', 'python-kaleido')"
76-
Rscript -e "reticulate::conda_install('r-reticulate', 'plotly', channel = 'plotly')"
77-
Rscript -e "reticulate::use_miniconda('r-reticulate')"
78-
79-
- name: Install shinytest deps
80-
if: matrix.config.shinytest == true
81-
run: |
82-
Rscript -e 'shinytest::installDependencies()'
83-
R CMD install .
84-
shell: bash
69+
Rscript -e 'library(reticulate); use_python(install_python()); py_install(c("kaleido", "plotly"))'
8570
8671
# Run test() before R CMD check since, for some reason, rcmdcheck::rcmdcheck() skips vdiffr tests
8772
- name: Run Tests
@@ -98,7 +83,9 @@ jobs:
9883
uses: actions/upload-artifact@master
9984
with:
10085
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
101-
path: ./
86+
path: |
87+
./
88+
!./.git/
10289
10390
- name: Check package
10491
uses: r-lib/actions/check-r-package@v2

DESCRIPTION

+4-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Imports:
4242
vctrs,
4343
tibble,
4444
lazyeval (>= 0.2.0),
45-
rlang (>= 0.4.10),
45+
rlang (>= 1.0.0),
4646
crosstalk,
4747
purrr,
4848
data.table,
@@ -57,7 +57,7 @@ Suggests:
5757
testthat,
5858
knitr,
5959
shiny (>= 1.1.0),
60-
shinytest (>= 1.3.0),
60+
shinytest2,
6161
curl,
6262
rmarkdown,
6363
Cairo,
@@ -75,7 +75,8 @@ Suggests:
7575
palmerpenguins,
7676
rversions,
7777
reticulate,
78-
rsvg
78+
rsvg,
79+
ggridges
7980
LazyData: true
8081
RoxygenNote: 7.3.1
8182
Encoding: UTF-8

NAMESPACE

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ S3method(geom2trace,GeomErrorbarh)
1313
S3method(geom2trace,GeomPath)
1414
S3method(geom2trace,GeomPoint)
1515
S3method(geom2trace,GeomPolygon)
16+
S3method(geom2trace,GeomRidgelineGradient)
1617
S3method(geom2trace,GeomText)
1718
S3method(geom2trace,GeomTile)
1819
S3method(geom2trace,default)
@@ -49,6 +50,10 @@ S3method(to_basic,GeomContour)
4950
S3method(to_basic,GeomCrossbar)
5051
S3method(to_basic,GeomDensity)
5152
S3method(to_basic,GeomDensity2d)
53+
S3method(to_basic,GeomDensityLine)
54+
S3method(to_basic,GeomDensityRidges)
55+
S3method(to_basic,GeomDensityRidges2)
56+
S3method(to_basic,GeomDensityRidgesGradient)
5257
S3method(to_basic,GeomDotplot)
5358
S3method(to_basic,GeomErrorbar)
5459
S3method(to_basic,GeomErrorbarh)
@@ -65,6 +70,8 @@ S3method(to_basic,GeomRaster)
6570
S3method(to_basic,GeomRasterAnn)
6671
S3method(to_basic,GeomRect)
6772
S3method(to_basic,GeomRibbon)
73+
S3method(to_basic,GeomRidgeline)
74+
S3method(to_basic,GeomRidgelineGradient)
6875
S3method(to_basic,GeomRug)
6976
S3method(to_basic,GeomSegment)
7077
S3method(to_basic,GeomSf)

NEWS.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# plotly (development version)
22

3+
## New features
4+
5+
* `ggplotly()` now supports the `{ggridges}` package. (#2314)
6+
7+
## Improvements
8+
9+
* `ggplotly()` now works better with the development version of ggplot2 (> v3.4.4). (#2315, #2368)
10+
11+
## Bug fixes
12+
13+
* Closed #2337: Creating a new `event_data()` handler no longer causes a spurious reactive update of existing `event_data()`s. (#2339)
14+
315
# 4.10.4
416

517
## Improvements

R/export.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' Export a plotly graph to a static file
22
#'
3-
#' This function is in the process of being deprecated (use [orca] instead).
3+
#' This function is deprecated, use [save_image] instead.
44
#'
55
#' @details For SVG plots, a screenshot is taken via `webshot::webshot()`.
66
#' Since `phantomjs` (and hence `webshot`) does not support WebGL,
@@ -19,7 +19,7 @@
1919
#' @author Carson Sievert
2020
#'
2121
export <- function(p = last_plot(), file = "plotly.png", selenium = NULL, ...) {
22-
.Deprecated("orca")
22+
.Deprecated("save_image")
2323

2424
# infer the file type
2525
fileType <- tolower(tools::file_ext(file))

R/ggplotly.R

+27-7
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ gg2list <- function(p, width = NULL, height = NULL,
277277

278278
# Compute aesthetics to produce data with generalised variable names
279279
data <- by_layer(function(l, d) l$compute_aesthetics(d, plot))
280+
if (exists("setup_plot_labels", envir = asNamespace("ggplot2"))) {
281+
# Mirror ggplot2/#5879
282+
plot$labels <- ggfun("setup_plot_labels")(plot, layers, data)
283+
}
284+
280285

281286
# add frame to group if it exists
282287
data <- lapply(data, function(d) {
@@ -463,12 +468,8 @@ gg2list <- function(p, width = NULL, height = NULL,
463468
assign(var, built_env[[var]], envir = envir)
464469
}
465470

466-
# initiate plotly.js layout with some plot-wide theming stuff
467-
theme <- ggfun("plot_theme")(plot)
468-
elements <- names(which(sapply(theme, inherits, "element")))
469-
for (i in elements) {
470-
theme[[i]] <- ggplot2::calc_element(i, theme)
471-
}
471+
theme <- calculated_theme_elements(plot)
472+
472473
# Translate plot wide theme elements to plotly.js layout
473474
pm <- unitConvert(theme$plot.margin, "pixels")
474475
gglayout <- list(
@@ -1154,6 +1155,23 @@ gg2list <- function(p, width = NULL, height = NULL,
11541155
# Due to the non-standard use of assign() in g2list() (above)
11551156
utils::globalVariables(c("groupDomains", "layers", "prestats_data", "scales", "sets"))
11561157

1158+
# Get the "complete" set of theme elements and their calculated values
1159+
calculated_theme_elements <- function(plot) {
1160+
if (is.function(asNamespace("ggplot2")$complete_theme)) {
1161+
theme <- ggplot2::complete_theme(plot$theme)
1162+
elements <- names(theme)
1163+
} else {
1164+
theme <- ggfun("plot_theme")(plot)
1165+
elements <- names(which(sapply(theme, inherits, "element")))
1166+
}
1167+
1168+
for (i in elements) {
1169+
theme[[i]] <- ggplot2::calc_element(i, theme)
1170+
}
1171+
1172+
theme
1173+
}
1174+
11571175

11581176
#-----------------------------------------------------------------------------
11591177
# ggplotly 'utility' functions
@@ -1384,7 +1402,8 @@ rect2shape <- function(rekt = ggplot2::element_rect()) {
13841402
linetype = lty2dash(rekt$linetype)
13851403
),
13861404
yref = "paper",
1387-
xref = "paper"
1405+
xref = "paper",
1406+
layer = "below"
13881407
)
13891408
}
13901409

@@ -1408,6 +1427,7 @@ gdef2trace <- function(gdef, theme, gglayout) {
14081427
# N.B. ggplot2 >v3.4.2 (specifically #4879) renamed bar to decor and also
14091428
# started returning normalized values for the key field
14101429
decor <- gdef$decor %||% gdef$bar
1430+
decor$value <- decor$value %||% decor$max
14111431
rng <- range(decor$value)
14121432
decor$value <- scales::rescale(decor$value, from = rng)
14131433
if (!"decor" %in% names(gdef)) {

0 commit comments

Comments
 (0)