Skip to content

Commit eb2a43f

Browse files
committed
Merge tag 'v4.12.0'
2 parents a274d2c + ba96ad9 commit eb2a43f

File tree

374 files changed

+1025
-603
lines changed

Some content is hidden

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

374 files changed

+1025
-603
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ README.Rmd
2121
abbvie.R
2222
^\.httr-oauth$
2323
^\.github$
24+
^\.venv$
25+
CLAUDE\.md

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434
- {os: ubuntu-latest, r: 'release'}
3535
- {os: ubuntu-latest, r: 'oldrel-1'}
3636
- {os: ubuntu-latest, r: 'oldrel-2'}
37-
- {os: ubuntu-latest, r: 'oldrel-3'}
38-
- {os: ubuntu-latest, r: 'oldrel-4'}
37+
# - {os: ubuntu-latest, r: 'oldrel-3'} # dependency issues with oldrel-3
38+
# - {os: ubuntu-latest, r: 'oldrel-4'} # dependency issues with oldrel-4
3939

4040
env:
4141
VISUAL_TESTS: ${{ matrix.config.visual_tests }}
@@ -46,7 +46,7 @@ jobs:
4646
plotly_api_key: ${{ secrets.PLOTLY_API_KEY }}
4747

4848
steps:
49-
- uses: actions/checkout@v2
49+
- uses: actions/checkout@v4
5050
with:
5151
persist-credentials: false
5252

@@ -63,10 +63,17 @@ jobs:
6363
cache-version: 3
6464
needs: check
6565

66+
- name: Set up Python (for reticulate)
67+
if: matrix.config.visual_tests == true
68+
uses: actions/setup-python@v4
69+
with:
70+
python-version: '3.11'
71+
6672
- name: Install kaleido
6773
if: matrix.config.visual_tests == true
6874
run: |
69-
Rscript -e 'library(reticulate); use_python(install_python()); py_install(c("kaleido", "plotly"))'
75+
# We pin kaleido to v0.2.1 here since >=v1.0 doesn't appear to be correctly rendering some plots
76+
Rscript -e 'library(reticulate); use_python(Sys.which("python")); py_install(c("kaleido==0.2.1", "plotly"))'
7077
7178
# Run test() before R CMD check since, for some reason, rcmdcheck::rcmdcheck() skips vdiffr tests
7279
- name: Run Tests

.github/workflows/docs.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Add this file to plotly/plotly.R at .github/workflows/docs.yml
2+
#
3+
# This workflow builds and deploys the R documentation site from
4+
# the graphing-library-docs repository to this repo's GitHub Pages.
5+
6+
name: Deploy R Documentation
7+
8+
on:
9+
# Manual trigger
10+
workflow_dispatch:
11+
12+
# Run weekly to pick up any docs changes
13+
schedule:
14+
- cron: '0 0 * * 0' # Every Sunday at midnight UTC
15+
16+
# Optional: trigger from docs repo via repository_dispatch
17+
repository_dispatch:
18+
types: [docs-updated]
19+
20+
# Sets permissions for GitHub Pages deployment
21+
permissions:
22+
contents: read
23+
pages: write
24+
id-token: write
25+
26+
# Allow only one concurrent deployment
27+
concurrency:
28+
group: "pages"
29+
cancel-in-progress: false
30+
31+
env:
32+
# Change this if the docs repo moves to a different location
33+
DOCS_REPO: cpsievert/graphing-library-docs
34+
DOCS_BRANCH: master
35+
36+
jobs:
37+
build:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Checkout docs repository
41+
uses: actions/checkout@v4
42+
with:
43+
repository: ${{ env.DOCS_REPO }}
44+
ref: ${{ env.DOCS_BRANCH }}
45+
46+
- name: Setup Ruby
47+
uses: ruby/setup-ruby@v1
48+
with:
49+
ruby-version: '3.2'
50+
bundler-cache: true
51+
52+
- name: Fetch R/ggplot2 docs from plotly.r-docs
53+
run: make fetch
54+
55+
- name: Build site
56+
run: bundle exec jekyll build --config _config.yml,_config_production.yml
57+
env:
58+
JEKYLL_ENV: production
59+
60+
- name: Upload artifact
61+
uses: actions/upload-pages-artifact@v3
62+
with:
63+
path: _site
64+
65+
deploy:
66+
environment:
67+
name: github-pages
68+
url: ${{ steps.deployment.outputs.page_url }}
69+
runs-on: ubuntu-latest
70+
needs: build
71+
steps:
72+
- name: Deploy to GitHub Pages
73+
id: deployment
74+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Rapp.history
44
*.RData
55
*.Rproj.user
66
*.DS_Store
7+
.venv
78
node_modules/
89
build_site.R
910
revdep_email.R
@@ -18,3 +19,4 @@ revdep/
1819
travis_debug.R
1920
.httr-oauth
2021
tests/testthat/Rplots.pdf
22+
.venv/

