Skip to content

Commit 79b5663

Browse files
committed
Merge branch 'master' into fix-ggplotly-regressions
2 parents aa324f8 + 0fe3e53 commit 79b5663

File tree

29 files changed

+174
-109
lines changed

29 files changed

+174
-109
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/docs.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,11 @@ jobs:
4949
ruby-version: '2.7.4'
5050
bundler-cache: true
5151

52-
- name: Setup Python
53-
uses: actions/setup-python@v5
54-
with:
55-
python-version: '3.11'
56-
5752
- name: Fetch R/ggplot2 docs from plotly.r-docs
5853
run: make fetch
5954

60-
- name: Validate front-matter
61-
run: python front-matter-ci.py _posts
62-
6355
- name: Build site
64-
run: bundle exec jekyll build
56+
run: bundle exec jekyll build --config _config.yml,_config_production.yml
6557
env:
6658
JEKYLL_ENV: production
6759

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ revdep/
1919
travis_debug.R
2020
.httr-oauth
2121
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/

NEWS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# plotly (development version)
22

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+
322
## Improvements
423

524
* `save_image()` now works with kaleido v1.0 and higher. (#2447)

R/plotly.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ typedArrayPolyfill <- function() {
479479
plotlyMainBundle <- function() {
480480
htmltools::htmlDependency(
481481
name = "plotly-main",
482-
version = "2.11.1",
482+
version = "2.25.2",
483483
package = "plotly",
484484
src = dependency_dir("plotlyjs"),
485485
script = "plotly-latest.min.js",

R/sysdata.rda

15.3 KB
Binary file not shown.

inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/001.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,9 @@
442442
},
443443
{
444444
"name": "plotly-htmlwidgets-css",
445-
"version": "2.11.1",
445+
"version": "2.25.2",
446446
"src": {
447-
"href": "plotly-htmlwidgets-css-2.11.1"
447+
"href": "plotly-htmlwidgets-css-2.25.2"
448448
},
449449
"meta": null,
450450
"script": null,
@@ -455,9 +455,9 @@
455455
},
456456
{
457457
"name": "plotly-main",
458-
"version": "2.11.1",
458+
"version": "2.25.2",
459459
"src": {
460-
"href": "plotly-main-2.11.1"
460+
"href": "plotly-main-2.25.2"
461461
},
462462
"meta": null,
463463
"script": "plotly-latest.min.js",

inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/002.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,9 @@
445445
},
446446
{
447447
"name": "plotly-htmlwidgets-css",
448-
"version": "2.11.1",
448+
"version": "2.25.2",
449449
"src": {
450-
"href": "plotly-htmlwidgets-css-2.11.1"
450+
"href": "plotly-htmlwidgets-css-2.25.2"
451451
},
452452
"meta": null,
453453
"script": null,
@@ -458,9 +458,9 @@
458458
},
459459
{
460460
"name": "plotly-main",
461-
"version": "2.11.1",
461+
"version": "2.25.2",
462462
"src": {
463-
"href": "plotly-main-2.11.1"
463+
"href": "plotly-main-2.25.2"
464464
},
465465
"meta": null,
466466
"script": "plotly-latest.min.js",

inst/examples/shiny/event_data/tests/testthat/_snaps/shinytest2/003.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,9 @@
449449
},
450450
{
451451
"name": "plotly-htmlwidgets-css",
452-
"version": "2.11.1",
452+
"version": "2.25.2",
453453
"src": {
454-
"href": "plotly-htmlwidgets-css-2.11.1"
454+
"href": "plotly-htmlwidgets-css-2.25.2"
455455
},
456456
"meta": null,
457457
"script": null,
@@ -462,9 +462,9 @@
462462
},
463463
{
464464
"name": "plotly-main",
465-
"version": "2.11.1",
465+
"version": "2.25.2",
466466
"src": {
467-
"href": "plotly-main-2.11.1"
467+
"href": "plotly-main-2.25.2"
468468
},
469469
"meta": null,
470470
"script": "plotly-latest.min.js",

0 commit comments

Comments
 (0)