Skip to content

Commit 0fe3e53

Browse files
cpsievertclaude
andauthored
chore: update plotly.js to v2.25.2 (#2471)
* chore: upgrade plotly.js to v2.12.0 Key changes in v2.12.0: - Added `griddash` axis property for multiple plot types - Added minor tick and grid line styling options - Performance improvement with "willReadFrequently" 2D context - Fixed blank tick labels on cartesian axes Also modified update_plotlyjs.R to support specific version targeting. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.12.1 Bug fixes: - Fixed disabling polar rotation when dragmode is false - Fixed custom modebar buttons mutating input - Corrected schema description spacing Also added .venv/ to .gitignore. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.13.0 New features: - Persistent and editable selections over cartesian subplots - New parallel coordinates options (unselected line color/opacity) - Enhanced violin trace with additional quartile algorithms - More flexible automargin control on cartesian axes - Added delta.prefix and delta.suffix to indicator traces - Added Chinese (Taiwan) and Sinhala locales 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.13.1 Bug fix: - Fixed regression where selections were improperly attached to undefined event data 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.13.2 Bug fixes: - Fixed sankey select error introduced in v2.13.0 - Fixed handling of missing drag layer for invisible sankey traces - Fixed selection event emission in shape drawing dragmodes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.13.3 Bug fix: - Emit plotly_selected event on plot API calls and GUI edits 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.14.0 New features: - Added support for sankey links with arrows - Added editSelection option to config - Updated Dutch translations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.15.0 New features: - New marker properties: angle, angleref, standoff - Legend control: entrywidth and entrywidthmode - Layout: minreducedwidth and minreducedheight for automargin control - Updated pie chart rotation to use angle value type Bug fixes: - Fixed automargin axis title updates - Fixed pattern and slice export issues 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.15.1 Fix: - Fixed npm module issue 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.16.0 New features: - Clustering options for scattermapbox - Bounds support for mapbox subplots 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.16.1 Bug fix: - Fixed choroplethmapbox selection when adding new traces 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.16.2 Bug fix: - Fixed regression in mapbox clearOutline from v2.13.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.16.3 Bug fix: - Fixed hover on multicategory axes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.16.4 Bug fix: - Fixed regression with scattermapbox redraw from v2.16.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.16.5 Bug fix: - Disabled slider interactions when staticPlot is true 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.17.0 New features: - Added y-axes shift and autoshift to avoid axis overlapping - Added group attributes for scatter trace: alignmentgroup, offsetgroup - Added marker.cornerradius for treemap trace Changes: - Switched bundler from browserify to webpack 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.17.1 Bug fix: - Fixed line redraw regression from v2.15.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.18.0 New features: - Added new sync tickmode option - Improved mobile & tablet device detection for WebGL rendering Bug fix: - Fixed requirejs AMD loader import name issue (regression from v2.17.0) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.18.1 Changes: - Upgraded d3-interpolate and d3-color to v3 Bug fixes: - Fixed SVG export scaling by removing vector-effect CSS for static plots - Fixed hover on IE (regression from v2.5.0) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.18.2 Bug fixes: - Prevented attaching internal d3 object to window (regression from v2.17.0) - Fixed lower/upper fence order in French locale - Fixed formats in Peruvian Spanish (es-pe) locale 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.19.0 New features: - Added shape label attribute - Added labelalias for various axes types Bug fix: - Fixed hover label overlap for hovermode: 'x'|'y' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.19.1 Bug fix: - Ensure slider range stays in bounds during drag 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.20.0 New feature: - Added title.automargin for automatic top/bottom margining 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.21.0 New features: - Added label.texttemplate for parametric shapes - Added strict option for custom bundle command Bug fixes: - Fixed legend dragging with non-default anchors - Fixed heatmap zsmooth: "fast" rendering/performance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.22.0 New features: - Multiple legend support with legend2, legend3, etc. - Added visible option for legends Bug fixes: - Fixed plotly_click on touch devices for gl3d scenes - Fixed scatter3d when marker.opacity is zero - Fixed scattermapbox visibility restyle - Updated Norwegian and Slovak translations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.23.0 New features: - Added legend.xref and legend.yref for container-referenced positioning - Added colorbar.xref and colorbar.yref for container-referenced positioning Performance: - Improved heatmap rendering performance when zsmooth is false 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: upgrade plotly.js to v2.23.1 Bug fix: - Fixed heatmap rendering on iOS and Safari when zsmooth is false 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Upgrade plotly.js to v2.23.2 - Fixed text rendering while drawing new shapes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Upgrade plotly.js to v2.24.0 - Added pattern support for pie, funnelarea, sunburst, icicle, and treemap charts - Fixed hover text access when all markers have "hoverinfo: none" - Fixed margin spacing for container-referenced legends and colorbars 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Upgrade plotly.js to v2.24.1 - Fixed minimal copying of arrays in minExtend function (regression from v2.24.0) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Upgrade plotly.js to v2.24.2 - Fixed legend groups toggle (regression from v2.22.0) - Fixed waterfall chart hover template delta display on total values 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Upgrade plotly.js to v2.24.3 - Fixed double-click hiding traces in other legends - Fixed double-click behavior for pie chart slices with multiple legends - Fixed legend group and trace order defaults with multiple legends 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Upgrade plotly.js to v2.25.0 - Added "Equal Earth" projection for geo subplots - Added options to include legends for shapes and newshape - Added Plotly.deleteActiveShape command - Fixed contour plot colorscale domain calculation - Fixed text markers on non-mapbox styled maps 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Upgrade plotly.js to v2.25.1 - Fixed clearing legend using React (regression from v2.25.0) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Upgrade plotly.js to v2.25.2 - Updated Croatian translations (hr locale) - Security fix: addressed potential prototype pollution in plot API calls This completes the upgrade from v2.11.1 to v2.25.2. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add TODO tracking file for plotly.js upgrade Tracks: - Potential regressions to test (pie rotation, selection events, SVG export, etc.) - Potential improvements/new features to expose in R package 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update TODO with regression investigation results Investigated all 9 potential regressions - none are actual regressions: - Pie rotation: schema change only, no behavioral change - Selection events: improvement (more consistent event emission) - SVG export: bug fix improving export quality - Multiple legends: additive feature, regression already fixed - Automargin: additive feature only - Hover labels: bug fix improving positioning - Bundle size: actually decreased by ~90KB - Static plots: bug fix for expected behavior - Heatmap: bug fixes and performance improvements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update .Rbuildignore to exclude upgrade files Exclude from package build: - .venv (Python virtual environment) - CLAUDE.md (project instructions) - PLOTLYJS_UPGRADE_LOG.md (upgrade tracking) - PLOTLYJS_UPGRADE_TODO.md (upgrade todos) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Clean up upgrade tracking files and revert R version requirement - Remove PLOTLYJS_UPGRADE_LOG.md and PLOTLYJS_UPGRADE_TODO.md from git (kept locally via .gitignore) - Revert R version requirement to >= 3.2.0 (plotly.js upgrade doesn't require newer R) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Restore upgrade tracking files to git Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Accept new snaps * Update shinytest2 snapshots for plotly.js v2.25.2 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Document plotly.js v2.25.2 upgrade in NEWS Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Remove upgrade tracking files from git (keep locally) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Apply suggestions from code review --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 1d0458e commit 0fe3e53

File tree

28 files changed

+173
-100
lines changed

28 files changed

+173
-100
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

.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
@@ -459,9 +459,9 @@
459459
},
460460
{
461461
"name": "plotly-htmlwidgets-css",
462-
"version": "2.11.1",
462+
"version": "2.25.2",
463463
"src": {
464-
"href": "plotly-htmlwidgets-css-2.11.1"
464+
"href": "plotly-htmlwidgets-css-2.25.2"
465465
},
466466
"meta": null,
467467
"script": null,
@@ -472,9 +472,9 @@
472472
},
473473
{
474474
"name": "plotly-main",
475-
"version": "2.11.1",
475+
"version": "2.25.2",
476476
"src": {
477-
"href": "plotly-main-2.11.1"
477+
"href": "plotly-main-2.25.2"
478478
},
479479
"meta": null,
480480
"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
@@ -462,9 +462,9 @@
462462
},
463463
{
464464
"name": "plotly-htmlwidgets-css",
465-
"version": "2.11.1",
465+
"version": "2.25.2",
466466
"src": {
467-
"href": "plotly-htmlwidgets-css-2.11.1"
467+
"href": "plotly-htmlwidgets-css-2.25.2"
468468
},
469469
"meta": null,
470470
"script": null,
@@ -475,9 +475,9 @@
475475
},
476476
{
477477
"name": "plotly-main",
478-
"version": "2.11.1",
478+
"version": "2.25.2",
479479
"src": {
480-
"href": "plotly-main-2.11.1"
480+
"href": "plotly-main-2.25.2"
481481
},
482482
"meta": null,
483483
"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
@@ -466,9 +466,9 @@
466466
},
467467
{
468468
"name": "plotly-htmlwidgets-css",
469-
"version": "2.11.1",
469+
"version": "2.25.2",
470470
"src": {
471-
"href": "plotly-htmlwidgets-css-2.11.1"
471+
"href": "plotly-htmlwidgets-css-2.25.2"
472472
},
473473
"meta": null,
474474
"script": null,
@@ -479,9 +479,9 @@
479479
},
480480
{
481481
"name": "plotly-main",
482-
"version": "2.11.1",
482+
"version": "2.25.2",
483483
"src": {
484-
"href": "plotly-main-2.11.1"
484+
"href": "plotly-main-2.25.2"
485485
},
486486
"meta": null,
487487
"script": "plotly-latest.min.js",

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,9 @@
467467
},
468468
{
469469
"name": "plotly-htmlwidgets-css",
470-
"version": "2.11.1",
470+
"version": "2.25.2",
471471
"src": {
472-
"href": "plotly-htmlwidgets-css-2.11.1"
472+
"href": "plotly-htmlwidgets-css-2.25.2"
473473
},
474474
"meta": null,
475475
"script": null,
@@ -480,9 +480,9 @@
480480
},
481481
{
482482
"name": "plotly-main",
483-
"version": "2.11.1",
483+
"version": "2.25.2",
484484
"src": {
485-
"href": "plotly-main-2.11.1"
485+
"href": "plotly-main-2.25.2"
486486
},
487487
"meta": null,
488488
"script": "plotly-latest.min.js",

0 commit comments

Comments
 (0)