CLAUDE.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
plotly is an R package for creating interactive web graphics via the plotly.js JavaScript library. It provides two main interfaces:
8+
- `ggplotly()`: Converts ggplot2 objects to interactive plotly visualizations
9+
- `plot_ly()`: Direct interface to plotly.js for specialized chart types
10+
11+
## Common Commands
12+
13+
### Running Tests
14+
```r
15+
# Run all tests
16+
devtools::test()
17+
18+
# Run visual tests (requires kaleido via reticulate)
19+
Sys.setenv("VISUAL_TESTS" = "true")
20+
devtools::test()
21+
22+
# Run a single test file
23+
devtools::test(filter = "ggplot-bar")
24+
```
25+
26+
### Package Check
27+
```r
28+
rcmdcheck::rcmdcheck()
29+
```
30+
31+
### Building Documentation
32+
```r
33+
devtools::document()
34+
```
35+
36+
### Visual Testing via Docker
37+
For consistent visual test results:
38+
```shell
39+
docker run -v $(pwd):/home/plotly --privileged -p 3838:3838 cpsievert/plotly-orca
40+
```
41+
Access the validation Shiny app at http://0.0.0.0:3838
42+
43+
CI-only visual test run:
44+
```shell
45+
docker run -e VMODE="ci" -v $(pwd):/home/plotly --privileged cpsievert/plotly-orca
46+
```
47+
48+
## Architecture
49+
50+
### ggplot2 to plotly Conversion Pipeline
51+
52+
The conversion from ggplot2 to plotly follows this flow:
53+
54+
1. **`ggplotly()`** (`R/ggplotly.R`): Entry point that dispatches on input type
55+
2. **`gg2list()`** (`R/ggplotly.R`): Main conversion function that:
56+
- Builds the ggplot object to extract computed data
57+
- Processes each layer through `layers2traces()`
58+
- Processes layout through `layers2layout()`
59+
3. **`layers2traces()`** (`R/layers2traces.R`): Converts ggplot2 geom layers to plotly trace objects
60+
4. **`layers2layout()`** (`R/layers2layout.R`): Converts ggplot2 theme/coordinate settings to plotly layout
61+
62+
### Direct plotly Interface
63+
64+
1. **`plot_ly()`** (`R/plotly.R`): Creates a plotly object with trace attributes
65+
2. **`add_trace()`** and `add_*()` functions (`R/add.R`): Add traces to existing plots
66+
3. **`layout()`** (`R/layout.R`): Modify plot layout
67+
4. **`plotly_build()`** (`R/plotly_build.R`): Evaluates lazy attributes and creates final JSON for plotly.js
68+
69+
### Key Modules
70+
71+
- `R/shiny.R`: Shiny integration and event handling
72+
- `R/subplots.R`: Combining multiple plots
73+
- `R/highlight.R`: Linked brushing/crosstalk support
74+
- `R/animate.R`: Animation support
75+
- `R/kaleido.R`, `R/orca.R`: Static image export
76+
77+
## Testing Patterns
78+
79+
Tests should check the return value of `plotly_build()`:
80+
```r
81+
test_that("example test", {
82+
p <- plot_ly(x = 1:10, y = 1:10)
83+
built <- plotly_build(p)
84+
expect_equal(built$x$data[[1]]$x, 1:10)
85+
})
86+
```
87+
88+
Visual tests use `expect_doppelganger()` from `tests/testthat/helper-vdiffr.R`:
89+
```r
90+
test_that("visual test", {
91+
p <- plot_ly(x = 1:10, y = 1:10)
92+
expect_doppelganger(p, "scatter-basic")
93+
})
94+
```
95+
96+
## Code Style
97+
98+
Follow the tidyverse style guide: http://style.tidyverse.org/

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: plotly
22
Title: Create Interactive Web Graphics via 'plotly.js' (modified for use in MIRO)
3-
Version: 4.10.4.9999
3+
Version: 4.12.0.9999
44
Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"),
55
email = "cpsievert1@gmail.com", comment = c(ORCID = "0000-0002-4958-2844")),
66
person("Chris", "Parmer", role = "aut",
@@ -79,11 +79,12 @@ Suggests:
7979
rsvg,
8080
ggridges
8181
LazyData: true
82-
RoxygenNote: 7.3.1
82+
RoxygenNote: 7.3.3
8383
Encoding: UTF-8
8484
Roxygen: list(markdown = TRUE)
8585
Config/Needs/check:
8686
tidyverse/ggplot2,
87+
ggobi/GGally,
8788
rcmdcheck,
8889
devtools,
8990
reshape2,

NAMESPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ S3method(linewidth_or_size,default)
3030
S3method(linewidth_or_size,element)
3131
S3method(plotly_build,"NULL")
3232
S3method(plotly_build,gg)
33+
S3method(plotly_build,ggmatrix)
3334
S3method(plotly_build,list)
3435
S3method(plotly_build,plotly)
3536
S3method(print,api)
@@ -38,6 +39,9 @@ S3method(print,api_grid_local)
3839
S3method(print,api_plot)
3940
S3method(print,kaleidoScope)
4041
S3method(print,plotly_data)
42+
S3method(process,api_image)
43+
S3method(process,api_plot)
44+
S3method(process,default)
4145
S3method(to_basic,GeomAbline)
4246
S3method(to_basic,GeomAlluvium)
4347
S3method(to_basic,GeomAnnotationMap)

NEWS.md

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,54 @@
1-
# plotly (development version)
1+
# plotly 4.12.0
2+
3+
## Changes to plotly.js
4+
5+
Upgrades plotly.js from v2.11.1 to v2.25.2 (35 releases). Key new features now available:
6+
7+
* **Multiple legends**: Support for `legend2`, `legend3`, etc. with separate positioning and visibility control
8+
* **Shape labels**: New `label` attribute for shapes and `label.texttemplate` for parametric shapes
9+
* **Marker direction**: New `marker.angle`, `marker.angleref`, and `marker.standoff` properties for directional markers
10+
* **Y-axis positioning**: `shift` and `autoshift` properties to avoid y-axis overlapping in multi-axis plots
11+
* **Mapbox clustering**: Clustering options and bounds support for `scattermapbox` traces
12+
* **Equal Earth projection**: New map projection option for geo subplots
13+
* **Pattern fills**: Pattern support extended to pie, funnelarea, sunburst, icicle, and treemap charts
14+
* **Editable selections**: Persistent and editable selections over cartesian subplots with `editSelection` config option
15+
* **Axis label aliases**: `labelalias` for simplified axis label customization
16+
* **Grid styling**: `griddash` property and minor tick/grid line styling options
17+
18+
Also includes a security fix for prototype pollution and ~90KB bundle size reduction.
19+
20+
See the [plotly.js releases page](https://github.com/plotly/plotly.js/releases) for the full changelog.
21+
22+
## Improvements
23+
24+
* `save_image()` now works with kaleido v1.0 and higher. (#2447)
25+
26+
## Bug fixes
27+
28+
* `plotly_build()` now works with `ggmatrix` objects (e.g., from `GGally::ggpairs()`). (#2447)
29+
* Closed #2415: `ggplotly()` now shows variables named 'group' in tooltips when mapped to aesthetics like `colour`.
30+
* Closed #2455, #2460: `ggplotly()` no longer creates empty shapes when `panel.border` is `element_blank()` (ggplot2 4.0.0 compatibility).
31+
* Closed #2466: `ggplotly()` no longer errors when `scale_*_manual()` has unused aesthetics (e.g., `aesthetics = c("colour", "fill")` when only colour is used).
32+
* Closed #2305: `ggplotly()` now respects `geom_boxplot(outlier.shape = NA)` to hide outlier points.
33+
* Closed #2467: `ggplotly()` now correctly shows legends and splits traces when scales have multiple aesthetics.
34+
* Closed #2407, #2187: `ggplotly()` now translates `legend.position` theme element to plotly layout (supports "bottom", "top", "left", and numeric positions).
35+
* Closed #2281: `ggplotly()` no longer drops legends when `geom_blank()` is present in the plot.
36+
37+
# plotly 4.11.0
238

339
## New features
440

541
* `ggplotly()` now supports the `{ggridges}` package. (#2314)
642

743
## Improvements
844

9-
* `ggplotly()` now works better with the development version of ggplot2 (> v3.4.4). (#2315, #2368)
45+
* Various updates to `ggplotly()` to better support recent versions of ggplot2. (#2315, #2368, #2442, thanks @teunbrand).
1046

1147
## Bug fixes
1248

1349
* Closed #2337: Creating a new `event_data()` handler no longer causes a spurious reactive update of existing `event_data()`s. (#2339)
1450
* Closed #2376: Removes errant boxmode warning for grouped boxplot. (#2396)
51+
* Closed #2392: Trivial warning about RColorBrewer minimal n value is no longer thrown (#1999)
1552

1653
# 4.10.4
1754

@@ -368,7 +405,7 @@ This is minor patch release with a few minor bug fixes and updates test expectat
368405
* Added the `highlight()` function for configuring selection modes/sequences/options.
369406
* Added support for animation. For some relatively basic examples, see the examples section of `help(animation)`. For a more thorough overview, see <https://plotly-r.com/animating-views.html>
370407
* Added a `frame` argument to `plot_ly()` for creating animations. Also added the `animation_opts()`, `animation_slider()`, and `animation_button()` functions for configuring animation defaults.
371-
* Added a new interface to [v2 of the REST API](https://api.plot.ly/v2). This new interface makes the `plotly_POST()` and `get_figure()` functions obsolete (use `api_create()` and `api_download_plot()` instead), and thus, are now deprecated, but remain around for backwards-compatibility. For more details, see `help(api)`.
408+
* Added a new interface to v2 of the REST API. This new interface makes the `plotly_POST()` and `get_figure()` functions obsolete (use `api_create()` and `api_download_plot()` instead), and thus, are now deprecated, but remain around for backwards-compatibility. For more details, see `help(api)`.
372409
* Added support for conversion of more **ggplot2** geoms via `ggplotly()`: `GeomCol`, `GeomRug`, `GeomCrossbar`, `GeomQuantile`, `GeomSpoke`, `GeomDotplot`, `GeomRasterAnn` (i.e., `annotation_raster()`), and `GeomAnnotationMap` (i.e., `annotation_map()`).
373410
* Added a new function `raster2uri()` which makes it easier to embed raster objects as [images](https://plotly.com/r/reference/#layout-images) via data URIs. For examples, see `help(raster2uri)`.
374411
* `ggplotly()` gains a new argument, `dynamicTicks`, which allows axis ticks to update upon zoom/pan interactions (fixes #485).
@@ -1145,7 +1182,7 @@ Fixed filename, fileopt arguments in plot_ly. Specifying the same filename will
11451182

11461183
1.0.8 -- 14 Sep 2015
11471184

1148-
Added the plotly_IMAGES() function which interfaces to the images endpoint https://api.plot.ly/v2/#images
1185+
Added the plotly_IMAGES() function which interfaces to the images endpoint.
11491186

11501187
Details -> https://github.com/ropensci/plotly/pull/279
11511188

R/animate.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ animation_opts_defaults <- function() {
122122
}
123123

124124

125-
#' @inheritParams animation_opts
126125
#' @param hide remove the animation slider?
127126
#' @param ... for `animation_slider`, attributes are passed to a special
128127
#' layout.sliders object tied to the animation frames.
@@ -149,7 +148,6 @@ animation_slider <- function(p, hide = FALSE, ...) {
149148
}
150149

151150

152-
#' @inheritParams animation_slider
153151
#' @param label a character string used for the animation button's label
154152
#' @export
155153
#' @rdname animation

0 commit comments

Comments
 (0)